From commits-noreply at bitbucket.org Thu Jul 1 18:00:20 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 16:00:20 +0000 (UTC) Subject: [py-svn] py-trunk commit 6fbc09503b76: add a tox.ini file Message-ID: <20100701160020.5B3F37EF8C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1277999975 -7200 # Node ID 6fbc09503b76b58609714ffe081e92584ba7b34e # Parent 978336b999108804ed82bdcc016b38a24073e165 add a tox.ini file --- /dev/null +++ b/tox.ini @@ -0,0 +1,20 @@ +[test] +changedir=testing +argv=py.test + --basetemp={envtmpdir} + --junitxml=junit-{envname}.xml +[testenv:py26] +python=python2.6 +[testenv:py25] +python=python2.5 +[testenv:py24] +python=python2.4 +[testenv:py31] +python=python3.1 +#[testenv:pypy] +#python=pypy-c +#[testenv:jython] +#python=jython +#argv=jython +# -c +# import py ; py.cmdline.pytest(["-x", "--basetemp={envtmpdir}", "--junitxml=junit-${envname}.xml", "-k", "collect"]) From commits-noreply at bitbucket.org Thu Jul 1 18:13:02 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 16:13:02 +0000 (UTC) Subject: [py-svn] py-trunk commit 84e6c18ad7a2: use confcutdir Message-ID: <20100701161302.865BB7EF4B@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278000758 -7200 # Node ID 84e6c18ad7a24eb6771167b7037c4b02150feb74 # Parent 6fbc09503b76b58609714ffe081e92584ba7b34e use confcutdir --- a/tox.ini +++ b/tox.ini @@ -2,6 +2,7 @@ changedir=testing argv=py.test --basetemp={envtmpdir} + --confcutdir=.. --junitxml=junit-{envname}.xml [testenv:py26] python=python2.6 From commits-noreply at bitbucket.org Thu Jul 1 18:40:08 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 16:40:08 +0000 (UTC) Subject: [py-svn] py-trunk commit 868fb976ad6c: (ARGH) of windows/hudson/multi-config combo produces too long filenames, so use the global temp dir Message-ID: <20100701164008.177D27EFBE@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278002365 -7200 # Node ID 868fb976ad6c72c10c9d58187633f0dd324bd440 # Parent 84e6c18ad7a24eb6771167b7037c4b02150feb74 (ARGH) of windows/hudson/multi-config combo produces too long filenames, so use the global temp dir --- a/tox.ini +++ b/tox.ini @@ -1,7 +1,6 @@ [test] changedir=testing argv=py.test - --basetemp={envtmpdir} --confcutdir=.. --junitxml=junit-{envname}.xml [testenv:py26] From commits-noreply at bitbucket.org Thu Jul 1 19:28:27 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 17:28:27 +0000 (UTC) Subject: [py-svn] py-trunk commit 969c9adc183f: make initial conftest finding ignore "--" arguments Message-ID: <20100701172827.279C77EF4B@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278005260 -7200 # Node ID 969c9adc183f034981563c2de26b329e5a142008 # Parent 868fb976ad6c72c10c9d58187633f0dd324bd440 make initial conftest finding ignore "--" arguments --- a/py/_test/conftesthandle.py +++ b/py/_test/conftesthandle.py @@ -36,6 +36,8 @@ class Conftest(object): self._confcutdir = p break for arg in args + [current]: + if hasattr(arg, 'startswith') and arg.startswith("--"): + continue anchor = current.join(arg, abs=1) if anchor.check(): # we found some file object self._path2confmods[None] = self.getconftestmodules(anchor) --- a/testing/test_conftesthandle.py +++ b/testing/test_conftesthandle.py @@ -98,6 +98,14 @@ def test_conftest_in_nonpkg_with_init(tm tmpdir.ensure("adir-1.0/__init__.py") conftest = ConftestWithSetinitial(tmpdir.join("adir-1.0", "b")) +def test_doubledash_not_considered(testdir): + conf = testdir.mkdir("--option") + conf.join("conftest.py").ensure() + conftest = Conftest() + conftest.setinitial([conf.basename, conf.basename]) + l = conftest.getconftestmodules(None) + assert len(l) == 0 + def test_conftestcutdir(testdir): conf = testdir.makeconftest("") p = testdir.mkdir("x") --- a/CHANGELOG +++ b/CHANGELOG @@ -55,6 +55,7 @@ Bug fixes / Maintenance get canonical script paths in virtualenv situations - make path.bestrelpath(path) return ".", note that when calling X.bestrelpath the assumption is that X is a directory. +- make initial conftest discovery ignore "--" prefixed arguments Changes between 1.3.0 and 1.3.1 ================================================== From commits-noreply at bitbucket.org Thu Jul 1 19:44:25 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 17:44:25 +0000 (UTC) Subject: [py-svn] py-trunk commit 168b6423a6a5: add jython env Message-ID: <20100701174425.950C17EF77@bitbucket.org> 404 - Not Found — bitbucket.org

404 - Not Found

We're sorry, but we couldn't find the page you were looking for.

You can perhaps find what you're looking for by doing a search in the list of public repositories.

If you feel that this is an error on our part, please send us an email with details about the error and what you were doing when it occurred.

-- The Bitbucket team

From commits-noreply at bitbucket.org Thu Jul 1 19:46:35 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 17:46:35 +0000 (UTC) Subject: [py-svn] py-trunk commit a9c19a9339a4: actually run only "testing" tests Message-ID: <20100701174635.4DA917EFB2@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278006382 -7200 # Node ID a9c19a9339a41dab92771791205a80452b424da9 # Parent 168b6423a6a5692fffe2cfe95ef771157fb1fa22 actually run only "testing" tests --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,7 @@ python=python3.1 #[testenv:pypy] #python=pypy-c [testenv:jython] +changedir=testing python=jython argv=jython {envtmpdir}/../bin/py.test From commits-noreply at bitbucket.org Thu Jul 1 19:54:40 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 1 Jul 2010 17:54:40 +0000 (UTC) Subject: [py-svn] py-trunk commit 984566117033: py.test-1.3.1 does not provide py.test proper for jython, only py.test-jython Message-ID: <20100701175440.B63797EFB3@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278006868 -7200 # Node ID 9845661170337ed92af735c3660653f0669ec76b # Parent a9c19a9339a41dab92771791205a80452b424da9 py.test-1.3.1 does not provide py.test proper for jython, only py.test-jython (py.test-1.3.2 will provide py.test even for jython installs) --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,6 @@ python=python3.1 changedir=testing python=jython argv=jython - {envtmpdir}/../bin/py.test + {envtmpdir}/../bin/py.test-jython --confcutdir=.. --junitxml=junit-{envname}.xml From commits-noreply at bitbucket.org Fri Jul 2 10:16:21 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 2 Jul 2010 08:16:21 +0000 (UTC) Subject: [py-svn] py-trunk commit 23a5a69a0fa3: use the new envbindir subst Message-ID: <20100702081621.97FB97EFC5@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278058530 -7200 # Node ID 23a5a69a0fa3debba7ce038900da647593e72b42 # Parent 9845661170337ed92af735c3660653f0669ec76b use the new envbindir subst --- a/tox.ini +++ b/tox.ini @@ -17,6 +17,6 @@ python=python3.1 changedir=testing python=jython argv=jython - {envtmpdir}/../bin/py.test-jython + {envbindir}/py.test-jython --confcutdir=.. --junitxml=junit-{envname}.xml From commits-noreply at bitbucket.org Fri Jul 2 13:02:20 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 2 Jul 2010 11:02:20 +0000 (UTC) Subject: [py-svn] py-trunk commit af06c1efba2b: apply patch from Jakub wrt fixing resultlog/xdist combo Message-ID: <20100702110220.158167EF7E@bitbucket.org> 404 - Not Found — bitbucket.org

404 - Not Found

We're sorry, but we couldn't find the page you were looking for.

You can perhaps find what you're looking for by doing a search in the list of public repositories.

If you feel that this is an error on our part, please send us an email with details about the error and what you were doing when it occurred.

-- The Bitbucket team

From commits-noreply at bitbucket.org Fri Jul 2 15:26:57 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 2 Jul 2010 13:26:57 +0000 (UTC) Subject: [py-svn] py-trunk commit c98b5ca6ceac: updated tox.ini Message-ID: <20100702132657.E7BFA7EF4B@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278077163 -7200 # Node ID c98b5ca6ceac43205575557ef2269fdb1b16a41e # Parent af06c1efba2bff3d93fc26d539d24c2ed13b294f updated tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,22 +1,24 @@ -[test] +[testenv] changedir=testing argv=py.test --confcutdir=.. --junitxml=junit-{envname}.xml [testenv:py26] -python=python2.6 +basepython=python2.6 [testenv:py25] -python=python2.5 +basepython=python2.5 [testenv:py24] -python=python2.4 +basepython=python2.4 [testenv:py31] -python=python3.1 +basepython=python3.1 #[testenv:pypy] #python=pypy-c [testenv:jython] changedir=testing -python=jython -argv=jython - {envbindir}/py.test-jython - --confcutdir=.. - --junitxml=junit-{envname}.xml +basepython=jython +deps=pytest-xdist +argv= + {envpython} + {envbindir}/py.test-jython + acceptance_test.py + plugin From commits-noreply at bitbucket.org Fri Jul 2 15:33:54 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 2 Jul 2010 13:33:54 +0000 (UTC) Subject: [py-svn] py-trunk commit 37633dfd62ae: another correction Message-ID: <20100702133354.05C0E7EF70@bitbucket.org> 404 - Not Found — bitbucket.org

404 - Not Found

We're sorry, but we couldn't find the page you were looking for.

You can perhaps find what you're looking for by doing a search in the list of public repositories.

If you feel that this is an error on our part, please send us an email with details about the error and what you were doing when it occurred.

-- The Bitbucket team

From commits-noreply at bitbucket.org Sat Jul 3 14:30:20 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 3 Jul 2010 12:30:20 +0000 (UTC) Subject: [py-svn] py-trunk commit 0468f03a157c: update tox.ini according to tox progress Message-ID: <20100703123020.191937EF95@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278160183 -7200 # Node ID 0468f03a157c29265c0b63bddbb3486328132a77 # Parent 37633dfd62aebc58e84d898fdb8b4c1bd77ef8df update tox.ini according to tox progress --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,7 @@ [testenv] changedir=testing -argv=py.test - --confcutdir=.. - --junitxml=junit-{envname}.xml +commands= + py.test --confcutdir=.. --junitxml=junit-{envname}.xml [] [testenv:py26] basepython=python2.6 [testenv:py25] @@ -17,10 +16,8 @@ basepython=python3.1 changedir=testing basepython=jython deps=pytest-xdist -argv= - {envpython} - {envbindir}/py.test-jython - --confcutdir=.. - --junitxml=junit-{envname}.xml - acceptance_test.py - plugin +commands= + {envpython} {envbindir}/py.test-jython --confcutdir=.. \ + --junitxml=junit-{envname}1.xml [io_ code] + {envpython} {envbindir}/py.test-jython --confcutdir=.. \ + --junitxml=junit-{envname}2.xml acceptance_test.py plugin From commits-noreply at bitbucket.org Sat Jul 3 14:30:59 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 3 Jul 2010 12:30:59 +0000 (UTC) Subject: [py-svn] py-trunk commit 8957b027084b: update again Message-ID: <20100703123059.683B17EF70@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278160247 -7200 # Node ID 8957b027084b2b04389338046a5d9a2d676e48f8 # Parent 0468f03a157c29265c0b63bddbb3486328132a77 update again --- a/tox.ini +++ b/tox.ini @@ -18,6 +18,6 @@ basepython=jython deps=pytest-xdist commands= {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - --junitxml=junit-{envname}1.xml [io_ code] + -n3 --junitxml=junit-{envname}1.xml [io_ code] {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - --junitxml=junit-{envname}2.xml acceptance_test.py plugin + -n3 --junitxml=junit-{envname}2.xml acceptance_test.py plugin From commits-noreply at bitbucket.org Sat Jul 3 14:45:40 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 3 Jul 2010 12:45:40 +0000 (UTC) Subject: [py-svn] py-trunk commit dbb019718f6d: remove the --junitxmlprefix feature - it's kind of YAGNI i guess - Message-ID: <20100703124540.B31527EF77@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278161087 -7200 # Node ID dbb019718f6d7db2e274e5d1b1a90df10f0e858e # Parent 69b956bf1e45a1e2fce5a9ed8434059be43d9c75 remove the --junitxmlprefix feature - it's kind of YAGNI i guess - i introduced it after 1.3.1 but don't need it anymore and thus it's not going to be there for 1.3.2. --- a/testing/plugin/test_pytest_junitxml.py +++ b/testing/plugin/test_pytest_junitxml.py @@ -119,7 +119,7 @@ class TestPython: classname="test_failure_escape.test_failure_escape", name="test_func[&]") - def test_junit_prefixing(self, testdir): + def YAGNI_test_junit_prefixing(self, testdir): testdir.makepyfile(""" def test_func(): assert 0 --- a/py/_plugin/pytest_junitxml.py +++ b/py/_plugin/pytest_junitxml.py @@ -11,14 +11,15 @@ def pytest_addoption(parser): group.addoption('--junitxml', action="store", dest="xmlpath", metavar="path", default=None, help="create junit-xml style report file at given path.") - group.addoption('--junitprefix', action="store", dest="junitprefix", - metavar="str", default=None, - help="prepend prefix to classnames in junit-xml output") + # probalby YAGNI, therefore commented out: + #group.addoption('--junitprefix', action="store", dest="junitprefix", + # metavar="str", default=None, + # help="prepend prefix to classnames in junit-xml output") def pytest_configure(config): xmlpath = config.option.xmlpath if xmlpath: - config._xml = LogXML(xmlpath, config.option.junitprefix) + config._xml = LogXML(xmlpath, None) # config.option.junitprefix) config.pluginmanager.register(config._xml) def pytest_unconfigure(config): --- a/CHANGELOG +++ b/CHANGELOG @@ -17,9 +17,6 @@ New features (thanks Ronny Pfannschmidt) -- introduce '--junitprefix=STR' option to prepend a prefix - to all reports in the junitxml file. - - Funcarg factories can now dynamically apply a marker to a test invocation. This is for example useful if a factory provides parameters to a test which are expected-to-fail: @@ -36,15 +33,15 @@ Bug fixes / Maintenance - refine --pdb: ignore xfailed tests, unify its TB-reporting and don't display failures again at the end. -- fix assertion interpretation with the ** operator -- fix issue105 assignment on the same line as a failing assertion -- fix issue104 proper escaping for test names in junitxml plugin -- fix issue57 -f|--looponfail to work with xpassing tests -- fix issue92 collectonly reporter and --pastebin +- fix assertion interpretation with the ** operator (thanks Benjamin Peterson) +- fix issue105 assignment on the same line as a failing assertion (thanks Benjamin Peterson) +- fix issue104 proper escaping for test names in junitxml plugin (thanks anonymous) +- fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) +- fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) - fix py.code.compile(source) to generate unique filenames - fix assertion re-interp problems on PyPy, by defering code - compilation to the (overridable) Frame.eval class. -- fix pyimport() to work with directories + compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) +- fix py.path.local.pyimport() to work with directories - streamline py.path.local.mkdtemp implementation and usage - don't print empty lines when showing junitxml-filename - add optional boolean ignore_errors parameter to py.path.local.remove --- a/AUTHORS +++ b/AUTHORS @@ -1,9 +1,9 @@ Holger Krekel, holger at merlinux eu +Benjamin Peterson, benjamin at python org +Ronny Pfannschmidt, Ronny.Pfannschmidt at gmx de Guido Wesdorp, johnny at johnnydebris net Samuele Pedroni, pedronis at openend se Carl Friedrich Bolz, cfbolz at gmx de -Benjamin Peterson, benjamin at python org -Ronny Pfannschmidt, Ronny.Pfannschmidt at gmx de Armin Rigo, arigo at tunes org Maciek Fijalkowski, fijal at genesilico pl Brian Dorsey, briandorsey at gmail com From commits-noreply at bitbucket.org Sat Jul 3 14:45:40 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 3 Jul 2010 12:45:40 +0000 (UTC) Subject: [py-svn] py-trunk commit 69b956bf1e45: refine header message Message-ID: <20100703124540.9DC637EF70@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278160527 -7200 # Node ID 69b956bf1e45a1e2fce5a9ed8434059be43d9c75 # Parent 8957b027084b2b04389338046a5d9a2d676e48f8 refine header message --- a/py/_plugin/pytest_terminal.py +++ b/py/_plugin/pytest_terminal.py @@ -295,7 +295,7 @@ class TerminalReporter: for line in flatten(lines): self.write_line(line) for i, testarg in enumerate(self.config.args): - self.write_line("test object %d: %s" %(i+1, testarg)) + self.write_line("test path %d: %s" %(i+1, testarg)) def pytest_sessionfinish(self, exitstatus, __multicall__): __multicall__.execute() From commits-noreply at bitbucket.org Sat Jul 3 14:55:01 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 3 Jul 2010 12:55:01 +0000 (UTC) Subject: [py-svn] py-trunk commit 44e8e01d6b6f: don't use dist-testing with jython to uncomplicate the testing matter Message-ID: <20100703125501.8D7BF7EFAA@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278161688 -7200 # Node ID 44e8e01d6b6f7a6c4d53c3c15c0d4c2ca77c4753 # Parent dbb019718f6d7db2e274e5d1b1a90df10f0e858e don't use dist-testing with jython to uncomplicate the testing matter --- a/tox.ini +++ b/tox.ini @@ -15,9 +15,8 @@ basepython=python3.1 [testenv:jython] changedir=testing basepython=jython -deps=pytest-xdist commands= {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - -n3 --junitxml=junit-{envname}1.xml [io_ code] + --junitxml=junit-{envname}1.xml [io_ code] {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - -n3 --junitxml=junit-{envname}2.xml acceptance_test.py plugin + --junitxml=junit-{envname}2.xml acceptance_test.py plugin From commits-noreply at bitbucket.org Sun Jul 4 13:57:24 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sun, 4 Jul 2010 11:57:24 +0000 (UTC) Subject: [py-svn] py-trunk commit 040f09b5c1f1: enable some more tests Message-ID: <20100704115724.56B9A7EF90@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278244563 -7200 # Node ID 040f09b5c1f1330286f5a5f59c1e538f9d02d2dc # Parent 44e8e01d6b6f7a6c4d53c3c15c0d4c2ca77c4753 enable some more tests --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,23 @@ [testenv] changedir=testing commands= - py.test --confcutdir=.. --junitxml=junit-{envname}.xml [] + py.test --confcutdir=.. -rfsxX --junitxml=junit-{envname}.xml --tools-on-path [] +deps=pexpect [testenv:py26] basepython=python2.6 +[testenv:doc] +basepython=python +deps=docutils + pygments +changedir=doc +commands= py.test -rsfxX [testenv:py25] basepython=python2.5 [testenv:py24] basepython=python2.4 [testenv:py31] basepython=python3.1 +deps= #[testenv:pypy] #python=pypy-c [testenv:jython] @@ -17,6 +25,6 @@ changedir=testing basepython=jython commands= {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - --junitxml=junit-{envname}1.xml [io_ code] + -rfsxX --junitxml=junit-{envname}1.xml [io_ code] {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - --junitxml=junit-{envname}2.xml acceptance_test.py plugin + -rfsxX --junitxml=junit-{envname}2.xml acceptance_test.py plugin From commits-noreply at bitbucket.org Sun Jul 4 17:07:59 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sun, 4 Jul 2010 15:07:59 +0000 (UTC) Subject: [py-svn] py-trunk commit 53dfacb2e595: refine and extend custom error reporting particularly for collection-related errors Message-ID: <20100704150759.2D8D77EF95@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278256010 -7200 # Node ID 53dfacb2e5951b84aedea5ea0fc23b206ca7c20d # Parent 040f09b5c1f1330286f5a5f59c1e538f9d02d2dc refine and extend custom error reporting particularly for collection-related errors --- a/testing/plugin/test_pytest_capture.py +++ b/testing/plugin/test_pytest_capture.py @@ -84,6 +84,7 @@ def test_capturing_unicode(testdir, meth else: obj = "u'\u00f6y'" testdir.makepyfile(""" + # coding=utf8 # taken from issue 227 from nosetests def test_unicode(): import sys --- a/py/_plugin/pytest_runner.py +++ b/py/_plugin/pytest_runner.py @@ -126,6 +126,12 @@ class BaseReport(object): longrepr.toterminal(out) else: out.line(str(longrepr)) + +class CollectErrorRepr(BaseReport): + def __init__(self, msg): + self.longrepr = msg + def toterminal(self, out): + out.line(str(self.longrepr), red=True) class ItemTestReport(BaseReport): failed = passed = skipped = False @@ -188,16 +194,16 @@ class CollectReport(BaseReport): self.passed = True self.result = result else: - style = "short" - if collector.config.getvalue("fulltrace"): - style = "long" - self.longrepr = self.collector._repr_failure_py(excinfo, - style=style) if excinfo.errisinstance(py.test.skip.Exception): self.skipped = True self.reason = str(excinfo.value) + self.longrepr = self.collector._repr_failure_py(excinfo, "line") else: self.failed = True + errorinfo = self.collector.repr_failure(excinfo) + if not hasattr(errorinfo, "toterminal"): + errorinfo = CollectErrorRepr(errorinfo) + self.longrepr = errorinfo def getnode(self): return self.collector @@ -448,3 +454,4 @@ def importorskip(modname, minversion=Non modname, verattr, minversion)) return mod + --- a/testing/test_collect.py +++ b/testing/test_collect.py @@ -152,10 +152,35 @@ class TestPrunetraceback: result = testdir.runpytest(p) assert "__import__" not in result.stdout.str(), "too long traceback" result.stdout.fnmatch_lines([ - "*ERROR during collection*", + "*ERROR collecting*", "*mport*not_exists*" ]) + def test_custom_repr_failure(self, testdir): + p = testdir.makepyfile(""" + import not_exists + """) + testdir.makeconftest(""" + import py + def pytest_collect_file(path, parent): + return MyFile(path, parent) + class MyError(Exception): + pass + class MyFile(py.test.collect.File): + def collect(self): + raise MyError() + def repr_failure(self, excinfo): + if excinfo.errisinstance(MyError): + return "hello world" + return py.test.collect.File.repr_failure(self, excinfo) + """) + + result = testdir.runpytest(p) + result.stdout.fnmatch_lines([ + "*ERROR collecting*", + "*hello world*", + ]) + class TestCustomConftests: def test_ignore_collect_path(self, testdir): testdir.makeconftest(""" --- a/testing/test_session.py +++ b/testing/test_session.py @@ -74,7 +74,7 @@ class SessionTests: reprec = testdir.inline_runsource("this is really not python") l = reprec.getfailedcollections() assert len(l) == 1 - out = l[0].longrepr.reprcrash.message + out = str(l[0].longrepr) assert out.find(str('not python')) != -1 def test_exit_first_problem(self, testdir): --- a/py/_plugin/pytest_terminal.py +++ b/py/_plugin/pytest_terminal.py @@ -274,7 +274,6 @@ class TerminalReporter: if not report.passed: if report.failed: self.stats.setdefault("error", []).append(report) - msg = report.longrepr.reprcrash.message self.write_fspath_result(report.collector.fspath, "E") elif report.skipped: self.stats.setdefault("skipped", []).append(report) @@ -403,7 +402,7 @@ class TerminalReporter: msg = self._getfailureheadline(rep) if not hasattr(rep, 'when'): # collect - msg = "ERROR during collection " + msg + msg = "ERROR collecting " + msg elif rep.when == "setup": msg = "ERROR at setup of " + msg elif rep.when == "teardown": --- a/doc/test/customize.txt +++ b/doc/test/customize.txt @@ -466,6 +466,15 @@ and test classes and methods. Test funct are prefixed ``test`` by default. Test classes must start with a capitalized ``Test`` prefix. +Customizing error messages +------------------------------------------------- + +On test and collection nodes ``py.test`` will invoke +the ``node.repr_failure(excinfo)`` function which +you may override and make it return an error +representation string of your choice. It +will be reported as a (red) string. + .. _`package name`: constructing the package name for test modules --- a/CHANGELOG +++ b/CHANGELOG @@ -28,9 +28,17 @@ New features def test_function(arg): ... +- customizable error reporting: allow custom error reporting for + custom (test and particularly collection) nodes by always calling + ``node.repr_failure(excinfo)`` which you may override to return a + string error representation of your choice which is going to be + reported as a (red) string. + Bug fixes / Maintenance ++++++++++++++++++++++++++ +- improve error messages if importing a test module failed (ImportError, + import file mismatches, syntax errors) - refine --pdb: ignore xfailed tests, unify its TB-reporting and don't display failures again at the end. - fix assertion interpretation with the ** operator (thanks Benjamin Peterson) --- a/testing/test_pycollect.py +++ b/testing/test_pycollect.py @@ -22,15 +22,20 @@ class TestModule: del py.std.sys.modules['test_whatever'] b.ensure("test_whatever.py") result = testdir.runpytest() - s = result.stdout.str() - assert 'mismatch' in s - assert 'test_whatever' in s + result.stdout.fnmatch_lines([ + "*import*mismatch*", + "*imported*test_whatever*", + "*%s*" % a.join("test_whatever.py"), + "*not the same*", + "*%s*" % b.join("test_whatever.py"), + "*HINT*", + ]) def test_syntax_error_in_module(self, testdir): modcol = testdir.getmodulecol("this is a syntax error") - py.test.raises(SyntaxError, modcol.collect) - py.test.raises(SyntaxError, modcol.collect) - py.test.raises(SyntaxError, modcol.run) + py.test.raises(modcol.CollectError, modcol.collect) + py.test.raises(modcol.CollectError, modcol.collect) + py.test.raises(modcol.CollectError, modcol.run) def test_module_considers_pluginmanager_at_import(self, testdir): modcol = testdir.getmodulecol("pytest_plugins='xasdlkj',") --- a/py/_path/local.py +++ b/py/_path/local.py @@ -90,6 +90,9 @@ class LocalPath(FSBase): """ object oriented interface to os.path and other local filesystem related information. """ + class ImportMismatchError(ImportError): + """ raised on pyimport() if there is a mismatch of __file__'s""" + sep = os.sep class Checkers(common.Checkers): def _stat(self): @@ -531,10 +534,7 @@ class LocalPath(FSBase): if modfile.endswith("__init__.py"): modfile = modfile[:-12] if not self.samefile(modfile): - raise EnvironmentError("mismatch:\n" - "imported module %r\n" - "does not stem from %r\n" - "maybe __init__.py files are missing?" % (mod, str(self))) + raise self.ImportMismatchError(modname, modfile, self) return mod else: try: --- a/testing/path/test_local.py +++ b/testing/path/test_local.py @@ -360,10 +360,13 @@ class TestImport: pseudopath = tmpdir.ensure(name+"123.py") mod.__file__ = str(pseudopath) monkeypatch.setitem(sys.modules, name, mod) - excinfo = py.test.raises(EnvironmentError, "p.pyimport()") - s = str(excinfo.value) - assert "mismatch" in s - assert name+"123" in s + excinfo = py.test.raises(pseudopath.ImportMismatchError, + "p.pyimport()") + modname, modfile, orig = excinfo.value.args + assert modname == name + assert modfile == pseudopath + assert orig == p + assert issubclass(pseudopath.ImportMismatchError, ImportError) def test_pypkgdir(tmpdir): pkg = tmpdir.ensure('pkg1', dir=1) --- a/py/_test/pycollect.py +++ b/py/_test/pycollect.py @@ -3,6 +3,7 @@ Python related collection nodes. """ import py import inspect +import sys from py._test.collect import configproperty, warnoldcollect from py._test import funcargs from py._code.code import TerminalRepr @@ -140,7 +141,22 @@ class Module(py.test.collect.File, PyCol def _importtestmodule(self): # we assume we are only called once per module - mod = self.fspath.pyimport() + try: + mod = self.fspath.pyimport(ensuresyspath=True) + except SyntaxError: + excinfo = py.code.ExceptionInfo() + raise self.CollectError(excinfo.getrepr(style="short")) + except self.fspath.ImportMismatchError: + e = sys.exc_info()[1] + raise self.CollectError( + "import file mismatch:\n" + "imported module %r has this __file__ attribute:\n" + " %s\n" + "which is not the same as the test file we want to collect:\n" + " %s\n" + "HINT: use a unique basename for your test file modules" + % e.args + ) #print "imported test module", mod self.config.pluginmanager.consider_module(mod) return mod --- a/py/_test/collect.py +++ b/py/_test/collect.py @@ -174,7 +174,10 @@ class Node(object): return traceback def _repr_failure_py(self, excinfo, style=None): - excinfo.traceback = self._prunetraceback(excinfo.traceback) + if self.config.option.fulltrace: + style="long" + else: + excinfo.traceback = self._prunetraceback(excinfo.traceback) # XXX should excinfo.getrepr record all data and toterminal() # process it? if style is None: @@ -200,6 +203,8 @@ class Collector(Node): """ Directory = configproperty('Directory') Module = configproperty('Module') + class CollectError(Exception): + """ an error during collection, contains a custom message. """ def collect(self): """ returns a list of children (items and collectors) @@ -213,10 +218,12 @@ class Collector(Node): if colitem.name == name: return colitem - def repr_failure(self, excinfo, outerr=None): + def repr_failure(self, excinfo): """ represent a failure. """ - assert outerr is None, "XXX deprecated" - return self._repr_failure_py(excinfo) + if excinfo.errisinstance(self.CollectError): + exc = excinfo.value + return str(exc.args[0]) + return self._repr_failure_py(excinfo, style="short") def _memocollect(self): """ internal helper method to cache results of calling collect(). """ From commits-noreply at bitbucket.org Sun Jul 4 18:26:10 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sun, 4 Jul 2010 16:26:10 +0000 (UTC) Subject: [py-svn] py-trunk commit 15da1d41a6c3: improve testing of docs Message-ID: <20100704162610.78D457EF49@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278260722 -7200 # Node ID 15da1d41a6c30db07dd54400febdb3bd1c9833ce # Parent 53dfacb2e5951b84aedea5ea0fc23b206ca7c20d improve testing of docs --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ basepython=python deps=docutils pygments changedir=doc -commands= py.test -rsfxX +commands= py.test -rsfxX --confcutdir=.. --junitxml=junit-{envname}s --forcegen [testenv:py25] basepython=python2.5 [testenv:py24] From commits-noreply at bitbucket.org Sun Jul 4 19:17:37 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sun, 4 Jul 2010 17:17:37 +0000 (UTC) Subject: [py-svn] py-trunk commit 5b98ae122cbe: fix doc env Message-ID: <20100704171737.3C5F27EE6E@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278263809 -7200 # Node ID 5b98ae122cbe8b64efd856e732d750ebb6b19d71 # Parent 15da1d41a6c30db07dd54400febdb3bd1c9833ce fix doc env --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ basepython=python deps=docutils pygments changedir=doc -commands= py.test -rsfxX --confcutdir=.. --junitxml=junit-{envname}s --forcegen +commands= py.test -rsfxX --confcutdir=.. --junitxml=junit-{envname}s.xml --forcegen [testenv:py25] basepython=python2.5 [testenv:py24] From commits-noreply at bitbucket.org Sun Jul 4 22:13:56 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sun, 4 Jul 2010 20:13:56 +0000 (UTC) Subject: [py-svn] py-trunk commit 6d3330c22593: some minor compatibility issues wrt to the just released python2.7 Message-ID: <20100704201356.2D8377EF49@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278274392 -7200 # Node ID 6d3330c22593bd7ffd3436766f12b95fc863baae # Parent 5b98ae122cbe8b64efd856e732d750ebb6b19d71 some minor compatibility issues wrt to the just released python2.7 --- a/testing/log/test_warning.py +++ b/testing/log/test_warning.py @@ -4,7 +4,7 @@ mypath = py.path.local(__file__).new(ext def test_forwarding_to_warnings_module(): py.test.deprecated_call(py.log._apiwarn, "1.3", "..") -def test_apiwarn_functional(): +def test_apiwarn_functional(recwarn): capture = py.io.StdCapture() py.log._apiwarn("x.y.z", "something", stacklevel=1) out, err = capture.reset() @@ -15,7 +15,7 @@ def test_apiwarn_functional(): exp = "%s:%s" % (mypath, lno) assert err.find(exp) != -1 -def test_stacklevel(): +def test_stacklevel(recwarn): def f(): py.log._apiwarn("x", "some", stacklevel=2) # 3 @@ -27,7 +27,7 @@ def test_stacklevel(): warning = str(err) assert warning.find(":%s" % lno) != -1 -def test_stacklevel_initpkg_with_resolve(testdir): +def test_stacklevel_initpkg_with_resolve(testdir, recwarn): testdir.makepyfile(modabc=""" import py def f(): @@ -49,7 +49,7 @@ def test_stacklevel_initpkg_with_resolve loc = 'test_stacklevel_initpkg_with_resolve.py:2' assert warning.find(loc) != -1 -def test_stacklevel_initpkg_no_resolve(): +def test_stacklevel_initpkg_no_resolve(recwarn): def f(): py.log._apiwarn("x", "some", stacklevel="apipkg") capture = py.io.StdCapture() @@ -60,7 +60,7 @@ def test_stacklevel_initpkg_no_resolve() assert warning.find(":%s" % lno) != -1 -def test_function(): +def test_function(recwarn): capture = py.io.StdCapture() py.log._apiwarn("x.y.z", "something", function=test_function) out, err = capture.reset() --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,9 @@ changedir=testing commands= py.test --confcutdir=.. -rfsxX --junitxml=junit-{envname}.xml --tools-on-path [] deps=pexpect +[testenv:py27] +distribute=True +basepython=python2.7 [testenv:py26] basepython=python2.6 [testenv:doc] --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -341,7 +341,7 @@ def test_deindent(): lines = deindent(source.splitlines()) assert lines == ['', 'def f():', ' def g():', ' pass', ' '] - at py.test.mark.xfail + at py.test.mark.xfail("sys.version_info[:2] != (2,7)") def test_source_of_class_at_eof_without_newline(tmpdir): # this test fails because the implicit inspect.getsource(A) below # does not return the "x = 1" last line. --- a/testing/root/test_oldmagic.py +++ b/testing/root/test_oldmagic.py @@ -23,10 +23,7 @@ def test_invoke_compile(recwarn, monkeyp monkeypatch.setattr(py.builtin.builtins, 'compile', None) py.magic.invoke(compile=True) try: - co = compile("""if 1: - def f(): - return 1 - \n""", '', 'exec') + co = compile("def f(): return 1\n", '', 'exec') d = {} py.builtin.exec_(co, d) assert py.code.Source(d['f']) --- a/CHANGELOG +++ b/CHANGELOG @@ -37,6 +37,9 @@ New features Bug fixes / Maintenance ++++++++++++++++++++++++++ +- make tests and the ``pytest_recwarn`` plugin in paricular fully compatible + to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that + you can properly check for their existence in a cross-python manner). - improve error messages if importing a test module failed (ImportError, import file mismatches, syntax errors) - refine --pdb: ignore xfailed tests, unify its TB-reporting and --- a/testing/plugin/test_pytest_recwarn.py +++ b/testing/plugin/test_pytest_recwarn.py @@ -1,7 +1,7 @@ import py from py._plugin.pytest_recwarn import WarningsRecorder -def test_WarningRecorder(): +def test_WarningRecorder(recwarn): showwarning = py.std.warnings.showwarning rec = WarningsRecorder() assert py.std.warnings.showwarning != showwarning --- a/py/_plugin/pytest_recwarn.py +++ b/py/_plugin/pytest_recwarn.py @@ -33,7 +33,7 @@ warning: """ import py -import os +import sys, os def pytest_funcarg__recwarn(request): """Return a WarningsRecorder instance that provides these methods: @@ -41,9 +41,16 @@ def pytest_funcarg__recwarn(request): * ``pop(category=None)``: return last warning matching the category. * ``clear()``: clear list of warnings """ - warnings = WarningsRecorder() - request.addfinalizer(warnings.finalize) - return warnings + if sys.version_info >= (2,7): + import warnings + oldfilters = warnings.filters[:] + warnings.simplefilter('default') + def reset_filters(): + warnings.filters[:] = oldfilters + request.addfinalizer(reset_filters) + wrec = WarningsRecorder() + request.addfinalizer(wrec.finalize) + return wrec def pytest_namespace(): return {'deprecated_call': deprecated_call} From commits-noreply at bitbucket.org Mon Jul 5 15:58:00 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 5 Jul 2010 13:58:00 +0000 (UTC) Subject: [py-svn] py-trunk commit 1b424c45071a: updating tox.ini to new format Message-ID: <20100705135800.63AB47EF6B@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278338121 -7200 # Node ID 1b424c45071a10b74c508f68cf2837ef86286aaa # Parent 6d3330c22593bd7ffd3436766f12b95fc863baae updating tox.ini to new format --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,16 @@ +[tox] +distshare={homedir}/.tox/distshare + +[tox:hudson] +distshare={toxworkdir}/distshare + [testenv] -changedir=testing +changedir=testing commands= py.test --confcutdir=.. -rfsxX --junitxml=junit-{envname}.xml --tools-on-path [] -deps=pexpect +deps= + pexpect [testenv:py27] -distribute=True basepython=python2.7 [testenv:py26] basepython=python2.6 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,6 +9,7 @@ graft contrib graft bin graft testing #exclude *.orig +#exclude *.orig #exclude *.rej #exclude .hginore #exclude *.pyc From commits-noreply at bitbucket.org Mon Jul 5 17:15:18 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 5 Jul 2010 15:15:18 +0000 (UTC) Subject: [py-svn] py-trunk commit c3726ef7fda9: skip sdist on hudson Message-ID: <20100705151518.BEAFB7EE6E@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278342860 -7200 # Node ID c3726ef7fda9eab28f121915f1e4b55941deaed4 # Parent 1b424c45071a10b74c508f68cf2837ef86286aaa skip sdist on hudson --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ distshare={homedir}/.tox/distshare [tox:hudson] distshare={toxworkdir}/distshare +skip=sdist [testenv] changedir=testing @@ -10,6 +11,7 @@ commands= py.test --confcutdir=.. -rfsxX --junitxml=junit-{envname}.xml --tools-on-path [] deps= pexpect + {distshare}/py-1.3.2a1.zip [testenv:py27] basepython=python2.7 [testenv:py26] From commits-noreply at bitbucket.org Mon Jul 5 18:41:44 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 5 Jul 2010 16:41:44 +0000 (UTC) Subject: [py-svn] py-trunk commit 89c1f9c16e77: use the new sdistfile option Message-ID: <20100705164144.683C77EF21@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278348049 -7200 # Node ID 89c1f9c16e77248dc23a422ba73e0b2e01e83ae0 # Parent c3726ef7fda9eab28f121915f1e4b55941deaed4 use the new sdistfile option --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ distshare={homedir}/.tox/distshare [tox:hudson] distshare={toxworkdir}/distshare -skip=sdist +sdistfile={distshare}/py-1.3.2a1.zip [testenv] changedir=testing @@ -11,7 +11,6 @@ commands= py.test --confcutdir=.. -rfsxX --junitxml=junit-{envname}.xml --tools-on-path [] deps= pexpect - {distshare}/py-1.3.2a1.zip [testenv:py27] basepython=python2.7 [testenv:py26] From commits-noreply at bitbucket.org Tue Jul 6 12:05:26 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:05:26 +0000 (UTC) Subject: [py-svn] py-trunk commit 890a9cc881a1: adjust tox.ini Message-ID: <20100706100526.EFD287EF73@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278410662 -7200 # Node ID 890a9cc881a14fb167955a51a068114787fec1ce # Parent 89c1f9c16e77248dc23a422ba73e0b2e01e83ae0 adjust tox.ini --- a/tox.ini +++ b/tox.ini @@ -3,12 +3,13 @@ distshare={homedir}/.tox/distshare [tox:hudson] distshare={toxworkdir}/distshare -sdistfile={distshare}/py-1.3.2a1.zip +sdistsrc={distshare}/py-**LATEST** [testenv] changedir=testing commands= - py.test --confcutdir=.. -rfsxX --junitxml=junit-{envname}.xml --tools-on-path [] + py.test --confcutdir=.. -rfsxX \ + --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] deps= pexpect [testenv:py27] @@ -20,7 +21,8 @@ basepython=python deps=docutils pygments changedir=doc -commands= py.test -rsfxX --confcutdir=.. --junitxml=junit-{envname}s.xml --forcegen +commands= py.test -rsfxX --confcutdir=.. \ + --junitxml={envlogdir}/junit-{envname}s.xml --forcegen [testenv:py25] basepython=python2.5 [testenv:py24] @@ -35,6 +37,6 @@ changedir=testing basepython=jython commands= {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - -rfsxX --junitxml=junit-{envname}1.xml [io_ code] + -rfsxX --junitxml={envlogdir}/junit-{envname}1.xml [io_ code] {envpython} {envbindir}/py.test-jython --confcutdir=.. \ - -rfsxX --junitxml=junit-{envname}2.xml acceptance_test.py plugin + -rfsxX --junitxml={envlogdir}/junit-{envname}2.xml acceptance_test.py plugin From commits-noreply at bitbucket.org Tue Jul 6 12:50:48 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:50:48 +0000 (UTC) Subject: [py-svn] pytest-xdist commit eaf8b1cb7c31: merge Message-ID: <20100706105048.4E7197EF83@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1274815403 -7200 # Node ID eaf8b1cb7c312883598677231be5bbeea3b5c127 # Parent ceff3e9230f5c5b63bf2ec4f611578fee0d762f9 # Parent 45a2e97933a8468a2874b25de9ffd7f9fdac5f06 merge From commits-noreply at bitbucket.org Tue Jul 6 12:50:48 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:50:48 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 944320d3c60c: Added tag 1.3 for changeset eaf8b1cb7c31 Message-ID: <20100706105048.5FFAF7EF85@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1274815409 -7200 # Node ID 944320d3c60c937cbff73e28b9dae004e423791f # Parent eaf8b1cb7c312883598677231be5bbeea3b5c127 Added tag 1.3 for changeset eaf8b1cb7c31 --- a/.hgtags +++ b/.hgtags @@ -2,3 +2,5 @@ 42c6503ee48fae9c4c96d406afb12bfc86f15803 eca7ce17eabf296983c36812c8b8be901e7055a3 1.1 56d8e5280be224a0ad3220a9deed55334710bd23 1.2 e6c4ce20db4bf65086ff55807a3c306cad7ca393 1.3 +e6c4ce20db4bf65086ff55807a3c306cad7ca393 1.3 +eaf8b1cb7c312883598677231be5bbeea3b5c127 1.3 From commits-noreply at bitbucket.org Tue Jul 6 12:50:48 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:50:48 +0000 (UTC) Subject: [py-svn] pytest-xdist commit ceff3e9230f5: merge Message-ID: <20100706105048.3BDAF7EF7C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1274814042 -7200 # Node ID ceff3e9230f5c5b63bf2ec4f611578fee0d762f9 # Parent 0db3129ba761fbba45f0e80513d4e15a2edcecc7 # Parent 1392e029c5674cec9a5eede65c0d5c53f124b79e merge --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( packages = ['xdist'], entry_points = {'pytest11': ['xdist = xdist.plugin'],}, zip_safe=False, - install_requires = ['execnet>=1.0.6', 'py>=1.3.0'], + install_requires = ['execnet>=1.0.6', 'py>=1.3.1'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', From commits-noreply at bitbucket.org Tue Jul 6 12:50:48 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:50:48 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 0db3129ba761: xdist is now somewhat stable after all the fixes, i'd say. Message-ID: <20100706105048.27BE77EF77@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1273087299 -7200 # Node ID 0db3129ba761fbba45f0e80513d4e15a2edcecc7 # Parent 56d8e5280be224a0ad3220a9deed55334710bd23 xdist is now somewhat stable after all the fixes, i'd say. --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ setup( zip_safe=False, install_requires = ['execnet>=1.0.6', 'py>=1.3.0'], classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Operating System :: POSIX', From commits-noreply at bitbucket.org Tue Jul 6 12:50:48 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:50:48 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 9e8437ccc8c5: merge Message-ID: <20100706105048.6FF7E7EF86@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1277640001 -7200 # Node ID 9e8437ccc8c5c95a93e85c0a3d55ea1dbebf0119 # Parent 944320d3c60c937cbff73e28b9dae004e423791f # Parent 14d2f8b74c944dde004c3d18f03287659adcb667 merge From commits-noreply at bitbucket.org Tue Jul 6 12:50:48 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:50:48 +0000 (UTC) Subject: [py-svn] pytest-xdist commit e8f6b537c7b6: adding a tox.ini file Message-ID: <20100706105048.87D7B7EF87@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278413406 -7200 # Node ID e8f6b537c7b6a05350c88361529428d3beb04e56 # Parent 9e8437ccc8c5c95a93e85c0a3d55ea1dbebf0119 adding a tox.ini file --- a/.hgignore +++ b/.hgignore @@ -19,3 +19,4 @@ dist/ pytest_xdist.egg-info issue/ 3rdparty/ +.tox --- /dev/null +++ b/tox.ini @@ -0,0 +1,30 @@ +[tox] +distshare={homedir}/.tox/distshare +[tox:hudson] +sdistsrc={distshare}/pytest-xdist-**LATEST** + +[testenv] +changedir=testing +deps= + {distshare}/py-**LATEST** + {distshare}/execnet-**LATEST** +commands=py.test -rsfxX --junitxml={envlogdir}/junit-{envname}.xml [] +[testenv:py27] +basepython=python2.7 +[testenv:py26] +basepython=python2.6 +[testenv:py26-py131] +basepython=python2.6 +deps= py==1.3.1 + execnet==1.0.6 +[testenv:py25] +basepython=python2.5 +[testenv:py24] +basepython=python2.4 +[testenv:py31] +basepython=python3.1 +#[testenv:pypy] +#basepython=pypy-c +#[testenv:jython] +#basepython=jython + From commits-noreply at bitbucket.org Tue Jul 6 12:52:02 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:52:02 +0000 (UTC) Subject: [py-svn] pytest-xdist commit ae755034a4bf: bumping version Message-ID: <20100706105202.AC9347EF69@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278413469 -7200 # Node ID ae755034a4bf68043c31c9da6615e8d9a684bf4d # Parent e8f6b537c7b6a05350c88361529428d3beb04e56 bumping version --- a/xdist/__init__.py +++ b/xdist/__init__.py @@ -1,3 +1,3 @@ # -__version__ = "1.3" +__version__ = "1.4a1" From commits-noreply at bitbucket.org Tue Jul 6 12:56:46 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 10:56:46 +0000 (UTC) Subject: [py-svn] pytest-xdist commit cdb0738afdf1: using proper distshare dir for hudson Message-ID: <20100706105646.7B1537EF7C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278413775 -7200 # Node ID cdb0738afdf17f7dec17b3907cafe28896317bac # Parent ae755034a4bf68043c31c9da6615e8d9a684bf4d using proper distshare dir for hudson --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ [tox] distshare={homedir}/.tox/distshare [tox:hudson] +distshare={toxworkdir}/distshare sdistsrc={distshare}/pytest-xdist-**LATEST** [testenv] From commits-noreply at bitbucket.org Tue Jul 6 13:31:22 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 11:31:22 +0000 (UTC) Subject: [py-svn] py-trunk commit 0ff3f750a3f0: fix test for python2.7 Message-ID: <20100706113122.47F227EE7F@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278415772 -7200 # Node ID 0ff3f750a3f0d0d212ac5f7f2c87e68033429a8a # Parent 890a9cc881a14fb167955a51a068114787fec1ce fix test for python2.7 --- a/testing/test_deprecated_api.py +++ b/testing/test_deprecated_api.py @@ -292,7 +292,7 @@ def test_conftest_non_python_items(recwa assert item.name == "hello.xxx" assert item.__class__.__name__ == "CustomItem" -def test_extra_python_files_and_functions(testdir): +def test_extra_python_files_and_functions(testdir, recwarn): testdir.makepyfile(conftest=""" import py class MyFunction(py.test.collect.Function): From commits-noreply at bitbucket.org Tue Jul 6 13:51:35 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 11:51:35 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 735211f749ce: refining tests for jython and python2.7 Message-ID: <20100706115135.6A5987EE6C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278417003 -7200 # Node ID 735211f749ce1098f66e2ab2fdd58db8e0fa68c1 # Parent cdb0738afdf17f7dec17b3907cafe28896317bac refining tests for jython and python2.7 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -47,6 +47,7 @@ class TestDistribution: ]) assert result.ret == 1 + @py.test.mark.xfail("sys.platform.startswith('java')") def test_dist_tests_with_crash(self, testdir): if not hasattr(py.std.os, 'kill'): py.test.skip("no os.kill") --- a/tox.ini +++ b/tox.ini @@ -26,6 +26,5 @@ basepython=python2.4 basepython=python3.1 #[testenv:pypy] #basepython=pypy-c -#[testenv:jython] -#basepython=jython - +[testenv:jython] +basepython=jython --- a/testing/test_deprecated.py +++ b/testing/test_deprecated.py @@ -1,6 +1,6 @@ import py -def test_dist_conftest_options(testdir): +def test_dist_conftest_options(testdir, recwarn): p1 = testdir.tmpdir.ensure("dir", 'p1.py') p1.dirpath("__init__.py").write("") p1.dirpath("conftest.py").write(py.code.Source(""" From commits-noreply at bitbucket.org Tue Jul 6 15:02:15 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 6 Jul 2010 13:02:15 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 79185d6f713e: don't test deprecation warnings on python2.7 Message-ID: <20100706130215.AB6927EF7C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278421300 -7200 # Node ID 79185d6f713e003b9aa48c856374562a37cb24d8 # Parent 735211f749ce1098f66e2ab2fdd58db8e0fa68c1 don't test deprecation warnings on python2.7 --- a/testing/test_deprecated.py +++ b/testing/test_deprecated.py @@ -1,5 +1,6 @@ import py + at py.test.mark.xfail("sys.version_info[:2] == (2,7)") def test_dist_conftest_options(testdir, recwarn): p1 = testdir.tmpdir.ensure("dir", 'p1.py') p1.dirpath("__init__.py").write("") From commits-noreply at bitbucket.org Wed Jul 7 12:44:01 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 10:44:01 +0000 (UTC) Subject: [py-svn] py-trunk commit fb40b9ae76d6: split out pytest-xdist related reporting to the plugin Message-ID: <20100707104401.AC3477EF81@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278499275 -7200 # Node ID fb40b9ae76d65452a087b3f06ea0248f49ca3ca1 # Parent 0ff3f750a3f0d0d212ac5f7f2c87e68033429a8a split out pytest-xdist related reporting to the plugin --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] distshare={homedir}/.tox/distshare +envlist=py26,py27,py31,py27-xdist,py25,py24 [tox:hudson] distshare={toxworkdir}/distshare @@ -14,6 +15,15 @@ deps= pexpect [testenv:py27] basepython=python2.7 +[testenv:py27-xdist] +basepython=python2.7 +deps= + {distshare}/py-**LATEST** + {distshare}/pytest-xdist-**LATEST** +commands= + py.test -n3 --confcutdir=.. -rfsxX \ + --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] + [testenv:py26] basepython=python2.6 [testenv:doc] --- a/py/_plugin/pytest_runner.py +++ b/py/_plugin/pytest_runner.py @@ -115,12 +115,25 @@ class CallInfo: return "" % (self.when, status) class BaseReport(object): + def __init__(self): + self.headerlines = [] def __repr__(self): l = ["%s=%s" %(key, value) for key, value in self.__dict__.items()] return "<%s %s>" %(self.__class__.__name__, " ".join(l),) + def _getcrashline(self): + try: + return self.longrepr.reprcrash + except AttributeError: + try: + return str(self.longrepr)[:50] + except AttributeError: + return "" + def toterminal(self, out): + for line in self.headerlines: + out.line(line) longrepr = self.longrepr if hasattr(longrepr, 'toterminal'): longrepr.toterminal(out) @@ -129,6 +142,7 @@ class BaseReport(object): class CollectErrorRepr(BaseReport): def __init__(self, msg): + super(CollectErrorRepr, self).__init__() self.longrepr = msg def toterminal(self, out): out.line(str(self.longrepr), red=True) @@ -137,6 +151,7 @@ class ItemTestReport(BaseReport): failed = passed = skipped = False def __init__(self, item, excinfo=None, when=None): + super(ItemTestReport, self).__init__() self.item = item self.when = when if item and when != "setup": @@ -189,6 +204,7 @@ class CollectReport(BaseReport): skipped = failed = passed = False def __init__(self, collector, result, excinfo=None): + super(CollectReport, self).__init__() self.collector = collector if not excinfo: self.passed = True @@ -213,6 +229,7 @@ class TeardownErrorReport(BaseReport): failed = True when = "teardown" def __init__(self, excinfo): + super(TeardownErrorReport, self).__init__() self.longrepr = excinfo.getrepr(funcargs=True) class SetupState(object): --- a/testing/test_collect.py +++ b/testing/test_collect.py @@ -181,6 +181,24 @@ class TestPrunetraceback: "*hello world*", ]) + def test_collect_report_postprocessing(self, testdir): + p = testdir.makepyfile(""" + import not_exists + """) + testdir.makeconftest(""" + import py + def pytest_make_collect_report(__multicall__): + rep = __multicall__.execute() + rep.headerlines += ["header1"] + return rep + """) + result = testdir.runpytest(p) + result.stdout.fnmatch_lines([ + "*ERROR collecting*", + "*header1*", + ]) + + class TestCustomConftests: def test_ignore_collect_path(self, testdir): testdir.makeconftest(""" --- a/py/_plugin/pytest_terminal.py +++ b/py/_plugin/pytest_terminal.py @@ -6,8 +6,6 @@ This is a good source for looking at the import py import sys -optionalhook = py.test.mark.optionalhook - def pytest_addoption(parser): group = parser.getgroup("terminal reporting", "reporting", after="general") group._addoption('-v', '--verbose', action="count", @@ -80,7 +78,6 @@ class TerminalReporter: file = py.std.sys.stdout self._tw = py.io.TerminalWriter(file) self.currentfspath = None - self.gateway2info = {} self.reportchars = getreportopt(config) def hasopt(self, char): @@ -167,53 +164,6 @@ class TerminalReporter: # which garbles our output if we use self.write_line self.write_line(msg) - @optionalhook - def pytest_gwmanage_newgateway(self, gateway, platinfo): - #self.write_line("%s instantiated gateway from spec %r" %(gateway.id, gateway.spec._spec)) - d = {} - d['version'] = repr_pythonversion(platinfo.version_info) - d['id'] = gateway.id - d['spec'] = gateway.spec._spec - d['platform'] = platinfo.platform - if self.config.option.verbose: - d['extra'] = "- " + platinfo.executable - else: - d['extra'] = "" - d['cwd'] = platinfo.cwd - infoline = ("[%(id)s] %(spec)s -- platform %(platform)s, " - "Python %(version)s " - "cwd: %(cwd)s" - "%(extra)s" % d) - self.write_line(infoline) - self.gateway2info[gateway] = infoline - - @optionalhook - def pytest_testnodeready(self, node): - self.write_line("[%s] txnode ready to receive tests" %(node.gateway.id,)) - - @optionalhook - def pytest_testnodedown(self, node, error): - if error: - self.write_line("[%s] node down, error: %s" %(node.gateway.id, error)) - - @optionalhook - def pytest_rescheduleitems(self, items): - if self.config.option.debug: - self.write_sep("!", "RESCHEDULING %s " %(items,)) - - @optionalhook - def pytest_looponfailinfo(self, failreports, rootdirs): - if failreports: - self.write_sep("#", "LOOPONFAILING", red=True) - for report in failreports: - loc = self._getcrashline(report) - if loc: - self.write_line(loc, red=True) - self.write_sep("#", "waiting for changes") - for rootdir in rootdirs: - self.write_line("### Watching: %s" %(rootdir,), bold=True) - - def pytest_trace(self, category, msg): if self.config.option.debug or \ self.config.option.traceconfig and category.find("config") != -1: @@ -223,24 +173,13 @@ class TerminalReporter: self.stats.setdefault('deselected', []).append(items) def pytest_itemstart(self, item, node=None): - if getattr(self.config.option, 'dist', 'no') != "no": - # for dist-testing situations itemstart means we - # queued the item for sending, not interesting (unless debugging) - if self.config.option.debug: - line = self._reportinfoline(item) - extra = "" - if node: - extra = "-> [%s]" % node.gateway.id - self.write_ensure_prefix(line, extra) + if self.config.option.verbose: + line = self._reportinfoline(item) + self.write_ensure_prefix(line, "") else: - if self.config.option.verbose: - line = self._reportinfoline(item) - self.write_ensure_prefix(line, "") - else: - # ensure that the path is printed before the - # 1st test of a module starts running - - self.write_fspath_result(self._getfspath(item), "") + # ensure that the path is printed before the + # 1st test of a module starts running + self.write_fspath_result(self._getfspath(item), "") def pytest__teardown_final_logerror(self, report): self.stats.setdefault("error", []).append(report) @@ -321,15 +260,6 @@ class TerminalReporter: else: excrepr.reprcrash.toterminal(self._tw) - def _getcrashline(self, report): - try: - return report.longrepr.reprcrash - except AttributeError: - try: - return str(report.longrepr)[:50] - except AttributeError: - return "" - def _reportinfoline(self, item): collect_fspath = self._getfspath(item) fspath, lineno, msg = self._getreportinfo(item) @@ -387,12 +317,11 @@ class TerminalReporter: self.write_sep("=", "FAILURES") for rep in self.stats['failed']: if tbstyle == "line": - line = self._getcrashline(rep) + line = rep._getcrashline() self.write_line(line) else: msg = self._getfailureheadline(rep) self.write_sep("_", msg) - self.write_platinfo(rep) rep.toterminal(self._tw) def summary_errors(self): @@ -408,16 +337,8 @@ class TerminalReporter: elif rep.when == "teardown": msg = "ERROR at teardown of " + msg self.write_sep("_", msg) - self.write_platinfo(rep) rep.toterminal(self._tw) - def write_platinfo(self, rep): - if hasattr(rep, 'node'): - self.write_line(self.gateway2info.get( - rep.node.gateway, - "node %r (platinfo not found? strange)") - [:self._tw.fullwidth-1]) - def summary_stats(self): session_duration = py.std.time.time() - self._sessionstarttime --- a/testing/plugin/test_pytest_terminal.py +++ b/testing/plugin/test_pytest_terminal.py @@ -18,36 +18,28 @@ def basic_run_report(item): return runner.call_and_report(item, "call", log=False) class Option: - def __init__(self, verbose=False, dist=None, fulltrace=False): + def __init__(self, verbose=False, fulltrace=False): self.verbose = verbose - self.dist = dist self.fulltrace = fulltrace - def _getcmdargs(self): + + @property + def args(self): l = [] if self.verbose: l.append('-v') - if self.dist: - l.append('--dist=%s' % self.dist) - l.append('--tx=popen') if self.fulltrace: l.append('--fulltrace') return l - def _getcmdstring(self): - return " ".join(self._getcmdargs()) def pytest_generate_tests(metafunc): if "option" in metafunc.funcargnames: - metafunc.addcall(id="default", param=Option(verbose=False)) - metafunc.addcall(id="verbose", param=Option(verbose=True)) - metafunc.addcall(id="fulltrace", param=Option(fulltrace=True)) - if not getattr(metafunc.function, 'nodist', False): - metafunc.addcall(id="verbose-dist", - param=Option(dist='each', verbose=True)) + metafunc.addcall(id="default", + funcargs={'option': Option(verbose=False)}) + metafunc.addcall(id="verbose", + funcargs={'option': Option(verbose=True)}) + metafunc.addcall(id="fulltrace", + funcargs={'option': Option(fulltrace=True)}) -def pytest_funcarg__option(request): - if request.param.dist: - request.config.pluginmanager.skipifmissing("xdist") - return request.param class TestTerminal: def test_pass_skip_fail(self, testdir, option): @@ -60,22 +52,13 @@ class TestTerminal: def test_func(): assert 0 """) - result = testdir.runpytest(*option._getcmdargs()) + result = testdir.runpytest(*option.args) if option.verbose: - if not option.dist: - result.stdout.fnmatch_lines([ - "*test_pass_skip_fail.py:2: *test_ok*PASS*", - "*test_pass_skip_fail.py:4: *test_skip*SKIP*", - "*test_pass_skip_fail.py:6: *test_func*FAIL*", - ]) - else: - expected = [ - "*PASS*test_pass_skip_fail.py:2: *test_ok*", - "*SKIP*test_pass_skip_fail.py:4: *test_skip*", - "*FAIL*test_pass_skip_fail.py:6: *test_func*", - ] - for line in expected: - result.stdout.fnmatch_lines([line]) + result.stdout.fnmatch_lines([ + "*test_pass_skip_fail.py:2: *test_ok*PASS*", + "*test_pass_skip_fail.py:4: *test_skip*SKIP*", + "*test_pass_skip_fail.py:6: *test_func*FAIL*", + ]) else: result.stdout.fnmatch_lines([ "*test_pass_skip_fail.py .sF" @@ -86,16 +69,6 @@ class TestTerminal: "E assert 0", ]) - def test_collect_fail(self, testdir, option): - p = testdir.makepyfile("import xyz\n") - result = testdir.runpytest(*option._getcmdargs()) - result.stdout.fnmatch_lines([ - "*test_collect_fail.py E*", - "> import xyz", - "E ImportError: No module named xyz", - "*1 error*", - ]) - def test_internalerror(self, testdir, linecomp): modcol = testdir.getmodulecol("def test_one(): pass") rep = TerminalReporter(modcol.config, file=linecomp.stringio) @@ -132,75 +105,6 @@ class TestTerminal: id = tr.gettestid(method) assert id.endswith("test_testid.py::TestClass::test_method") - def test_looponfailreport(self, testdir, linecomp): - modcol = testdir.getmodulecol(""" - import py - def test_fail(): - assert 0 - def test_fail2(): - raise ValueError() - @py.test.mark.xfail - def test_xfail(): - assert 0 - @py.test.mark.xfail - def test_xpass(): - assert 1 - """) - rep = TerminalReporter(modcol.config, file=linecomp.stringio) - reports = [basic_run_report(x) for x in modcol.collect()] - rep.pytest_looponfailinfo(reports, [modcol.config.topdir]) - linecomp.assert_contains_lines([ - "*test_looponfailreport.py:3: assert 0", - "*test_looponfailreport.py:5: ValueError*", - "*waiting*", - "*%s*" % (modcol.config.topdir), - ]) - - def test_tb_option(self, testdir, option): - p = testdir.makepyfile(""" - import py - def g(): - raise IndexError - def test_func(): - print (6*7) - g() # --calling-- - """) - for tbopt in ["long", "short", "no"]: - print('testing --tb=%s...' % tbopt) - result = testdir.runpytest('--tb=%s' % tbopt) - s = result.stdout.str() - if tbopt == "long": - assert 'print (6*7)' in s - else: - assert 'print (6*7)' not in s - if tbopt != "no": - assert '--calling--' in s - assert 'IndexError' in s - else: - assert 'FAILURES' not in s - assert '--calling--' not in s - assert 'IndexError' not in s - - def test_tb_crashline(self, testdir, option): - p = testdir.makepyfile(""" - import py - def g(): - raise IndexError - def test_func1(): - print (6*7) - g() # --calling-- - def test_func2(): - assert 0, "hello" - """) - result = testdir.runpytest("--tb=line") - bn = p.basename - result.stdout.fnmatch_lines([ - "*%s:3: IndexError*" % bn, - "*%s:8: AssertionError: hello*" % bn, - ]) - s = result.stdout.str() - assert "def test_func2" not in s - def test_show_path_before_running_test(self, testdir, linecomp): item = testdir.getitem("def test_func(): pass") tr = TerminalReporter(item.config, file=linecomp.stringio) @@ -263,22 +167,6 @@ class TestTerminal: "*test_p2.py <- *test_p1.py:2: TestMore.test_p1*", ]) - def test_keyboard_interrupt_dist(self, testdir, option): - # xxx could be refined to check for return code - p = testdir.makepyfile(""" - def test_sleep(): - import time - time.sleep(10) - """) - child = testdir.spawn_pytest(" ".join(option._getcmdargs())) - child.expect(".*test session starts.*") - child.kill(2) # keyboard interrupt - child.expect(".*KeyboardInterrupt.*") - #child.expect(".*seconds.*") - child.close() - #assert ret == 2 - - @py.test.mark.nodist def test_keyboard_interrupt(self, testdir, option): p = testdir.makepyfile(""" def test_foobar(): @@ -289,7 +177,7 @@ class TestTerminal: raise KeyboardInterrupt # simulating the user """) - result = testdir.runpytest(*option._getcmdargs()) + result = testdir.runpytest(*option.args) result.stdout.fnmatch_lines([ " def test_foobar():", "> assert 0", @@ -302,37 +190,6 @@ class TestTerminal: ]) result.stdout.fnmatch_lines(['*KeyboardInterrupt*']) - def test_maxfailures(self, testdir, option): - p = testdir.makepyfile(""" - def test_1(): - assert 0 - def test_2(): - assert 0 - def test_3(): - assert 0 - """) - result = testdir.runpytest("--maxfail=2", *option._getcmdargs()) - result.stdout.fnmatch_lines([ - "*def test_1():*", - "*def test_2():*", - "*!! Interrupted: stopping after 2 failures*!!*", - "*2 failed*", - ]) - - def test_pytest_report_header(self, testdir): - testdir.makeconftest(""" - def pytest_report_header(config): - return "hello: info" - """) - testdir.mkdir("a").join("conftest.py").write(""" -def pytest_report_header(config): - return ["line1", "line2"]""") - result = testdir.runpytest("a") - result.stdout.fnmatch_lines([ - "*hello: info*", - "line1", - "line2", - ]) class TestCollectonly: @@ -691,12 +548,103 @@ def test_trace_reporting(testdir): ]) assert result.ret == 0 - at py.test.mark.nodist def test_show_funcarg(testdir, option): - args = option._getcmdargs() + ["--funcargs"] + args = option.args + ["--funcargs"] result = testdir.runpytest(*args) result.stdout.fnmatch_lines([ "*tmpdir*", "*temporary directory*", ] ) + +class TestGenericReporting: + """ this test class can be subclassed with a different option + provider to run e.g. distributed tests. + """ + def test_collect_fail(self, testdir, option): + p = testdir.makepyfile("import xyz\n") + result = testdir.runpytest(*option.args) + result.stdout.fnmatch_lines([ + "*test_collect_fail.py E*", + "> import xyz", + "E ImportError: No module named xyz", + "*1 error*", + ]) + + def test_maxfailures(self, testdir, option): + p = testdir.makepyfile(""" + def test_1(): + assert 0 + def test_2(): + assert 0 + def test_3(): + assert 0 + """) + result = testdir.runpytest("--maxfail=2", *option.args) + result.stdout.fnmatch_lines([ + "*def test_1():*", + "*def test_2():*", + "*!! Interrupted: stopping after 2 failures*!!*", + "*2 failed*", + ]) + + + def test_tb_option(self, testdir, option): + p = testdir.makepyfile(""" + import py + def g(): + raise IndexError + def test_func(): + print (6*7) + g() # --calling-- + """) + for tbopt in ["long", "short", "no"]: + print('testing --tb=%s...' % tbopt) + result = testdir.runpytest('--tb=%s' % tbopt) + s = result.stdout.str() + if tbopt == "long": + assert 'print (6*7)' in s + else: + assert 'print (6*7)' not in s + if tbopt != "no": + assert '--calling--' in s + assert 'IndexError' in s + else: + assert 'FAILURES' not in s + assert '--calling--' not in s + assert 'IndexError' not in s + + def test_tb_crashline(self, testdir, option): + p = testdir.makepyfile(""" + import py + def g(): + raise IndexError + def test_func1(): + print (6*7) + g() # --calling-- + def test_func2(): + assert 0, "hello" + """) + result = testdir.runpytest("--tb=line") + bn = p.basename + result.stdout.fnmatch_lines([ + "*%s:3: IndexError*" % bn, + "*%s:8: AssertionError: hello*" % bn, + ]) + s = result.stdout.str() + assert "def test_func2" not in s + + def test_pytest_report_header(self, testdir, option): + testdir.makeconftest(""" + def pytest_report_header(config): + return "hello: info" + """) + testdir.mkdir("a").join("conftest.py").write(""" +def pytest_report_header(config): + return ["line1", "line2"]""") + result = testdir.runpytest("a") + result.stdout.fnmatch_lines([ + "*hello: info*", + "line1", + "line2", + ]) --- a/CHANGELOG +++ b/CHANGELOG @@ -66,6 +66,9 @@ Bug fixes / Maintenance - make initial conftest discovery ignore "--" prefixed arguments - fix resultlog plugin when used in an multicpu/multihost xdist situation (thanks Jakub Gustak) +- perform distributed testing related reporting in the xdist-plugin + rather than having dist-related code in the generic py.test + distribution Changes between 1.3.0 and 1.3.1 ================================================== --- a/testing/plugin/test_pytest_runner.py +++ b/testing/plugin/test_pytest_runner.py @@ -69,6 +69,21 @@ class BaseFunctionalTests: assert isinstance(rep.longrepr, ReprExceptionInfo) assert str(rep.shortrepr) == "F" + def test_failfunction_customized_report(self, testdir, LineMatcher): + reports = testdir.runitem(""" + def test_func(): + assert 0 + """) + rep = reports[1] + rep.headerlines += ["hello world"] + tr = py.io.TerminalWriter(stringio=True) + rep.toterminal(tr) + val = tr.stringio.getvalue() + LineMatcher(val.split("\n")).fnmatch_lines([ + "*hello world", + "*def test_func():*" + ]) + def test_skipfunction(self, testdir): reports = testdir.runitem(""" import py @@ -435,3 +450,4 @@ def test_pytest_cmdline_main(testdir): s = popen.stdout.read() ret = popen.wait() assert ret == 0 + From commits-noreply at bitbucket.org Wed Jul 7 12:44:12 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 10:44:12 +0000 (UTC) Subject: [py-svn] pytest-xdist commit e4a5c7e518c7: integrate xdist related reporting into the plugin Message-ID: <20100707104412.1C13A7EF70@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278499399 -7200 # Node ID e4a5c7e518c7c413650304c9cb1417eb86671cfe # Parent 79185d6f713e003b9aa48c856374562a37cb24d8 integrate xdist related reporting into the plugin --- a/xdist/newhooks.py +++ b/xdist/newhooks.py @@ -20,6 +20,4 @@ def pytest_testnodedown(node, error): def pytest_rescheduleitems(items): """ reschedule Items from a node that went down. """ -def pytest_looponfailinfo(failreports, rootdirs): - """ info for repeating failing tests. """ --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1,4 +1,5 @@ import py +import sys class TestDistribution: def test_manytests_to_one_popen(self, testdir): @@ -173,3 +174,57 @@ class TestDistribution: assert result.ret assert 'SIGINT' in s assert 's2call' in s + + def test_keyboard_interrupt_dist(self, testdir): + # xxx could be refined to check for return code + p = testdir.makepyfile(""" + def test_sleep(): + import time + time.sleep(10) + """) + child = testdir.spawn_pytest("-n1") + child.expect(".*test session starts.*") + child.kill(2) # keyboard interrupt + child.expect(".*KeyboardInterrupt.*") + #child.expect(".*seconds.*") + child.close() + #assert ret == 2 + +class TestTerminalReporting: + def test_pass_skip_fail(self, testdir): + p = testdir.makepyfile(""" + import py + def test_ok(): + pass + def test_skip(): + py.test.skip("xx") + def test_func(): + assert 0 + """) + result = testdir.runpytest("-n1", "-v") + expected = [ + "*PASS*test_pass_skip_fail.py:2: *test_ok*", + "*SKIP*test_pass_skip_fail.py:4: *test_skip*", + "*FAIL*test_pass_skip_fail.py:6: *test_func*", + ] + for line in expected: + result.stdout.fnmatch_lines([line]) + result.stdout.fnmatch_lines([ + " def test_func():", + "> assert 0", + "E assert 0", + ]) + + def test_fail_platinfo(self, testdir): + p = testdir.makepyfile(""" + def test_func(): + assert 0 + """) + result = testdir.runpytest("-n1", "-v") + result.stdout.fnmatch_lines([ + "*FAIL*test_fail_platinfo.py:1: *test_func*", + "*popen*Python*", + " def test_func():", + "> assert 0", + "E assert 0", + ]) --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +1.4a1 +------------------------- + +- perform distributed testing related reporting in the plugin + rather than having dist-related code in the generic py.test + distribution + 1.3 ------------------------- --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -197,11 +197,23 @@ def pytest_configure(config): raise config.Error("--pdb incompatible with --looponfail.") from xdist.remote import LooponfailingSession config.setsessionclass(LooponfailingSession) + config._isdistsession = True elif val("dist") != "no": if usepdb: raise config.Error("--pdb incompatible with distributing tests.") from xdist.dsession import DSession config.setsessionclass(DSession) + config._isdistsession = True + + +def pytest_sessionstart(session): + config = session.config + if hasattr(config, '_isdistsession'): + if not config.pluginmanager.hasplugin("terminal") or \ + not config.pluginmanager.hasplugin("terminalreporter"): + return + trdist = TerminalDistReporter(config) + config.pluginmanager.register(trdist, "terminaldistreporter") def pytest_runtest_protocol(item): if item.config.getvalue("boxed"): @@ -244,3 +256,56 @@ def report_process_crash(item, result): from py._plugin.pytest_runner import ItemTestReport return ItemTestReport(item, excinfo=info, when="???") +class TerminalDistReporter: + def __init__(self, config): + self.gateway2info = {} + self.config = config + self.tplugin = config.pluginmanager.getplugin("terminal") + self.tr = config.pluginmanager.getplugin("terminalreporter") + + def write_line(self, msg): + self.tr.write_line(msg) + + def pytest_itemstart(self, __multicall__): + try: + __multicall__.methods.remove(self.tr.pytest_itemstart) + except KeyError: + pass + + def pytest_runtest_logreport(self, report): + if hasattr(report, 'node'): + report.headerlines.append(self.gateway2info.get( + report.node.gateway, + "node %r (platinfo not found? strange)")) + + def pytest_gwmanage_newgateway(self, gateway, platinfo): + #self.write_line("%s instantiated gateway from spec %r" %(gateway.id, gateway.spec._spec)) + d = {} + d['version'] = self.tplugin.repr_pythonversion(platinfo.version_info) + d['id'] = gateway.id + d['spec'] = gateway.spec._spec + d['platform'] = platinfo.platform + if self.config.option.verbose: + d['extra'] = "- " + platinfo.executable + else: + d['extra'] = "" + d['cwd'] = platinfo.cwd + infoline = ("[%(id)s] %(spec)s -- platform %(platform)s, " + "Python %(version)s " + "cwd: %(cwd)s" + "%(extra)s" % d) + self.write_line(infoline) + self.gateway2info[gateway] = infoline + + def pytest_testnodeready(self, node): + self.write_line("[%s] txnode ready to receive tests" %(node.gateway.id,)) + + def pytest_testnodedown(self, node, error): + if not error: + return + self.write_line("[%s] node down, error: %s" %(node.gateway.id, error)) + + def pytest_rescheduleitems(self, items): + if self.config.option.debug: + self.write_sep("!", "RESCHEDULING %s " %(items,)) + --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -132,7 +132,7 @@ class TestLooponFailing: x = 0 assert x == 1 """) - child = testdir.spawn_pytest("-f %s" % p) + child = testdir.spawn_pytest("-f %s --traceconfig" % p) child.expect("def test_one") child.expect("x == 1") child.expect("1 failed") --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,6 @@ [tox] distshare={homedir}/.tox/distshare +envlist=py26,py31,py27,py25,py24 [tox:hudson] distshare={toxworkdir}/distshare sdistsrc={distshare}/pytest-xdist-**LATEST** @@ -9,15 +10,21 @@ changedir=testing deps= {distshare}/py-**LATEST** {distshare}/execnet-**LATEST** -commands=py.test -rsfxX --junitxml={envlogdir}/junit-{envname}.xml [] +commands= + py.test -rsfxX --tools-on-path \ + --junitxml={envlogdir}/junit-{envname}.xml [] [testenv:py27] basepython=python2.7 [testenv:py26] basepython=python2.6 -[testenv:py26-py131] -basepython=python2.6 -deps= py==1.3.1 - execnet==1.0.6 +deps= + {distshare}/py-**LATEST** + {distshare}/execnet-**LATEST** + pexpect +#[testenv:py26-py132] +#basepython=python2.6 +#deps= py==1.3.2 +# execnet==1.0.6 [testenv:py25] basepython=python2.5 [testenv:py24] --- a/testing/conftest.py +++ b/testing/conftest.py @@ -2,7 +2,6 @@ import py import execnet pytest_plugins = "pytester" -option_report = 'skipped' #rsyncdirs = ['.', '../xdist', py.path.local(execnet.__file__).dirpath()] --- a/xdist/remote.py +++ b/xdist/remote.py @@ -169,8 +169,21 @@ def slave_runsession(channel, config, fu DEBUG("SLAVE: starting session.main()") session.main(colitems) - session.config.hook.pytest_looponfailinfo( + repr_pytest_looponfailinfo( failreports=list(failreports), rootdirs=[config.topdir]) rootcol = session.config._rootcol channel.send([rootcol.totrail(rep.getnode()) for rep in failreports]) + + +def repr_pytest_looponfailinfo(failreports, rootdirs): + tr = py.io.TerminalWriter() + if failreports: + tr.sep("#", "LOOPONFAILING", red=True) + for report in failreports: + loc = report._getcrashline() + if loc: + tr.line(loc, red=True) + tr.sep("#", "waiting for changes") + for rootdir in rootdirs: + tr.line("### Watching: %s" %(rootdir,), bold=True) --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( packages = ['xdist'], entry_points = {'pytest11': ['xdist = xdist.plugin'],}, zip_safe=False, - install_requires = ['execnet>=1.0.6', 'py>=1.3.1'], + install_requires = ['execnet>=1.0.6', 'py>1.3.1'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', From commits-noreply at bitbucket.org Wed Jul 7 13:08:53 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 11:08:53 +0000 (UTC) Subject: [py-svn] py-trunk commit e65a5081700c: small fix Message-ID: <20100707110853.E2ACB7EF01@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278500854 -7200 # Node ID e65a5081700c14c3bc6beed6cb78c37f867bcfde # Parent fb40b9ae76d65452a087b3f06ea0248f49ca3ca1 small fix --- a/py/_plugin/pytest_runner.py +++ b/py/_plugin/pytest_runner.py @@ -124,7 +124,7 @@ class BaseReport(object): def _getcrashline(self): try: - return self.longrepr.reprcrash + return str(self.longrepr.reprcrash) except AttributeError: try: return str(self.longrepr)[:50] From commits-noreply at bitbucket.org Wed Jul 7 14:34:00 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 12:34:00 +0000 (UTC) Subject: [py-svn] pytest-xdist commit a15fe72bb3b1: add a test created from jgustak (but add the related env feature to execnet where it Message-ID: <20100707123400.ED1817EF81@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278506004 -7200 # Node ID a15fe72bb3b1e21ff1cb5984dc15abbbea5115d2 # Parent e4a5c7e518c7c413650304c9cb1417eb86671cfe add a test created from jgustak (but add the related env feature to execnet where it is separately tested) --- a/tox.ini +++ b/tox.ini @@ -9,17 +9,18 @@ sdistsrc={distshare}/pytest-xdist-**LATE changedir=testing deps= {distshare}/py-**LATEST** - {distshare}/execnet-**LATEST** commands= py.test -rsfxX --tools-on-path \ --junitxml={envlogdir}/junit-{envname}.xml [] [testenv:py27] basepython=python2.7 +deps= + {distshare}/py-**LATEST** + {distshare}/execnet-**LATEST** [testenv:py26] basepython=python2.6 deps= {distshare}/py-**LATEST** - {distshare}/execnet-**LATEST** pexpect #[testenv:py26-py132] #basepython=python2.6 --- a/testing/test_txnode.py +++ b/testing/test_txnode.py @@ -42,13 +42,13 @@ class MySetup: eq = EventQueue(self.config.pluginmanager, self.queue) return eq.geteventargs(eventname, timeout=timeout) - def makenode(self, config=None): + def makenode(self, config=None, xspec="popen"): if config is None: testdir = self.request.getfuncargvalue("testdir") config = testdir.reparseconfig([]) self.config = config self.queue = Queue() - self.xspec = execnet.XSpec("popen") + self.xspec = execnet.XSpec(xspec) self.gateway = execnet.makegateway(self.xspec) self.id += 1 self.gateway.id = str(self.id) @@ -147,3 +147,26 @@ class TestMasterSlaveConnection: for outcome in "passed failed skipped".split(): rep = mysetup.geteventargs("pytest_runtest_logreport")['report'] assert getattr(rep, outcome) + + def test_send_one_with_env(self, testdir, mysetup, monkeypatch): + if execnet.XSpec("popen").env is None: + py.test.skip("requires execnet 1.0.7 or above") + monkeypatch.delenv('ENV1', raising=False) + monkeypatch.delenv('ENV2', raising=False) + monkeypatch.setenv('ENV3', 'var3') + + item = testdir.getitem(""" + def test_func(): + import os + # ENV1, ENV2 set by xspec; ENV3 inherited from parent process + assert os.getenv('ENV2') == 'var2' + assert os.getenv('ENV1') == 'var1' + assert os.getenv('ENV3') == 'var3' + """) + node = mysetup.makenode(item.config, + xspec="popen//env:ENV1=var1//env:ENV2=var2") + node.send(item) + kwargs = mysetup.geteventargs("pytest_runtest_logreport") + rep = kwargs['report'] + assert rep.passed + From commits-noreply at bitbucket.org Wed Jul 7 14:50:12 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 12:50:12 +0000 (UTC) Subject: [py-svn] py-trunk commit 4a3bb3440d17: reintroduce --junit - i think it is actually useful Message-ID: <20100707125012.344187EF99@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278506611 -7200 # Node ID 4a3bb3440d179e31e64b269cce9e45ed8ac0ccb7 # Parent e65a5081700c14c3bc6beed6cb78c37f867bcfde reintroduce --junit - i think it is actually useful --- a/testing/plugin/test_pytest_junitxml.py +++ b/testing/plugin/test_pytest_junitxml.py @@ -119,7 +119,7 @@ class TestPython: classname="test_failure_escape.test_failure_escape", name="test_func[&]") - def YAGNI_test_junit_prefixing(self, testdir): + def test_junit_prefixing(self, testdir): testdir.makepyfile(""" def test_func(): assert 0 --- a/py/_plugin/pytest_junitxml.py +++ b/py/_plugin/pytest_junitxml.py @@ -11,15 +11,14 @@ def pytest_addoption(parser): group.addoption('--junitxml', action="store", dest="xmlpath", metavar="path", default=None, help="create junit-xml style report file at given path.") - # probalby YAGNI, therefore commented out: - #group.addoption('--junitprefix', action="store", dest="junitprefix", - # metavar="str", default=None, - # help="prepend prefix to classnames in junit-xml output") + group.addoption('--junitprefix', action="store", dest="junitprefix", + metavar="str", default=None, + help="prepend prefix to classnames in junit-xml output") def pytest_configure(config): xmlpath = config.option.xmlpath if xmlpath: - config._xml = LogXML(xmlpath, None) # config.option.junitprefix) + config._xml = LogXML(xmlpath, config.option.junitprefix) config.pluginmanager.register(config._xml) def pytest_unconfigure(config): --- a/CHANGELOG +++ b/CHANGELOG @@ -28,11 +28,14 @@ New features def test_function(arg): ... -- customizable error reporting: allow custom error reporting for - custom (test and particularly collection) nodes by always calling - ``node.repr_failure(excinfo)`` which you may override to return a - string error representation of your choice which is going to be - reported as a (red) string. +- improved error reporting when collection errors appear. + In general, for custom (test and particularly collection) + nodes ``node.repr_failure(excinfo)`` is now called so that you can + override it to return a string error representation of your choice + which is going to be reported as a (red) string. + +- introduce '--junitprefix=STR' option to prepend a prefix + to all reports in the junitxml file. Bug fixes / Maintenance ++++++++++++++++++++++++++ From commits-noreply at bitbucket.org Wed Jul 7 14:53:16 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 12:53:16 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 73256b213681: bump to xdist 1.4 Message-ID: <20100707125316.881E17EF81@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278507160 -7200 # Node ID 73256b213681c36ab4a09583f2bdf716cb653e46 # Parent a15fe72bb3b1e21ff1cb5984dc15abbbea5115d2 bump to xdist 1.4 --- a/xdist/__init__.py +++ b/xdist/__init__.py @@ -1,3 +1,3 @@ # -__version__ = "1.4a1" +__version__ = "1.4" --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ setup( packages = ['xdist'], entry_points = {'pytest11': ['xdist = xdist.plugin'],}, zip_safe=False, - install_requires = ['execnet>=1.0.6', 'py>1.3.1'], + install_requires = ['execnet>=1.0.7', 'py>1.3.1'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', --- a/tox.ini +++ b/tox.ini @@ -9,18 +9,17 @@ sdistsrc={distshare}/pytest-xdist-**LATE changedir=testing deps= {distshare}/py-**LATEST** + {distshare}/execnet-**LATEST** commands= py.test -rsfxX --tools-on-path \ --junitxml={envlogdir}/junit-{envname}.xml [] [testenv:py27] basepython=python2.7 -deps= - {distshare}/py-**LATEST** - {distshare}/execnet-**LATEST** [testenv:py26] basepython=python2.6 deps= {distshare}/py-**LATEST** + {distshare}/execnet-**LATEST** pexpect #[testenv:py26-py132] #basepython=python2.6 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,13 @@ -1.4a1 +1.4 ------------------------- - perform distributed testing related reporting in the plugin rather than having dist-related code in the generic py.test distribution +- depend on execnet-1.0.7 which adds "env1:NAME=value" keys to + gateway specification strings. + 1.3 ------------------------- From commits-noreply at bitbucket.org Wed Jul 7 15:42:40 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 13:42:40 +0000 (UTC) Subject: [py-svn] py-trunk commit c01d15908f90: progressing towards 1.3.2, adding announcement, regen docs Message-ID: <20100707134240.6E5EB7EF81@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278510088 -7200 # Node ID c01d15908f909ce097f673db17803a180c0e01ad # Parent 4a3bb3440d179e31e64b269cce9e45ed8ac0ccb7 progressing towards 1.3.2, adding announcement, regen docs --- a/tox.ini +++ b/tox.ini @@ -28,11 +28,21 @@ commands= basepython=python2.6 [testenv:doc] basepython=python +changedir={toxinidir} deps=docutils pygments -changedir=doc -commands= py.test -rsfxX --confcutdir=.. \ - --junitxml={envlogdir}/junit-{envname}s.xml --forcegen + {distshare}/execnet-**LATEST** + {distshare}/py-**LATEST** + {distshare}/pytest-xdist-**LATEST** + pytest-figleaf + pytest-coverage + pytest-cov + pytest-capturelog + +commands= + {envpython} bin-for-dist/makepluginlist.py + py.test [doc] -rsfxX --confcutdir=. \ + --junitxml={envlogdir}/junit-{envname}s.xml --forcegen [testenv:py25] basepython=python2.5 [testenv:py24] --- a/doc/test/plugin/figleaf.txt +++ b/doc/test/plugin/figleaf.txt @@ -6,29 +6,16 @@ report test coverage using the 'figleaf' .. contents:: :local: -Install ---------------- - -To install the plugin issue:: - - easy_install pytest-figleaf # or - pip install pytest-figleaf - -and if you are using pip you can also uninstall:: - - pip uninstall pytest-figleaf - - Usage --------------- -After installation you can simply type:: +after pip or easy_install mediated installation of ``pytest-figleaf`` you can type:: py.test --figleaf [...] to enable figleaf coverage in your test run. A default ".figleaf" data file -and "html" directory will be created. You can use command line options -to control where data and html files are created. +and "html" directory will be created. You can use ``--fig-data`` +and ``fig-html`` to modify the paths. command line options -------------------- --- /dev/null +++ b/doc/announce/release-1.3.2.txt @@ -0,0 +1,721 @@ +py.test/pylib 1.3.2: API and reporting refinements, many fixes +=========================================================================== + +The pylib/py.test 1.3.2 release brings many bug fixes and a few new +features and was refined for and tested against the recently released +Python2.7 besides remaining compatibile to the usual armada of interpreters +(Python2.4 through to Python3.1.2, Jython and PyPy). Note that for using +distributed testing features you'll need to upgrade to the jointly released +pytest-xdist-1.4 because of some internal refactorings. + +See http://pytest.org for general documentation and below for +a detailed CHANGELOG. + +cheers & particular thanks to Benjamin Peterson, Ronny Pfannschmidt +and all issue and patch contributors, + +holger krekel + + +Changes between 1.3.1 and 1.3.2 +================================================== + +New features +++++++++++++++++++ + +- fix issue103: introduce py.test.raises as context manager, examples:: + + with py.test.raises(ZeroDivisionError): + x = 0 + 1 / x + + with py.test.raises(RuntimeError) as excinfo: + call_something() + + # you may do extra checks on excinfo.value|type|traceback here + + (thanks Ronny Pfannschmidt) + +- Funcarg factories can now dynamically apply a marker to a + test invocation. This is for example useful if a factory + provides parameters to a test which are expected-to-fail: + + def pytest_funcarg__arg(request): + request.applymarker(py.test.mark.xfail(reason="flaky config")) + ... + + def test_function(arg): + ... + +- improved error reporting when collection errors appear. + In general, for custom (test and particularly collection) + nodes ``node.repr_failure(excinfo)`` is now called so that you can + override it to return a string error representation of your choice + which is going to be reported as a (red) string. + +- introduce '--junitprefix=STR' option to prepend a prefix + to all reports in the junitxml file. + +Bug fixes / Maintenance +++++++++++++++++++++++++++ + +- make tests and the ``pytest_recwarn`` plugin in paricular fully compatible + to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that + you can properly check for their existence in a cross-python manner). +- improve error messages if importing a test module failed (ImportError, + import file mismatches, syntax errors) +- refine --pdb: ignore xfailed tests, unify its TB-reporting and + don't display failures again at the end. +- fix assertion interpretation with the ** operator (thanks Benjamin Peterson) +- fix issue105 assignment on the same line as a failing assertion (thanks Benjamin Peterson) +- fix issue104 proper escaping for test names in junitxml plugin (thanks anonymous) +- fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) +- fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) +- fix py.code.compile(source) to generate unique filenames +- fix assertion re-interp problems on PyPy, by defering code + compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) +- fix py.path.local.pyimport() to work with directories +- streamline py.path.local.mkdtemp implementation and usage +- don't print empty lines when showing junitxml-filename +- add optional boolean ignore_errors parameter to py.path.local.remove +- fix terminal writing on win32/python2.4 +- py.process.cmdexec() now tries harder to return properly encoded unicode objects + on all python versions +- install plain py.test/py.which scripts also for Jython, this helps to + get canonical script paths in virtualenv situations +- make path.bestrelpath(path) return ".", note that when calling + X.bestrelpath the assumption is that X is a directory. +- make initial conftest discovery ignore "--" prefixed arguments +- fix resultlog plugin when used in an multicpu/multihost xdist situation + (thanks Jakub Gustak) +- perform distributed testing related reporting in the xdist-plugin + rather than having dist-related code in the generic py.test + distribution + +Changes between 1.3.0 and 1.3.1 +================================================== + +New features +++++++++++++++++++ + +- issue91: introduce new py.test.xfail(reason) helper + to imperatively mark a test as expected to fail. Can + be used from within setup and test functions. This is + useful especially for parametrized tests when certain + configurations are expected-to-fail. In this case the + declarative approach with the @py.test.mark.xfail cannot + be used as it would mark all configurations as xfail. + +- issue102: introduce new --maxfail=NUM option to stop + test runs after NUM failures. This is a generalization + of the '-x' or '--exitfirst' option which is now equivalent + to '--maxfail=1'. Both '-x' and '--maxfail' will + now also print a line near the end indicating the Interruption. + +- issue89: allow py.test.mark decorators to be used on classes + (class decorators were introduced with python2.6) and + also allow to have multiple markers applied at class/module level + by specifying a list. + +- improve and refine letter reporting in the progress bar: + . pass + f failed test + s skipped tests (reminder: use for dependency/platform mismatch only) + x xfailed test (test that was expected to fail) + X xpassed test (test that was expected to fail but passed) + + You can use any combination of 'fsxX' with the '-r' extended + reporting option. The xfail/xpass results will show up as + skipped tests in the junitxml output - which also fixes + issue99. + +- make py.test.cmdline.main() return the exitstatus instead of raising + SystemExit and also allow it to be called multiple times. This of + course requires that your application and tests are properly teared + down and don't have global state. + +Fixes / Maintenance +++++++++++++++++++++++ + +- improved traceback presentation: + - improved and unified reporting for "--tb=short" option + - Errors during test module imports are much shorter, (using --tb=short style) + - raises shows shorter more relevant tracebacks + - --fulltrace now more systematically makes traces longer / inhibits cutting + +- improve support for raises and other dynamically compiled code by + manipulating python's linecache.cache instead of the previous + rather hacky way of creating custom code objects. This makes + it seemlessly work on Jython and PyPy where it previously didn't. + +- fix issue96: make capturing more resilient against Control-C + interruptions (involved somewhat substantial refactoring + to the underlying capturing functionality to avoid race + conditions). + +- fix chaining of conditional skipif/xfail decorators - so it works now + as expected to use multiple @py.test.mark.skipif(condition) decorators, + including specific reporting which of the conditions lead to skipping. + +- fix issue95: late-import zlib so that it's not required + for general py.test startup. + +- fix issue94: make reporting more robust against bogus source code + (and internally be more careful when presenting unexpected byte sequences) + + +Changes between 1.2.1 and 1.3.0 +================================================== + +- deprecate --report option in favour of a new shorter and easier to + remember -r option: it takes a string argument consisting of any + combination of 'xfsX' characters. They relate to the single chars + you see during the dotted progress printing and will print an extra line + per test at the end of the test run. This extra line indicates the exact + position or test ID that you directly paste to the py.test cmdline in order + to re-run a particular test. + +- allow external plugins to register new hooks via the new + pytest_addhooks(pluginmanager) hook. The new release of + the pytest-xdist plugin for distributed and looponfailing + testing requires this feature. + +- add a new pytest_ignore_collect(path, config) hook to allow projects and + plugins to define exclusion behaviour for their directory structure - + for example you may define in a conftest.py this method:: + + def pytest_ignore_collect(path): + return path.check(link=1) + + to prevent even a collection try of any tests in symlinked dirs. + +- new pytest_pycollect_makemodule(path, parent) hook for + allowing customization of the Module collection object for a + matching test module. + +- extend and refine xfail mechanism: + ``@py.test.mark.xfail(run=False)`` do not run the decorated test + ``@py.test.mark.xfail(reason="...")`` prints the reason string in xfail summaries + specifiying ``--runxfail`` on command line virtually ignores xfail markers + +- expose (previously internal) commonly useful methods: + py.io.get_terminal_with() -> return terminal width + py.io.ansi_print(...) -> print colored/bold text on linux/win32 + py.io.saferepr(obj) -> return limited representation string + +- expose test outcome related exceptions as py.test.skip.Exception, + py.test.raises.Exception etc., useful mostly for plugins + doing special outcome interpretation/tweaking + +- (issue85) fix junitxml plugin to handle tests with non-ascii output + +- fix/refine python3 compatibility (thanks Benjamin Peterson) + +- fixes for making the jython/win32 combination work, note however: + jython2.5.1/win32 does not provide a command line launcher, see + http://bugs.jython.org/issue1491 . See pylib install documentation + for how to work around. + +- fixes for handling of unicode exception values and unprintable objects + +- (issue87) fix unboundlocal error in assertionold code + +- (issue86) improve documentation for looponfailing + +- refine IO capturing: stdin-redirect pseudo-file now has a NOP close() method + +- ship distribute_setup.py version 0.6.10 + +- added links to the new capturelog and coverage plugins + + +Changes between 1.2.1 and 1.2.0 +===================================== + +- refined usage and options for "py.cleanup":: + + py.cleanup # remove "*.pyc" and "*$py.class" (jython) files + py.cleanup -e .swp -e .cache # also remove files with these extensions + py.cleanup -s # remove "build" and "dist" directory next to setup.py files + py.cleanup -d # also remove empty directories + py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'" + py.cleanup -n # dry run, only show what would be removed + +- add a new option "py.test --funcargs" which shows available funcargs + and their help strings (docstrings on their respective factory function) + for a given test path + +- display a short and concise traceback if a funcarg lookup fails + +- early-load "conftest.py" files in non-dot first-level sub directories. + allows to conveniently keep and access test-related options in a ``test`` + subdir and still add command line options. + +- fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value + +- fix issue78: always call python-level teardown functions even if the + according setup failed. This includes refinements for calling setup_module/class functions + which will now only be called once instead of the previous behaviour where they'd be called + multiple times if they raise an exception (including a Skipped exception). Any exception + will be re-corded and associated with all tests in the according module/class scope. + +- fix issue63: assume <40 columns to be a bogus terminal width, default to 80 + +- fix pdb debugging to be in the correct frame on raises-related errors + +- update apipkg.py to fix an issue where recursive imports might + unnecessarily break importing + +- fix plugin links + +Changes between 1.2 and 1.1.1 +===================================== + +- moved dist/looponfailing from py.test core into a new + separately released pytest-xdist plugin. + +- new junitxml plugin: --junitxml=path will generate a junit style xml file + which is processable e.g. by the Hudson CI system. + +- new option: --genscript=path will generate a standalone py.test script + which will not need any libraries installed. thanks to Ralf Schmitt. + +- new option: --ignore will prevent specified path from collection. + Can be specified multiple times. + +- new option: --confcutdir=dir will make py.test only consider conftest + files that are relative to the specified dir. + +- new funcarg: "pytestconfig" is the pytest config object for access + to command line args and can now be easily used in a test. + +- install 'py.test' and `py.which` with a ``-$VERSION`` suffix to + disambiguate between Python3, python2.X, Jython and PyPy installed versions. + +- new "pytestconfig" funcarg allows access to test config object + +- new "pytest_report_header" hook can return additional lines + to be displayed at the header of a test run. + +- (experimental) allow "py.test path::name1::name2::..." for pointing + to a test within a test collection directly. This might eventually + evolve as a full substitute to "-k" specifications. + +- streamlined plugin loading: order is now as documented in + customize.html: setuptools, ENV, commandline, conftest. + also setuptools entry point names are turned to canonical namees ("pytest_*") + +- automatically skip tests that need 'capfd' but have no os.dup + +- allow pytest_generate_tests to be defined in classes as well + +- deprecate usage of 'disabled' attribute in favour of pytestmark +- deprecate definition of Directory, Module, Class and Function nodes + in conftest.py files. Use pytest collect hooks instead. + +- collection/item node specific runtest/collect hooks are only called exactly + on matching conftest.py files, i.e. ones which are exactly below + the filesystem path of an item + +- change: the first pytest_collect_directory hook to return something + will now prevent further hooks to be called. + +- change: figleaf plugin now requires --figleaf to run. Also + change its long command line options to be a bit shorter (see py.test -h). + +- change: pytest doctest plugin is now enabled by default and has a + new option --doctest-glob to set a pattern for file matches. + +- change: remove internal py._* helper vars, only keep py._pydir + +- robustify capturing to survive if custom pytest_runtest_setup + code failed and prevented the capturing setup code from running. + +- make py.test.* helpers provided by default plugins visible early - + works transparently both for pydoc and for interactive sessions + which will regularly see e.g. py.test.mark and py.test.importorskip. + +- simplify internal plugin manager machinery +- simplify internal collection tree by introducing a RootCollector node + +- fix assert reinterpreation that sees a call containing "keyword=..." + +- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish + hooks on slaves during dist-testing, report module/session teardown + hooks correctly. + +- fix issue65: properly handle dist-testing if no + execnet/py lib installed remotely. + +- skip some install-tests if no execnet is available + +- fix docs, fix internal bin/ script generation + + +Changes between 1.1.1 and 1.1.0 +===================================== + +- introduce automatic plugin registration via 'pytest11' + entrypoints via setuptools' pkg_resources.iter_entry_points + +- fix py.test dist-testing to work with execnet >= 1.0.0b4 + +- re-introduce py.test.cmdline.main() for better backward compatibility + +- svn paths: fix a bug with path.check(versioned=True) for svn paths, + allow '%' in svn paths, make svnwc.update() default to interactive mode + like in 1.0.x and add svnwc.update(interactive=False) to inhibit interaction. + +- refine distributed tarball to contain test and no pyc files + +- try harder to have deprecation warnings for py.compat.* accesses + report a correct location + +Changes between 1.1.0 and 1.0.2 +===================================== + +* adjust and improve docs + +* remove py.rest tool and internal namespace - it was + never really advertised and can still be used with + the old release if needed. If there is interest + it could be revived into its own tool i guess. + +* fix issue48 and issue59: raise an Error if the module + from an imported test file does not seem to come from + the filepath - avoids "same-name" confusion that has + been reported repeatedly + +* merged Ronny's nose-compatibility hacks: now + nose-style setup_module() and setup() functions are + supported + +* introduce generalized py.test.mark function marking + +* reshuffle / refine command line grouping + +* deprecate parser.addgroup in favour of getgroup which creates option group + +* add --report command line option that allows to control showing of skipped/xfailed sections + +* generalized skipping: a new way to mark python functions with skipif or xfail + at function, class and modules level based on platform or sys-module attributes. + +* extend py.test.mark decorator to allow for positional args + +* introduce and test "py.cleanup -d" to remove empty directories + +* fix issue #59 - robustify unittest test collection + +* make bpython/help interaction work by adding an __all__ attribute + to ApiModule, cleanup initpkg + +* use MIT license for pylib, add some contributors + +* remove py.execnet code and substitute all usages with 'execnet' proper + +* fix issue50 - cached_setup now caches more to expectations + for test functions with multiple arguments. + +* merge Jarko's fixes, issue #45 and #46 + +* add the ability to specify a path for py.lookup to search in + +* fix a funcarg cached_setup bug probably only occuring + in distributed testing and "module" scope with teardown. + +* many fixes and changes for making the code base python3 compatible, + many thanks to Benjamin Peterson for helping with this. + +* consolidate builtins implementation to be compatible with >=2.3, + add helpers to ease keeping 2 and 3k compatible code + +* deprecate py.compat.doctest|subprocess|textwrap|optparse + +* deprecate py.magic.autopath, remove py/magic directory + +* move pytest assertion handling to py/code and a pytest_assertion + plugin, add "--no-assert" option, deprecate py.magic namespaces + in favour of (less) py.code ones. + +* consolidate and cleanup py/code classes and files + +* cleanup py/misc, move tests to bin-for-dist + +* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg + +* consolidate py.log implementation, remove old approach. + +* introduce py.io.TextIO and py.io.BytesIO for distinguishing between + text/unicode and byte-streams (uses underlying standard lib io.* + if available) + +* make py.unittest_convert helper script available which converts "unittest.py" + style files into the simpler assert/direct-test-classes py.test/nosetests + style. The script was written by Laura Creighton. + +* simplified internal localpath implementation + +Changes between 1.0.1 and 1.0.2 +===================================== + +* fixing packaging issues, triggered by fedora redhat packaging, + also added doc, examples and contrib dirs to the tarball. + +* added a documentation link to the new django plugin. + +Changes between 1.0.0 and 1.0.1 +===================================== + +* added a 'pytest_nose' plugin which handles nose.SkipTest, + nose-style function/method/generator setup/teardown and + tries to report functions correctly. + +* capturing of unicode writes or encoded strings to sys.stdout/err + work better, also terminalwriting was adapted and somewhat + unified between windows and linux. + +* improved documentation layout and content a lot + +* added a "--help-config" option to show conftest.py / ENV-var names for + all longopt cmdline options, and some special conftest.py variables. + renamed 'conf_capture' conftest setting to 'option_capture' accordingly. + +* fix issue #27: better reporting on non-collectable items given on commandline + (e.g. pyc files) + +* fix issue #33: added --version flag (thanks Benjamin Peterson) + +* fix issue #32: adding support for "incomplete" paths to wcpath.status() + +* "Test" prefixed classes are *not* collected by default anymore if they + have an __init__ method + +* monkeypatch setenv() now accepts a "prepend" parameter + +* improved reporting of collection error tracebacks + +* simplified multicall mechanism and plugin architecture, + renamed some internal methods and argnames + +Changes between 1.0.0b9 and 1.0.0 +===================================== + +* more terse reporting try to show filesystem path relatively to current dir +* improve xfail output a bit + +Changes between 1.0.0b8 and 1.0.0b9 +===================================== + +* cleanly handle and report final teardown of test setup + +* fix svn-1.6 compat issue with py.path.svnwc().versioned() + (thanks Wouter Vanden Hove) + +* setup/teardown or collection problems now show as ERRORs + or with big "E"'s in the progress lines. they are reported + and counted separately. + +* dist-testing: properly handle test items that get locally + collected but cannot be collected on the remote side - often + due to platform/dependency reasons + +* simplified py.test.mark API - see keyword plugin documentation + +* integrate better with logging: capturing now by default captures + test functions and their immediate setup/teardown in a single stream + +* capsys and capfd funcargs now have a readouterr() and a close() method + (underlyingly py.io.StdCapture/FD objects are used which grew a + readouterr() method as well to return snapshots of captured out/err) + +* make assert-reinterpretation work better with comparisons not + returning bools (reported with numpy from thanks maciej fijalkowski) + +* reworked per-test output capturing into the pytest_iocapture.py plugin + and thus removed capturing code from config object + +* item.repr_failure(excinfo) instead of item.repr_failure(excinfo, outerr) + + +Changes between 1.0.0b7 and 1.0.0b8 +===================================== + +* pytest_unittest-plugin is now enabled by default + +* introduced pytest_keyboardinterrupt hook and + refined pytest_sessionfinish hooked, added tests. + +* workaround a buggy logging module interaction ("closing already closed + files"). Thanks to Sridhar Ratnakumar for triggering. + +* if plugins use "py.test.importorskip" for importing + a dependency only a warning will be issued instead + of exiting the testing process. + +* many improvements to docs: + - refined funcargs doc , use the term "factory" instead of "provider" + - added a new talk/tutorial doc page + - better download page + - better plugin docstrings + - added new plugins page and automatic doc generation script + +* fixed teardown problem related to partially failing funcarg setups + (thanks MrTopf for reporting), "pytest_runtest_teardown" is now + always invoked even if the "pytest_runtest_setup" failed. + +* tweaked doctest output for docstrings in py modules, + thanks Radomir. + +Changes between 1.0.0b3 and 1.0.0b7 +============================================= + +* renamed py.test.xfail back to py.test.mark.xfail to avoid + two ways to decorate for xfail + +* re-added py.test.mark decorator for setting keywords on functions + (it was actually documented so removing it was not nice) + +* remove scope-argument from request.addfinalizer() because + request.cached_setup has the scope arg. TOOWTDI. + +* perform setup finalization before reporting failures + +* apply modified patches from Andreas Kloeckner to allow + test functions to have no func_code (#22) and to make + "-k" and function keywords work (#20) + +* apply patch from Daniel Peolzleithner (issue #23) + +* resolve issue #18, multiprocessing.Manager() and + redirection clash + +* make __name__ == "__channelexec__" for remote_exec code + +Changes between 1.0.0b1 and 1.0.0b3 +============================================= + +* plugin classes are removed: one now defines + hooks directly in conftest.py or global pytest_*.py + files. + +* added new pytest_namespace(config) hook that allows + to inject helpers directly to the py.test.* namespace. + +* documented and refined many hooks + +* added new style of generative tests via + pytest_generate_tests hook that integrates + well with function arguments. + + +Changes between 0.9.2 and 1.0.0b1 +============================================= + +* introduced new "funcarg" setup method, + see doc/test/funcarg.txt + +* introduced plugin architecuture and many + new py.test plugins, see + doc/test/plugins.txt + +* teardown_method is now guaranteed to get + called after a test method has run. + +* new method: py.test.importorskip(mod,minversion) + will either import or call py.test.skip() + +* completely revised internal py.test architecture + +* new py.process.ForkedFunc object allowing to + fork execution of a function to a sub process + and getting a result back. + +XXX lots of things missing here XXX + +Changes between 0.9.1 and 0.9.2 +=============================== + +* refined installation and metadata, created new setup.py, + now based on setuptools/ez_setup (thanks to Ralf Schmitt + for his support). + +* improved the way of making py.* scripts available in + windows environments, they are now added to the + Scripts directory as ".cmd" files. + +* py.path.svnwc.status() now is more complete and + uses xml output from the 'svn' command if available + (Guido Wesdorp) + +* fix for py.path.svn* to work with svn 1.5 + (Chris Lamb) + +* fix path.relto(otherpath) method on windows to + use normcase for checking if a path is relative. + +* py.test's traceback is better parseable from editors + (follows the filenames:LINENO: MSG convention) + (thanks to Osmo Salomaa) + +* fix to javascript-generation, "py.test --runbrowser" + should work more reliably now + +* removed previously accidentally added + py.test.broken and py.test.notimplemented helpers. + +* there now is a py.__version__ attribute + +Changes between 0.9.0 and 0.9.1 +=============================== + +This is a fairly complete list of changes between 0.9 and 0.9.1, which can +serve as a reference for developers. + +* allowing + signs in py.path.svn urls [39106] +* fixed support for Failed exceptions without excinfo in py.test [39340] +* added support for killing processes for Windows (as well as platforms that + support os.kill) in py.misc.killproc [39655] +* added setup/teardown for generative tests to py.test [40702] +* added detection of FAILED TO LOAD MODULE to py.test [40703, 40738, 40739] +* fixed problem with calling .remove() on wcpaths of non-versioned files in + py.path [44248] +* fixed some import and inheritance issues in py.test [41480, 44648, 44655] +* fail to run greenlet tests when pypy is available, but without stackless + [45294] +* small fixes in rsession tests [45295] +* fixed issue with 2.5 type representations in py.test [45483, 45484] +* made that internal reporting issues displaying is done atomically in py.test + [45518] +* made that non-existing files are igored by the py.lookup script [45519] +* improved exception name creation in py.test [45535] +* made that less threads are used in execnet [merge in 45539] +* removed lock required for atomical reporting issue displaying in py.test + [45545] +* removed globals from execnet [45541, 45547] +* refactored cleanup mechanics, made that setDaemon is set to 1 to make atexit + get called in 2.5 (py.execnet) [45548] +* fixed bug in joining threads in py.execnet's servemain [45549] +* refactored py.test.rsession tests to not rely on exact output format anymore + [45646] +* using repr() on test outcome [45647] +* added 'Reason' classes for py.test.skip() [45648, 45649] +* killed some unnecessary sanity check in py.test.collect [45655] +* avoid using os.tmpfile() in py.io.fdcapture because on Windows it's only + usable by Administrators [45901] +* added support for locking and non-recursive commits to py.path.svnwc [45994] +* locking files in py.execnet to prevent CPython from segfaulting [46010] +* added export() method to py.path.svnurl +* fixed -d -x in py.test [47277] +* fixed argument concatenation problem in py.path.svnwc [49423] +* restore py.test behaviour that it exits with code 1 when there are failures + [49974] +* don't fail on html files that don't have an accompanying .txt file [50606] +* fixed 'utestconvert.py < input' [50645] +* small fix for code indentation in py.code.source [50755] +* fix _docgen.py documentation building [51285] +* improved checks for source representation of code blocks in py.test [51292] +* added support for passing authentication to py.path.svn* objects [52000, + 52001] +* removed sorted() call for py.apigen tests in favour of [].sort() to support + Python 2.3 [52481] --- a/doc/test/plugin/skipping.txt +++ b/doc/test/plugin/skipping.txt @@ -81,7 +81,6 @@ apply the function will be skipped. .. _`whole class- or module level`: mark.html#scoped-marking -.. _xfail: mark a test function as **expected to fail** ------------------------------------------------------- --- a/doc/test/plugin/junitxml.txt +++ b/doc/test/plugin/junitxml.txt @@ -14,6 +14,8 @@ command line options ``--junitxml=path`` create junit-xml style report file at given path. +``--junitprefix=str`` + prepend prefix to classnames in junit-xml output Start improving this plugin in 30 seconds ========================================= --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ dictionary or an import path. (c) Holger Krekel and others, 2004-2010 """ -__version__ = version = "1.3.2a1" +__version__ = version = "1.3.2" import py.apipkg --- a/doc/test/plugin/links.txt +++ b/doc/test/plugin/links.txt @@ -1,47 +1,47 @@ .. _`helpconfig`: helpconfig.html -.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_recwarn.py +.. _`pytest_recwarn.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_recwarn.py .. _`unittest`: unittest.html -.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_monkeypatch.py -.. _`pytest_genscript.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_genscript.py +.. _`pytest_monkeypatch.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_monkeypatch.py +.. _`pytest_genscript.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_genscript.py .. _`pastebin`: pastebin.html .. _`skipping`: skipping.html .. _`genscript`: genscript.html .. _`plugins`: index.html .. _`mark`: mark.html .. _`tmpdir`: tmpdir.html -.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_doctest.py +.. _`pytest_doctest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_doctest.py .. _`capture`: capture.html -.. _`pytest_nose.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_nose.py -.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_restdoc.py +.. _`pytest_nose.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_nose.py +.. _`pytest_restdoc.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_restdoc.py .. _`restdoc`: restdoc.html .. _`xdist`: xdist.html -.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_pastebin.py -.. _`pytest_tmpdir.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_tmpdir.py +.. _`pytest_pastebin.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_pastebin.py +.. _`pytest_tmpdir.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_tmpdir.py .. _`terminal`: terminal.html -.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_hooklog.py +.. _`pytest_hooklog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_hooklog.py .. _`capturelog`: capturelog.html .. _`junitxml`: junitxml.html -.. _`pytest_skipping.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_skipping.py +.. _`pytest_skipping.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_skipping.py .. _`checkout the py.test development version`: ../../install.html#checkout -.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_helpconfig.py +.. _`pytest_helpconfig.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_helpconfig.py .. _`oejskit`: oejskit.html .. _`doctest`: doctest.html -.. _`pytest_mark.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_mark.py +.. _`pytest_mark.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_mark.py .. _`get in contact`: ../../contact.html -.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_capture.py +.. _`pytest_capture.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_capture.py .. _`figleaf`: figleaf.html .. _`customize`: ../customize.html .. _`hooklog`: hooklog.html -.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_terminal.py +.. _`pytest_terminal.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_terminal.py .. _`recwarn`: recwarn.html -.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_pdb.py +.. _`pytest_pdb.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_pdb.py .. _`monkeypatch`: monkeypatch.html .. _`coverage`: coverage.html .. _`resultlog`: resultlog.html .. _`cov`: cov.html -.. _`pytest_junitxml.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_junitxml.py +.. _`pytest_junitxml.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_junitxml.py .. _`django`: django.html -.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_unittest.py +.. _`pytest_unittest.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_unittest.py .. _`nose`: nose.html -.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.1/py/_plugin/pytest_resultlog.py +.. _`pytest_resultlog.py`: http://bitbucket.org/hpk42/py-trunk/raw/1.3.2/py/_plugin/pytest_resultlog.py .. _`pdb`: pdb.html --- a/doc/test/plugin/hookspec.txt +++ b/doc/test/plugin/hookspec.txt @@ -203,8 +203,5 @@ hook specification sourcecode def pytest_rescheduleitems(items): """ reschedule Items from a node that went down. """ - - def pytest_looponfailinfo(failreports, rootdirs): - """ info for repeating failing tests. """ .. include:: links.txt --- a/doc/test/plugin/coverage.txt +++ b/doc/test/plugin/coverage.txt @@ -6,27 +6,10 @@ Write and report coverage data with the .. contents:: :local: -Note: Original code by Ross Lawley. +Original code by Ross Lawley. -Install --------------- - -Use pip to (un)install:: - - pip install pytest-coverage - pip uninstall pytest-coverage - -or alternatively use easy_install to install:: - - easy_install pytest-coverage - - -Usage -------------- - -To get full test coverage reports for a particular package type:: - - py.test --cover-report=report +Requires Ned Batchelder's excellent coverage: +http://nedbatchelder.com/code/coverage/ command line options -------------------- @@ -38,11 +21,8 @@ command line options html: Directory for html output. report: Output a text report. annotate: Annotate your source code for which lines were executed and which were not. - xml: Output an xml report compatible with the cobertura plugin for hudson. ``--cover-directory=DIRECTORY`` Directory for the reports (html / annotate results) defaults to ./coverage -``--cover-xml-file=XML_FILE`` - File for the xml report defaults to ./coverage.xml ``--cover-show-missing`` Show missing files ``--cover-ignore-errors=IGNORE_ERRORS`` --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def main(): name='py', description='py.test and pylib: rapid testing and development utils.', long_description = long_description, - version= '1.3.2a1', + version= '1.3.2', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], From commits-noreply at bitbucket.org Wed Jul 7 16:38:46 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 14:38:46 +0000 (UTC) Subject: [py-svn] py-trunk commit 67f68e3553dd: fixing a doc reference, removing development dependency Message-ID: <20100707143846.280DA7EF6B@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278513448 -7200 # Node ID 67f68e3553dd6aad8be028727f7b30164263ead3 # Parent c01d15908f909ce097f673db17803a180c0e01ad fixing a doc reference, removing development dependency --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,6 @@ basepython=python changedir={toxinidir} deps=docutils pygments - {distshare}/execnet-**LATEST** {distshare}/py-**LATEST** {distshare}/pytest-xdist-**LATEST** pytest-figleaf --- a/py/_plugin/pytest_skipping.py +++ b/py/_plugin/pytest_skipping.py @@ -76,6 +76,7 @@ apply the function will be skipped. .. _`whole class- or module level`: mark.html#scoped-marking +.. _xfail: mark a test function as **expected to fail** ------------------------------------------------------- --- a/doc/test/plugin/skipping.txt +++ b/doc/test/plugin/skipping.txt @@ -81,6 +81,7 @@ apply the function will be skipped. .. _`whole class- or module level`: mark.html#scoped-marking +.. _xfail: mark a test function as **expected to fail** ------------------------------------------------------- From commits-noreply at bitbucket.org Wed Jul 7 16:42:25 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 14:42:25 +0000 (UTC) Subject: [py-svn] py-trunk commit 40e9e77c088f: bold summary line Message-ID: <20100707144225.913517EF81@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278513688 -7200 # Node ID 40e9e77c088fd7784201d9d4f1856637776bce18 # Parent 67f68e3553dd6aad8be028727f7b30164263ead3 bold summary line --- a/py/_plugin/pytest_terminal.py +++ b/py/_plugin/pytest_terminal.py @@ -353,7 +353,7 @@ class TerminalReporter: parts.append("%d %s" %(len(val), key)) line = ", ".join(parts) # XXX coloring - self.write_sep("=", "%s in %.2f seconds" %(line, session_duration)) + self.write_sep("=", "%s in %.2f seconds" %(line, session_duration), bold=True) def summary_deselected(self): if 'deselected' in self.stats: From commits-noreply at bitbucket.org Wed Jul 7 16:45:28 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 14:45:28 +0000 (UTC) Subject: [py-svn] pytest-xdist commit c8ab8559d1df: show detailed gateway setup info only with "--verbose" or "-v" Message-ID: <20100707144528.DA6D87EF81@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278513852 -7200 # Node ID c8ab8559d1df9043ee55709b8fe0a7a155b9d32d # Parent 73256b213681c36ab4a09583f2bdf716cb653e46 show detailed gateway setup info only with "--verbose" or "-v" --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -15,7 +15,7 @@ class TestDistribution: py.test.skip("hello") """, ) - result = testdir.runpytest(p1, '-d', '--tx=popen', '--tx=popen') + result = testdir.runpytest(p1, "-v", '-d', '--tx=popen', '--tx=popen') result.stdout.fnmatch_lines([ "*0*popen*Python*", "*1*popen*Python*", @@ -39,7 +39,7 @@ class TestDistribution: testdir.makeconftest(""" option_tx = 'popen popen popen'.split() """) - result = testdir.runpytest(p1, '-d') + result = testdir.runpytest(p1, '-d', "-v") result.stdout.fnmatch_lines([ "*0*popen*Python*", "*1*popen*Python*", @@ -70,7 +70,7 @@ class TestDistribution: os.kill(os.getpid(), 15) """ ) - result = testdir.runpytest(p1, '-d', '--tx=3*popen') + result = testdir.runpytest(p1, "-v", '-d', '--tx=3*popen') result.stdout.fnmatch_lines([ "*popen*Python*", "*popen*Python*", @@ -87,7 +87,7 @@ class TestDistribution: subdir.ensure("__init__.py") p = subdir.join("test_one.py") p.write("def test_5(): assert not __file__.startswith(%r)" % str(p)) - result = testdir.runpytest("-d", "--rsyncdir=%(subdir)s" % locals(), + result = testdir.runpytest("-v", "-d", "--rsyncdir=%(subdir)s" % locals(), "--tx=popen//chdir=%(dest)s" % locals(), p) assert result.ret == 0 result.stdout.fnmatch_lines([ @@ -112,7 +112,7 @@ class TestDistribution: print("%s...%s" % sys.version_info[:2]) assert 0 """) - args = ["--dist=each"] + args = ["--dist=each", "-v"] args += ["--tx", "popen//python=%s" % interpreters[0]] args += ["--tx", "popen//python=%s" % interpreters[1]] result = testdir.runpytest(*args) @@ -147,7 +147,7 @@ class TestDistribution: 'calculated result is %s' % calc_result) """) p1 = testdir.makepyfile("def test_func(): pass") - result = testdir.runpytest(p1, '-d', '--tx=popen') + result = testdir.runpytest("-v", p1, '-d', '--tx=popen') result.stdout.fnmatch_lines([ "*popen*Python*", "*calculated result is 49*", --- a/xdist/dsession.py +++ b/xdist/dsession.py @@ -100,9 +100,12 @@ class DSession(session.Session): return exitstatus def collect_all_items(self, colitems): - self.report_line("[master] starting full item collection ...") + verbose = self.config.getvalue("verbose") + if verbose: + self.report_line("[master] starting full item collection ...") allitems = list(self.collect(colitems)) - self.report_line("[master] collected %d items" %(len(allitems))) + if verbose: + self.report_line("[master] collected %d items" %(len(allitems))) return allitems def loop_once(self, loopstate): @@ -286,6 +289,9 @@ class DSession(session.Session): def setup(self): """ setup any neccessary resources ahead of the test run. """ + if not self.config.getvalue("verbose"): + self.report_line("instantiating gateways (use -v for details): %s" % + ",".join(self.config.option.tx)) self.nodemanager = NodeManager(self.config) self.nodemanager.setup_nodes(putevent=self.queue.put) --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -294,11 +294,14 @@ class TerminalDistReporter: "Python %(version)s " "cwd: %(cwd)s" "%(extra)s" % d) - self.write_line(infoline) + if self.config.getvalue("verbose"): + self.write_line(infoline) self.gateway2info[gateway] = infoline def pytest_testnodeready(self, node): - self.write_line("[%s] txnode ready to receive tests" %(node.gateway.id,)) + if self.config.getvalue("verbose"): + self.write_line( + "[%s] txnode ready to receive tests" %(node.gateway.id,)) def pytest_testnodedown(self, node, error): if not error: --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,9 @@ 1.4 - depend on execnet-1.0.7 which adds "env1:NAME=value" keys to gateway specification strings. +- show detailed gateway setup and platform information only when + "-v" or "--verbose" is specified. + 1.3 ------------------------- From commits-noreply at bitbucket.org Wed Jul 7 18:13:14 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 16:13:14 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 17836421202e: improved versioing Message-ID: <20100707161314.6F1587EF72@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278519163 -7200 # Node ID 17836421202e8907e9b11605f3d9320af66ea7f0 # Parent c8ab8559d1df9043ee55709b8fe0a7a155b9d32d improved versioing --- a/tox.ini +++ b/tox.ini @@ -8,8 +8,8 @@ sdistsrc={distshare}/pytest-xdist-**LATE [testenv] changedir=testing deps= - {distshare}/py-**LATEST** - {distshare}/execnet-**LATEST** + {distshare}/py-* + {distshare}/execnet-* commands= py.test -rsfxX --tools-on-path \ --junitxml={envlogdir}/junit-{envname}.xml [] @@ -18,8 +18,8 @@ basepython=python2.7 [testenv:py26] basepython=python2.6 deps= - {distshare}/py-**LATEST** - {distshare}/execnet-**LATEST** + {distshare}/py-* + {distshare}/execnet-* pexpect #[testenv:py26-py132] #basepython=python2.6 From commits-noreply at bitbucket.org Wed Jul 7 18:13:25 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 16:13:25 +0000 (UTC) Subject: [py-svn] py-trunk commit 66b03b254e32: using improved versioing Message-ID: <20100707161325.4B2937EF72@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278518896 -7200 # Node ID 66b03b254e32fe40aff0551adc19fc1c9f288a19 # Parent 40e9e77c088fd7784201d9d4f1856637776bce18 using improved versioing --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ envlist=py26,py27,py31,py27-xdist,py25,p [tox:hudson] distshare={toxworkdir}/distshare -sdistsrc={distshare}/py-**LATEST** +sdistsrc={distshare}/py-* [testenv] changedir=testing @@ -18,8 +18,8 @@ basepython=python2.7 [testenv:py27-xdist] basepython=python2.7 deps= - {distshare}/py-**LATEST** - {distshare}/pytest-xdist-**LATEST** + {distshare}/py-* + {distshare}/pytest-xdist-* commands= py.test -n3 --confcutdir=.. -rfsxX \ --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] @@ -31,8 +31,8 @@ basepython=python changedir={toxinidir} deps=docutils pygments - {distshare}/py-**LATEST** - {distshare}/pytest-xdist-**LATEST** + {distshare}/py-* + {distshare}/pytest-xdist-* pytest-figleaf pytest-coverage pytest-cov From commits-noreply at bitbucket.org Wed Jul 7 18:14:59 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 7 Jul 2010 16:14:59 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 2865bea4369a: typo Message-ID: <20100707161459.A5BF47EF72@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278519268 -7200 # Node ID 2865bea4369a35e66f80795d166543015f383f6e # Parent 17836421202e8907e9b11605f3d9320af66ea7f0 typo --- a/tox.ini +++ b/tox.ini @@ -3,7 +3,7 @@ distshare={homedir}/.tox/distshare envlist=py26,py31,py27,py25,py24 [tox:hudson] distshare={toxworkdir}/distshare -sdistsrc={distshare}/pytest-xdist-**LATEST** +sdistsrc={distshare}/pytest-xdist-* [testenv] changedir=testing From commits-noreply at bitbucket.org Thu Jul 8 08:36:02 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 8 Jul 2010 06:36:02 +0000 (UTC) Subject: [py-svn] pytest-xdist commit a423748bf17e: just use the released version fo execnet Message-ID: <20100708063602.968347EE65@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278520407 -7200 # Node ID a423748bf17ee778a37853225210257699cad9c1 # Parent 2865bea4369a35e66f80795d166543015f383f6e just use the released version fo execnet --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ sdistsrc={distshare}/pytest-xdist-* changedir=testing deps= {distshare}/py-* - {distshare}/execnet-* commands= py.test -rsfxX --tools-on-path \ --junitxml={envlogdir}/junit-{envname}.xml [] @@ -19,7 +18,6 @@ basepython=python2.7 basepython=python2.6 deps= {distshare}/py-* - {distshare}/execnet-* pexpect #[testenv:py26-py132] #basepython=python2.6 From commits-noreply at bitbucket.org Thu Jul 8 12:36:45 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 8 Jul 2010 10:36:45 +0000 (UTC) Subject: [py-svn] py-trunk commit d67c0d87eefe: fix windows homedir detection Message-ID: <20100708103645.D7FA07EF72@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278585343 -7200 # Node ID d67c0d87eefe23990caf25aefea8da7d87523d3c # Parent 66b03b254e32fe40aff0551adc19fc1c9f288a19 fix windows homedir detection --- a/py/_path/local.py +++ b/py/_path/local.py @@ -618,7 +618,7 @@ class LocalPath(FSBase): try: x = os.environ['HOME'] except KeyError: - x = os.environ['HOMEPATH'] + x = os.environ["HOMEDRIVE"] + os.environ['HOMEPATH'] return cls(x) _gethomedir = classmethod(_gethomedir) --- a/CHANGELOG +++ b/CHANGELOG @@ -72,6 +72,7 @@ Bug fixes / Maintenance - perform distributed testing related reporting in the xdist-plugin rather than having dist-related code in the generic py.test distribution +- fix homedir detection on Windows Changes between 1.3.0 and 1.3.1 ================================================== From commits-noreply at bitbucket.org Thu Jul 8 13:40:56 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 8 Jul 2010 11:40:56 +0000 (UTC) Subject: [py-svn] py-trunk commit 62ca2e5e16b5: ship distribute_setup.py version 0.6.13 Message-ID: <20100708114056.AC96B7EF0C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278589219 -7200 # Node ID 62ca2e5e16b564304dfd1ea4bacb8c295dd1148e # Parent d67c0d87eefe23990caf25aefea8da7d87523d3c ship distribute_setup.py version 0.6.13 --- a/distribute_setup.py +++ b/distribute_setup.py @@ -46,7 +46,7 @@ except ImportError: args = [quote(arg) for arg in args] return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 -DEFAULT_VERSION = "0.6.10" +DEFAULT_VERSION = "0.6.13" DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" SETUPTOOLS_FAKED_VERSION = "0.6c11" @@ -203,6 +203,29 @@ def download_setuptools(version=DEFAULT_ dst.close() return os.path.realpath(saveto) +def _no_sandbox(function): + def __no_sandbox(*args, **kw): + try: + from setuptools.sandbox import DirectorySandbox + if not hasattr(DirectorySandbox, '_old'): + def violation(*args): + pass + DirectorySandbox._old = DirectorySandbox._violation + DirectorySandbox._violation = violation + patched = True + else: + patched = False + except ImportError: + patched = False + + try: + return function(*args, **kw) + finally: + if patched: + DirectorySandbox._violation = DirectorySandbox._old + del DirectorySandbox._old + + return __no_sandbox def _patch_file(path, content): """Will backup the file then patch it""" @@ -220,32 +243,11 @@ def _patch_file(path, content): f.close() return True +_patch_file = _no_sandbox(_patch_file) def _same_content(path, content): return open(path).read() == content -def _no_sandbox(function): - def __no_sandbox(*args, **kw): - try: - from setuptools.sandbox import DirectorySandbox - def violation(*args): - pass - DirectorySandbox._old = DirectorySandbox._violation - DirectorySandbox._violation = violation - patched = True - except ImportError: - patched = False - - try: - return function(*args, **kw) - finally: - if patched: - DirectorySandbox._violation = DirectorySandbox._old - del DirectorySandbox._old - - return __no_sandbox - - at _no_sandbox def _rename_path(path): new_name = path + '.OLD.%s' % time.time() log.warn('Renaming %s into %s', path, new_name) @@ -285,13 +287,13 @@ def _remove_flat_installation(placeholde 'Setuptools distribution', element) return True +_remove_flat_installation = _no_sandbox(_remove_flat_installation) def _after_install(dist): log.warn('After install bootstrap.') placeholder = dist.get_command_obj('install').install_purelib _create_fake_setuptools_pkg_info(placeholder) - at _no_sandbox def _create_fake_setuptools_pkg_info(placeholder): if not placeholder or not os.path.exists(placeholder): log.warn('Could not find the install location') @@ -319,6 +321,8 @@ def _create_fake_setuptools_pkg_info(pla finally: f.close() +_create_fake_setuptools_pkg_info = _no_sandbox(_create_fake_setuptools_pkg_info) + def _patch_egg_dir(path): # let's check if it's already patched pkg_info = os.path.join(path, 'EGG-INFO', 'PKG-INFO') @@ -337,6 +341,7 @@ def _patch_egg_dir(path): f.close() return True +_patch_egg_dir = _no_sandbox(_patch_egg_dir) def _before_install(): log.warn('Before install bootstrap.') @@ -356,8 +361,8 @@ def _under_prefix(location): if len(args) > index: top_dir = args[index+1] return location.startswith(top_dir) - elif option == '--user' and USER_SITE is not None: - return location.startswith(USER_SITE) + if arg == '--user' and USER_SITE is not None: + return location.startswith(USER_SITE) return True @@ -416,6 +421,9 @@ def _fake_setuptools(): def _relaunch(): log.warn('Relaunching...') # we have to relaunch the process + # pip marker to avoid a relaunch bug + if sys.argv[:3] == ['-c', 'install', '--single-version-externally-managed']: + sys.argv[0] = 'setup.py' args = [sys.executable] + sys.argv sys.exit(subprocess.call(args)) --- a/CHANGELOG +++ b/CHANGELOG @@ -73,6 +73,7 @@ Bug fixes / Maintenance rather than having dist-related code in the generic py.test distribution - fix homedir detection on Windows +- ship distribute_setup.py version 0.6.13 Changes between 1.3.0 and 1.3.1 ================================================== From commits-noreply at bitbucket.org Thu Jul 8 15:29:44 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 8 Jul 2010 13:29:44 +0000 (UTC) Subject: [py-svn] py-trunk commit d5f839c4ac46: finalizing docs Message-ID: <20100708132944.2023A7EF79@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278595734 -7200 # Node ID d5f839c4ac46a1237c134ae5855bdbe8e0a16fe2 # Parent 62ca2e5e16b564304dfd1ea4bacb8c295dd1148e finalizing docs --- a/doc/announce/release-1.3.2.txt +++ b/doc/announce/release-1.3.2.txt @@ -1,9 +1,9 @@ py.test/pylib 1.3.2: API and reporting refinements, many fixes =========================================================================== -The pylib/py.test 1.3.2 release brings many bug fixes and a few new -features and was refined for and tested against the recently released -Python2.7 besides remaining compatibile to the usual armada of interpreters +The pylib/py.test 1.3.2 release brings many bug fixes and some new +features. It was refined for and tested against the recently released +Python2.7 and remains compatibile to the usual armada of interpreters (Python2.4 through to Python3.1.2, Jython and PyPy). Note that for using distributed testing features you'll need to upgrade to the jointly released pytest-xdist-1.4 because of some internal refactorings. @@ -16,7 +16,6 @@ and all issue and patch contributors, holger krekel - Changes between 1.3.1 and 1.3.2 ================================================== @@ -37,8 +36,8 @@ New features (thanks Ronny Pfannschmidt) - Funcarg factories can now dynamically apply a marker to a - test invocation. This is for example useful if a factory - provides parameters to a test which are expected-to-fail: + test invocation. This is for example useful if a factory + provides parameters to a test which are expected-to-fail:: def pytest_funcarg__arg(request): request.applymarker(py.test.mark.xfail(reason="flaky config")) @@ -47,9 +46,9 @@ New features def test_function(arg): ... -- improved error reporting when collection errors appear. - In general, for custom (test and particularly collection) - nodes ``node.repr_failure(excinfo)`` is now called so that you can +- improved error reporting on collection and import errors. This makes + use of a more general mechanism, namely that for custom test item/collect + nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can override it to return a string error representation of your choice which is going to be reported as a (red) string. @@ -59,11 +58,9 @@ New features Bug fixes / Maintenance ++++++++++++++++++++++++++ -- make tests and the ``pytest_recwarn`` plugin in paricular fully compatible +- make tests and the ``pytest_recwarn`` plugin in particular fully compatible to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that you can properly check for their existence in a cross-python manner). -- improve error messages if importing a test module failed (ImportError, - import file mismatches, syntax errors) - refine --pdb: ignore xfailed tests, unify its TB-reporting and don't display failures again at the end. - fix assertion interpretation with the ** operator (thanks Benjamin Peterson) @@ -91,6 +88,8 @@ Bug fixes / Maintenance - perform distributed testing related reporting in the xdist-plugin rather than having dist-related code in the generic py.test distribution +- fix homedir detection on Windows +- ship distribute_setup.py version 0.6.13 Changes between 1.3.0 and 1.3.1 ================================================== --- a/doc/test/features.txt +++ b/doc/test/features.txt @@ -131,12 +131,16 @@ asserting expected exceptions ---------------------------------------- In order to write assertions about exceptions, you can use -``py.test.raises`` as a context manager like this:: +``py.test.raises`` as a context manager like this: + +.. sourcecode:: python with py.test.raises(ZeroDivisionError): 1 / 0 -and if you need to have access to the actual exception info you may use:: +and if you need to have access to the actual exception info you may use: + +.. sourcecode:: python with py.test.raises(RuntimeError) as excinfo: def f(): @@ -146,7 +150,9 @@ and if you need to have access to the ac # do checks related to excinfo.type, excinfo.value, excinfo.traceback If you want to write test code that works on Python2.4 as well, -you may also use two other ways to test for an expected exception:: +you may also use two other ways to test for an expected exception: + +.. sourcecode:: python py.test.raises(ExpectedException, func, *args, **kwargs) py.test.raises(ExpectedException, "func(*args, **kwargs)") @@ -217,7 +223,9 @@ keyword. By default, all filename parts and class/function names of a test function are put into the set of keywords for a given test. You can specify additional -kewords like this:: +kewords like this: + +.. sourcecode:: python @py.test.mark.webtest def test_send_http(): --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -Changes between 1.3.1 and 1.3.2a +Changes between 1.3.1 and 1.3.2 ================================================== New features @@ -18,8 +18,8 @@ New features (thanks Ronny Pfannschmidt) - Funcarg factories can now dynamically apply a marker to a - test invocation. This is for example useful if a factory - provides parameters to a test which are expected-to-fail: + test invocation. This is for example useful if a factory + provides parameters to a test which are expected-to-fail:: def pytest_funcarg__arg(request): request.applymarker(py.test.mark.xfail(reason="flaky config")) @@ -28,9 +28,9 @@ New features def test_function(arg): ... -- improved error reporting when collection errors appear. - In general, for custom (test and particularly collection) - nodes ``node.repr_failure(excinfo)`` is now called so that you can +- improved error reporting on collection and import errors. This makes + use of a more general mechanism, namely that for custom test item/collect + nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can override it to return a string error representation of your choice which is going to be reported as a (red) string. @@ -40,11 +40,9 @@ New features Bug fixes / Maintenance ++++++++++++++++++++++++++ -- make tests and the ``pytest_recwarn`` plugin in paricular fully compatible +- make tests and the ``pytest_recwarn`` plugin in particular fully compatible to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that you can properly check for their existence in a cross-python manner). -- improve error messages if importing a test module failed (ImportError, - import file mismatches, syntax errors) - refine --pdb: ignore xfailed tests, unify its TB-reporting and don't display failures again at the end. - fix assertion interpretation with the ** operator (thanks Benjamin Peterson) From commits-noreply at bitbucket.org Thu Jul 8 15:55:40 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 8 Jul 2010 13:55:40 +0000 (UTC) Subject: [py-svn] py-trunk commit edd9d1da0140: don't run too-long-filename test Message-ID: <20100708135540.211EB7EF3D@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278597291 -7200 # Node ID edd9d1da014015870871445ef7ae47b2b9b95f07 # Parent d5f839c4ac46a1237c134ae5855bdbe8e0a16fe2 don't run too-long-filename test --- a/testing/path/test_local.py +++ b/testing/path/test_local.py @@ -186,6 +186,7 @@ class TestLocalPath(common.CommonFSTests assert l3.strpath == wc.strpath assert not hasattr(l3, 'commit') + @py.test.mark.xfail(run=False, reason="unreliable est for long filenames") def test_long_filenames(self, tmpdir): if sys.platform == "win32": py.test.skip("win32: work around needed for path length limit") From commits-noreply at bitbucket.org Thu Jul 8 17:23:14 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 8 Jul 2010 15:23:14 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 19a3811cd5b2: Added tag 1.4 for changeset a423748bf17e Message-ID: <20100708152314.689457EF85@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1278602576 -7200 # Node ID 19a3811cd5b2662d9c42cf54bfb2a123c24bde5e # Parent a423748bf17ee778a37853225210257699cad9c1 Added tag 1.4 for changeset a423748bf17e --- a/.hgtags +++ b/.hgtags @@ -4,3 +4,4 @@ 56d8e5280be224a0ad3220a9deed55334710bd23 e6c4ce20db4bf65086ff55807a3c306cad7ca393 1.3 e6c4ce20db4bf65086ff55807a3c306cad7ca393 1.3 eaf8b1cb7c312883598677231be5bbeea3b5c127 1.3 +a423748bf17ee778a37853225210257699cad9c1 1.4 From commits-noreply at bitbucket.org Wed Jul 14 23:19:07 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 14 Jul 2010 21:19:07 +0000 (UTC) Subject: [py-svn] pytest-xdist commit 864c7ceb42f8: improved and simpler tox.ini for pytest-xdist desting Message-ID: <20100714211907.DF7A97F77E@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-xdist # URL http://bitbucket.org/hpk42/pytest-xdist/overview # User holger krekel # Date 1279142312 -7200 # Node ID 864c7ceb42f86ff9cd4a4e5cd9f882ffe059b61c # Parent 19a3811cd5b2662d9c42cf54bfb2a123c24bde5e improved and simpler tox.ini for pytest-xdist desting --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,6 @@ [tox] -distshare={homedir}/.tox/distshare envlist=py26,py31,py27,py25,py24 [tox:hudson] -distshare={toxworkdir}/distshare sdistsrc={distshare}/pytest-xdist-* [testenv] @@ -12,24 +10,8 @@ deps= commands= py.test -rsfxX --tools-on-path \ --junitxml={envlogdir}/junit-{envname}.xml [] -[testenv:py27] -basepython=python2.7 [testenv:py26] basepython=python2.6 deps= {distshare}/py-* pexpect -#[testenv:py26-py132] -#basepython=python2.6 -#deps= py==1.3.2 -# execnet==1.0.6 -[testenv:py25] -basepython=python2.5 -[testenv:py24] -basepython=python2.4 -[testenv:py31] -basepython=python3.1 -#[testenv:pypy] -#basepython=pypy-c -[testenv:jython] -basepython=jython From commits-noreply at bitbucket.org Thu Jul 15 12:13:37 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 15 Jul 2010 10:13:37 +0000 (UTC) Subject: [py-svn] pytest-codecheckers commit c63af42df1d3: add tox Message-ID: <20100715101337.1550647822@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-codecheckers # URL http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/overview # User Ronny Pfannschmidt # Date 1279188387 -7200 # Node ID c63af42df1d36fb346ef27394ecc069b381b45fb # Parent 6309ddd6bf429cc2eb685a777fd8242c34825ed1 add tox --- a/.hgignore +++ b/.hgignore @@ -2,3 +2,4 @@ build dist .*\.pyc +\.tox --- /dev/null +++ b/tox.ini @@ -0,0 +1,9 @@ +[testenv] +deps= + py + pyflakes + pep8 +commands = + py.test \ + --junitxml={envlogdir}/junit-{envname}.xml \ + [] From commits-noreply at bitbucket.org Thu Jul 15 12:13:37 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 15 Jul 2010 10:13:37 +0000 (UTC) Subject: [py-svn] pytest-codecheckers commit 11135779ba59: make the self-test codechecker list changable Message-ID: <20100715101337.6ADEF47828@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-codecheckers # URL http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/overview # User Ronny Pfannschmidt # Date 1279188803 -7200 # Node ID 11135779ba59baf05572370df71f0db05ce4a271 # Parent 5165ec2a67c27c58a344bc9ca431845c695efa07 make the self-test codechecker list changable --- a/conftest.py +++ b/conftest.py @@ -1,1 +1,1 @@ -option_codecheck = 'pep8', 'pyflakes' +option_codecheck = ['pep8', 'pyflakes'] From commits-noreply at bitbucket.org Thu Jul 15 12:13:37 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 15 Jul 2010 10:13:37 +0000 (UTC) Subject: [py-svn] pytest-codecheckers commit 5165ec2a67c2: made code-checking a opt-in via the codecheck option Message-ID: <20100715101337.3FB2047826@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-codecheckers # URL http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/overview # User Ronny Pfannschmidt # Date 1279188625 -7200 # Node ID 5165ec2a67c27c58a344bc9ca431845c695efa07 # Parent c63af42df1d36fb346ef27394ecc069b381b45fb made code-checking a opt-in via the codecheck option --- a/codecheckers/plugin.py +++ b/codecheckers/plugin.py @@ -36,11 +36,15 @@ class PyCheckerCollector(py.test.collect self.name += '[code-check]' def collect(self): + checkers = py.test.config.getvalue('codecheck') entrypoints = pkg_resources.iter_entry_points('codechecker') - return [PyCodeCheckItem(ep, self) for ep in entrypoints] + return [PyCodeCheckItem(ep, self) for ep in entrypoints if ep.name in checkers] def pytest_collect_file(path, parent): if path.ext == '.py': return PyCheckerCollector(path, parent) + +def pytest_addoption(parser): + parser.addoption('--codecheck', action='append', default=[]) --- /dev/null +++ b/conftest.py @@ -0,0 +1,1 @@ +option_codecheck = 'pep8', 'pyflakes' --- a/tests/test_pyflakes.py +++ b/tests/test_pyflakes.py @@ -7,7 +7,7 @@ def test_pyflakes_finds_name_error(testd ''') #XXX: bad hack cause i fail to disable the pep8 checker f.write(f.read() + '\n') - out = testdir.runpytest('--tb=short', '-k', 'flakes', '-v') + out = testdir.runpytest('--tb=short', '--codecheck=pyflakes', '-k', 'flakes', '-v') out.stdout.fnmatch_lines([ '*abc*', '*1 failed*', @@ -19,7 +19,7 @@ def test_reportinfo_verbose(testdir): pass ''') f.write(f.read() + '\n') - out = testdir.runpytest('-v') + out = testdir.runpytest('-v', '--codecheck=pyflakes') out.stdout.fnmatch_lines([ '*test_reportinfo_verbose.py: codecheck pyflakes PASS', ]) From commits-noreply at bitbucket.org Thu Jul 15 12:37:45 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 15 Jul 2010 10:37:45 +0000 (UTC) Subject: [py-svn] pytest-codecheckers commit 8bc5808df9f7: use hgdistver Message-ID: <20100715103745.DC94E7F89D@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-codecheckers # URL http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/overview # User Ronny Pfannschmidt # Date 1279190254 -7200 # Node ID 8bc5808df9f7f045daeb42cb8dc0773fd41dd718 # Parent 11135779ba59baf05572370df71f0db05ce4a271 use hgdistver --- a/setup.py +++ b/setup.py @@ -14,12 +14,12 @@ further questions please send them to th .. _`pytest-dev`: http://codespeak.net/mailman/listinfo/py-dev """ from setuptools import setup - +from hgdistver import get_version setup( name='pytest-codecheckers', description='pytest plugin to add source code sanity checks (pep8 and friends)', long_description=__doc__, - version='0.2', + version=get_version(), author='Ronny Pfannschmidt', author_email='Ronny.Pfannschmidt at gmx.de', url='http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/', --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,1 @@ +include hgdistver.py --- /dev/null +++ b/hgdistver.py @@ -0,0 +1,124 @@ +import os +import commands +import subprocess + +def version_from_cachefile(cachefile=None): + if not cachefile: + return + #replaces 'with open()' from py2.6 + fd = open(cachefile) + fd.readline() # remove the comment + version = None + try: + line = fd.readline() + version_string = line.split(' = ')[1].strip() + version = version_string[1:-1].decode('string-escape') + except: # any error means invalid cachefile + pass + fd.close() + return version + +def version_from_hg_id(cachefile=None): + """stolen logic from mercurials setup.py as well""" + if os.path.isdir('.hg'): + l = commands.getoutput('hg id -i -t').strip().split() + while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags + l.pop() + if len(l) > 1: # tag found + version = l[-1] + if l[0].endswith('+'): # propagate the dirty status to the tag + version += '+' + return version + +def version_from_hg15_parents(cachefile=None): + if os.path.isdir('.hg'): + hgver = commands.getoutput('python -c "import mercurial.__version__;print mercurial.__version__.version"') + if hgver < 1.5: + return version_from_hg_log_with_tags() + node = commands.getoutput('hg id -i') + if node == '000000000000+': + return '0.0.dev0-' + node + + cmd = 'hg parents --template "{latesttag} {latesttagdistance}"' + out = commands.getoutput(cmd) + try: + tag, dist = out.split() + if tag=='null': + tag = '0.0' + return '%s.dev%s-%s' % (tag, dist, node) + except ValueError: + pass # unpacking failed, old hg + +def version_from_hg_log_with_tags(cachefile=None): + if os.path.isdir('.hg'): + node = commands.getoutput('hg id -i') + cmd = r'hg log -r %s:0 --template "{tags}\n"' + cmd = cmd % node.rstrip('+') + proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) + dist = -1 # no revs vs one rev is tricky + + for dist, line in enumerate(proc.stdout): + tags = [t for t in line.split() if not t.isalpha()] + if tags: + return '%s.dev%s-%s' % (tags[0], dist, node) + + return '0.0.dev%s-%s' % (dist+1, node) + +def _archival_to_version(data): + """stolen logic from mercurials setup.py""" + if 'tag' in data: + return data['tag'] + elif 'latesttag' in data: + return '%(latesttag)s.dev%(latesttagdistance)s-%(node).12s' % data + else: + return data.get('node', '')[:12] + +def _data_from_archival(path): + import email + data = email.message_from_file(open(str(path))) + return dict(data.items()) + +def version_from_archival(cachefile=None): + #XXX: asumes cwd is repo root + if os.path.exists('.hg_archival.txt'): + data = _data_from_archival('.hg_archival.txt') + return _archival_to_version(data) + +def version_from_sdist_pkginfo(cachefile=None): + if cachefile is None and os.path.exists('PKG-INFO'): + data = _data_from_archival('PKG-INFO') + version = data.get('Version') + if version != 'UNKNOWN': + return version + +def write_cachefile(path, version): + fd = open(path, 'w') + try: + fd.write('# this file is autogenerated by hgdistver + setup.py\n') + fd.write('version = %r' % version) + finally: + fd.close() + + +methods = [ + version_from_hg_id, + version_from_hg15_parents, + version_from_hg_log_with_tags, + version_from_archival, + version_from_cachefile, + version_from_sdist_pkginfo, +] + +def get_version(cachefile=None): + try: + version = None + for method in methods: + version = method(cachefile=cachefile) + if version: + if version.endswith('+'): + import time + version += time.strftime('%Y%m%d') + return version + finally: + if cachefile and version: + write_cachefile(cachefile, version) From commits-noreply at bitbucket.org Thu Jul 15 12:45:40 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 15 Jul 2010 10:45:40 +0000 (UTC) Subject: [py-svn] pytest-codecheckers commit e405fd961f23: update hgdistver to the pep8-silent one Message-ID: <20100715104540.2D3C04781D@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project pytest-codecheckers # URL http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/overview # User Ronny Pfannschmidt # Date 1279190731 -7200 # Node ID e405fd961f231dfc10d029d49ac531c48e1083ac # Parent 8bc5808df9f7f045daeb42cb8dc0773fd41dd718 update hgdistver to the pep8-silent one --- a/hgdistver.py +++ b/hgdistver.py @@ -2,37 +2,44 @@ import os import commands import subprocess + def version_from_cachefile(cachefile=None): if not cachefile: return #replaces 'with open()' from py2.6 fd = open(cachefile) - fd.readline() # remove the comment + fd.readline() # remove the comment version = None try: line = fd.readline() version_string = line.split(' = ')[1].strip() version = version_string[1:-1].decode('string-escape') - except: # any error means invalid cachefile + except: # any error means invalid cachefile pass fd.close() return version + def version_from_hg_id(cachefile=None): """stolen logic from mercurials setup.py as well""" if os.path.isdir('.hg'): l = commands.getoutput('hg id -i -t').strip().split() - while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags + while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags l.pop() - if len(l) > 1: # tag found + if len(l) > 1: # tag found version = l[-1] - if l[0].endswith('+'): # propagate the dirty status to the tag + if l[0].endswith('+'): # propagate the dirty status to the tag version += '+' return version + def version_from_hg15_parents(cachefile=None): if os.path.isdir('.hg'): - hgver = commands.getoutput('python -c "import mercurial.__version__;print mercurial.__version__.version"') + hgver = commands.getoutput( + 'python -c ' + '"import mercurial.__version__;' + 'print mercurial.__version__.version"') + if hgver < 1.5: return version_from_hg_log_with_tags() node = commands.getoutput('hg id -i') @@ -43,11 +50,12 @@ def version_from_hg15_parents(cachefile= out = commands.getoutput(cmd) try: tag, dist = out.split() - if tag=='null': + if tag == 'null': tag = '0.0' return '%s.dev%s-%s' % (tag, dist, node) except ValueError: - pass # unpacking failed, old hg + pass # unpacking failed, old hg + def version_from_hg_log_with_tags(cachefile=None): if os.path.isdir('.hg'): @@ -55,14 +63,15 @@ def version_from_hg_log_with_tags(cachef cmd = r'hg log -r %s:0 --template "{tags}\n"' cmd = cmd % node.rstrip('+') proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) - dist = -1 # no revs vs one rev is tricky + dist = -1 # no revs vs one rev is tricky for dist, line in enumerate(proc.stdout): tags = [t for t in line.split() if not t.isalpha()] if tags: return '%s.dev%s-%s' % (tags[0], dist, node) - return '0.0.dev%s-%s' % (dist+1, node) + return '0.0.dev%s-%s' % (dist + 1, node) + def _archival_to_version(data): """stolen logic from mercurials setup.py""" @@ -73,17 +82,20 @@ def _archival_to_version(data): else: return data.get('node', '')[:12] + def _data_from_archival(path): import email data = email.message_from_file(open(str(path))) return dict(data.items()) + def version_from_archival(cachefile=None): #XXX: asumes cwd is repo root if os.path.exists('.hg_archival.txt'): data = _data_from_archival('.hg_archival.txt') return _archival_to_version(data) + def version_from_sdist_pkginfo(cachefile=None): if cachefile is None and os.path.exists('PKG-INFO'): data = _data_from_archival('PKG-INFO') @@ -91,6 +103,7 @@ def version_from_sdist_pkginfo(cachefile if version != 'UNKNOWN': return version + def write_cachefile(path, version): fd = open(path, 'w') try: @@ -109,6 +122,7 @@ methods = [ version_from_sdist_pkginfo, ] + def get_version(cachefile=None): try: version = None From commits-noreply at bitbucket.org Mon Jul 26 13:17:47 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 26 Jul 2010 11:17:47 +0000 (UTC) Subject: [py-svn] py-trunk commit d70d85a54bb0: updating some feature descriptions Message-ID: <20100726111747.7BA9F5D5FA@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1278612819 -7200 # Node ID d70d85a54bb0c3965b2f6c3071e213af83bf0aa0 # Parent 9a17cd126ba186bda5fdf01fc1bd58f8e58ab75e updating some feature descriptions --- a/doc/test/features.txt +++ b/doc/test/features.txt @@ -82,7 +82,7 @@ filename are inspected for finding tests * classes with a leading ``Test`` name and ``test`` prefixed methods. * ``unittest.TestCase`` subclasses -parametrizing test functions and advanced functional testing +parametrizing test functions and functional testing -------------------------------------------------------------- py.test offers the unique `funcargs mechanism`_ for setting up @@ -177,32 +177,32 @@ test functions. You can modify tracebac command line. Using the `--pdb`` option you can automatically activate a PDB `Python debugger`_ when a test fails. -advanced skipping of tests +skip or expect-to-fail a test ====================================== -py.test has `advanced support for skipping tests`_ or expecting -failures on tests on certain platforms. Apart from the -minimal py.test style also unittest- and nose-style tests -can make use of this feature. +py.test has a dedicated `skipping plugin`_ that allows to define -.. _`advanced support for skipping tests`: plugin/skipping.html +* define "skip" outcomes indicating a platform or a + dependency mismatch. + +* "xfail" outcomes indicating an "expected failure" either with + with or without running a test. + +* skip and xfail outcomes can be applied at module, class or method + level or even only for certain argument sets of a parametrized function. + +.. _`skipping plugin`: plugin/skipping.html .. _`funcargs mechanism`: funcargs.html .. _`unittest.py`: http://docs.python.org/library/unittest.html .. _`doctest.py`: http://docs.python.org/library/doctest.html .. _`xUnit style setup`: xunit_setup.html .. _`pytest_nose`: plugin/nose.html -advanced test selection and running modes +select tests by keyword / test name search ========================================================= .. _`selection by keyword`: -``py.test --looponfailing`` (implemented through the external -`pytest-xdist`_ plugin) allows to run a test suite, -memorize all failures and then loop over the failing set -of tests until they all pass. It will re-start running -the tests when it detects file changes in your project. - You can selectively run tests by specifiying a keyword on the command line. Examples:: @@ -236,6 +236,15 @@ plugin for more information. .. _`pytest_keyword`: plugin/mark.html +Looping on the failing test set +======================================= + +``py.test --looponfailing`` (implemented through the external +`pytest-xdist`_ plugin) allows to run a test suite, +memorize all failures and then loop over the failing set +of tests until they all pass. It will re-start running +the tests when it detects file changes in your project. + .. _`reStructured Text`: http://docutils.sourceforge.net .. _`Python debugger`: http://docs.python.org/lib/module-pdb.html From commits-noreply at bitbucket.org Mon Jul 26 13:17:47 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 26 Jul 2010 11:17:47 +0000 (UTC) Subject: [py-svn] py-trunk commit 4e54c87c5139: fix terminal dimension detection to work with stdout Message-ID: <20100726111747.9F9DB5D5FD@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280142790 -7200 # Node ID 4e54c87c51398260acd559ce8aabf2183ed79552 # Parent d70d85a54bb0c3965b2f6c3071e213af83bf0aa0 fix terminal dimension detection to work with stdout --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def main(): name='py', description='py.test and pylib: rapid testing and development utils.', long_description = long_description, - version= '1.3.2', + version= '1.3.3a1', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ dictionary or an import path. (c) Holger Krekel and others, 2004-2010 """ -__version__ = version = "1.3.2" +__version__ = version = "1.3.3a1" import py.apipkg --- a/testing/io_/test_terminalwriter.py +++ b/testing/io_/test_terminalwriter.py @@ -6,6 +6,18 @@ def test_get_terminal_width(): x = py.io.get_terminal_width assert x == terminalwriter.get_terminal_width +def test_getdimensions(monkeypatch): + fcntl = py.test.importorskip("fcntl") + import struct + l = [] + monkeypatch.setattr(fcntl, 'ioctl', lambda *args: l.append(args)) + try: + terminalwriter._getdimensions() + except struct.error: + pass + assert len(l) == 1 + assert l[0][0] == 1 + def test_terminal_width_COLUMNS(monkeypatch): """ Dummy test for get_terminal_width """ --- a/py/_io/terminalwriter.py +++ b/py/_io/terminalwriter.py @@ -18,7 +18,7 @@ if sys.platform == "win32": def _getdimensions(): import termios,fcntl,struct - call = fcntl.ioctl(0,termios.TIOCGWINSZ,"\000"*8) + call = fcntl.ioctl(1,termios.TIOCGWINSZ,"\000"*8) height,width = struct.unpack( "hhhh", call ) [:2] return height, width --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +Changes between 1.3.2 and 1.3.3a1 +================================================== + +- fix weirdness: make terminal width detection work on stdout instead of stdin + (thanks Armin Ronacher for reporting) + Changes between 1.3.1 and 1.3.2 ================================================== From commits-noreply at bitbucket.org Mon Jul 26 13:35:23 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 26 Jul 2010 11:35:23 +0000 (UTC) Subject: [py-svn] py-trunk commit 6813b0f3f027: fix test on python2.4 Message-ID: <20100726113523.A315A47828@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280144099 -7200 # Node ID 6813b0f3f027f448e3487f0e77cba4fccd78aa6a # Parent 4e54c87c51398260acd559ce8aabf2183ed79552 fix test on python2.4 --- a/testing/io_/test_terminalwriter.py +++ b/testing/io_/test_terminalwriter.py @@ -13,7 +13,7 @@ def test_getdimensions(monkeypatch): monkeypatch.setattr(fcntl, 'ioctl', lambda *args: l.append(args)) try: terminalwriter._getdimensions() - except struct.error: + except (TypeError, struct.error): pass assert len(l) == 1 assert l[0][0] == 1 From commits-noreply at bitbucket.org Mon Jul 26 21:01:41 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 26 Jul 2010 19:01:41 +0000 (UTC) Subject: [py-svn] py-trunk commit e432a1afda60: update issues Message-ID: <20100726190141.9446B5D5F5@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280170474 -3600 # Node ID e432a1afda60a6db5e8e7c33112d4fa62fcd3e48 # Parent 6813b0f3f027f448e3487f0e77cba4fccd78aa6a update issues --- a/ISSUES.txt +++ b/ISSUES.txt @@ -12,14 +12,61 @@ the session collect logic to care for th Apart from simplification a side effect the dsession's session and the core session probably converge some more. -introduce py.test.mark.nocollect +do early-teardown of test modules +----------------------------------------- +tags: feature 1.3 + +currently teardowns are called when the next tests is setup +except for the function/method level where interally +"teardown_exact" tears down immediately. Generalize +this to perform the "neccessary" teardown compared to +the "next" test item during teardown - this should +get rid of some irritations because otherwise e.g. +prints of teardown-code appear in the setup of the next test. + +consider and document __init__ file usage in test directories +--------------------------------------------------------------- +tags: bug 1.4 core + +Currently, a test module is imported with its fully qualified +package path, determined by checking __init__ files upwards. +This has the side effect that a source package at the root +of the test dir could be imported as well. This is somewhat +convenient but complicates the picture for running tests against +different versions of a package. Also, implicit sys.path +manipulations are problematic per-se. Maybe factorting out +a pytest_addsyspath hook which can be disabled from the command line +makes sense. In any case documentation/recommendations for +certain scenarios makes sense. + +relax requirement to have tests/testing contain an __init__ +---------------------------------------------------------------- +tags: feature 1.4 +bb: http://bitbucket.org/hpk42/py-trunk/issue/64 + +A local test run of a "tests" directory may work +but a remote one fail because the tests directory +does not contain an "__init__.py". Either give +an error or make it work without the __init__.py +i.e. port the nose-logic of unloading a test module. + +customize test function collection ------------------------------------------------------- tags: feature 1.4 -for not considering a function for test collection at all. -maybe also introduce a py.test.mark.test to explicitely -mark a function to become a tested one. Lookup JUnit -ways of tagging tests. +- introduce py.test.mark.nocollect for not considering a function for + test collection at all. maybe also introduce a py.test.mark.test to + explicitely mark a function to become a tested one. Lookup JUnit ways + of tagging tests. + +- allow an easy way to customize "test_", "Test" prefixes for file paths + and test function/class names. the current customizable Item requires + too much code/concepts to influence this collection matching. + maybe introduce pytest_pycollect_filters = { + 'file': 'test*.py', + 'function': 'test*', + 'class': 'Test*', + } introduce py.test.mark.platform ------------------------------------------------------- @@ -40,43 +87,60 @@ interpreter versions. introduce py.test.mark registration ----------------------------------------- -tags: feature 1.3 +tags: feature 1.4 introduce a hook that allows to register a named mark decorator with documentation and add "py.test --marks" to get a list of available marks. Deprecate "dynamic" mark definitions. -do early-teardown of test modules +allow to non-intrusively apply skipfs/xfail/marks +--------------------------------------------------- +tags: feature 1.4 + +use case: mark a module or directory structures +to be skipped on certain platforms (i.e. no import +attempt will be made). + +consider introducing a hook/mechanism that allows to apply marks +from conftests or plugins. + +explicit referencing of conftest.py files ----------------------------------------- -tags: feature 1.3 +tags: feature 1.4 -currently teardowns are called when the next tests is setup -except for the function/method level where interally -"teardown_exact" tears down immediately. Generalize -this to perform the "neccessary" teardown compared to -the "next" test item during teardown - this should -get rid of some irritations because otherwise e.g. -prints of teardown-code appear in the setup of the next test. +allow to name conftest.py files (in sub directories) that should +be imported early, as to include command line options. -do recursive walk of conftest.py files? ------------------------------------------ -tags: feature 1.3 +a central py.test ini/yml file +---------------------------------- +tags: feature 1.4 -it maybe makes sense to generally do a recursive search of conftest.py -files before command line parsing - this would help to offer the -full list of options as applicable to a given test project. +introduce a declarative configuration file that allows: +- default options +- to-be-collected test directories +- required plugins +- test func/class/file matching patterns +- skip/xfail (non-intrusive) +- pytest.ini and tox.ini and setup.cfg configuration in the same file -consider introducing py.test.mark.skip_[not]win32/jython/pyXY -------------------------------------------------------------- -tags: feature 1.3 +new documentation +---------------------------------- +tags: feature 1.4 -conveniently introduce markers for platforms to -have a shorter form for skipping. +- logo py.test +- reference / customization +- writing a (local or global) plugin +- examples for unittest or functional testing +- resource management for functional testing +- patterns: page object +- parametrized testing +- better / more integrated plugin docs + i.e. not per-plugin but per-feature referencing a plugin generalize parametrized testing to generate combinations ------------------------------------------------------------- -tags: feature 1.3 +tags: feature 1.4 think about extending metafunc.addcall or add a new method to allow to generate tests with combinations of all generated versions - what to do @@ -124,7 +188,7 @@ to further reduce py.test globality. Al having py.test.config and ensuretemp coming from a plugin rather than being there from the start. -consider allowing funcargs to setup methods +consider allowing funcargs for setup methods -------------------------------------------------------------- tags: experimental-wish 1.4 @@ -136,6 +200,10 @@ factories with a request object that not attributes. However, how to handle parametrized test functions and funcargs? +setup_function -> request can be like it is now +setup_class -> request has no request.function +setup_module -> request has no request.cls + consider pytest_addsyspath hook ----------------------------------------- tags: 1.4 @@ -147,16 +215,6 @@ in order to more easily run against inst Alternatively it could also be done via the config object and pytest_configure. -relax requirement to have tests/testing contain an __init__ ----------------------------------------------------------------- -tags: feature 1.4 -bb: http://bitbucket.org/hpk42/py-trunk/issue/64 - -A local test run of a "tests" directory may work -but a remote one fail because the tests directory -does not contain an "__init__.py". Either give -an error or make it work without the __init__.py - show plugin information in test header ---------------------------------------------------------------- @@ -166,15 +224,6 @@ Now that external plugins are becoming m it would be useful to have external plugins along with their versions displayed as a header line. -generate/refine plugin doc generation ----------------------------------------------------------------- -tags: feature 1.4 - -review and prepare docs for 1.4.0 release. Probably -have docs living with the plugin and require them to -be available on doc generation time, at least when -the target is the website? Or rather go for interactive help? - deprecate global py.test.config usage ---------------------------------------------------------------- tags: feature 1.4 From commits-noreply at bitbucket.org Mon Jul 26 21:20:28 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 26 Jul 2010 19:20:28 +0000 (UTC) Subject: [py-svn] py-trunk commit ad5a1184cfc9: remove trailing whitespace everywhere Message-ID: <20100726192028.BD0E45D5FD@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280171715 -7200 # Node ID ad5a1184cfc919e720d56ac8cacf10da7ea72c3b # Parent e432a1afda60a6db5e8e7c33112d4fa62fcd3e48 remove trailing whitespace everywhere --- a/ISSUES.txt +++ b/ISSUES.txt @@ -1,78 +1,78 @@ -refine session initialization / fix custom collect crash +refine session initialization / fix custom collect crash --------------------------------------------------------------- -tags: bug 1.4 core xdist +tags: bug 1.4 core xdist -When calling "py.test path/X" py.test can crash if the collection +When calling "py.test path/X" py.test can crash if the collection of that directory is skipped. Calling "py.test path" will give -proper output. The reason is that for the very first colitems -getinitialnodes() and a collection is done before the fully -controlled session and pytest_make_collect_report protocol takes over. +proper output. The reason is that for the very first colitems +getinitialnodes() and a collection is done before the fully +controlled session and pytest_make_collect_report protocol takes over. Try to remove the redundant getinitialnodes related logic and amend -the session collect logic to care for this "initial" case as well. +the session collect logic to care for this "initial" case as well. Apart from simplification a side effect the dsession's session -and the core session probably converge some more. +and the core session probably converge some more. -do early-teardown of test modules +do early-teardown of test modules ----------------------------------------- tags: feature 1.3 currently teardowns are called when the next tests is setup -except for the function/method level where interally +except for the function/method level where interally "teardown_exact" tears down immediately. Generalize this to perform the "neccessary" teardown compared to the "next" test item during teardown - this should -get rid of some irritations because otherwise e.g. -prints of teardown-code appear in the setup of the next test. +get rid of some irritations because otherwise e.g. +prints of teardown-code appear in the setup of the next test. consider and document __init__ file usage in test directories --------------------------------------------------------------- -tags: bug 1.4 core +tags: bug 1.4 core Currently, a test module is imported with its fully qualified -package path, determined by checking __init__ files upwards. -This has the side effect that a source package at the root +package path, determined by checking __init__ files upwards. +This has the side effect that a source package at the root of the test dir could be imported as well. This is somewhat convenient but complicates the picture for running tests against -different versions of a package. Also, implicit sys.path +different versions of a package. Also, implicit sys.path manipulations are problematic per-se. Maybe factorting out a pytest_addsyspath hook which can be disabled from the command line -makes sense. In any case documentation/recommendations for -certain scenarios makes sense. +makes sense. In any case documentation/recommendations for +certain scenarios makes sense. relax requirement to have tests/testing contain an __init__ ---------------------------------------------------------------- tags: feature 1.4 bb: http://bitbucket.org/hpk42/py-trunk/issue/64 -A local test run of a "tests" directory may work +A local test run of a "tests" directory may work but a remote one fail because the tests directory does not contain an "__init__.py". Either give an error or make it work without the __init__.py -i.e. port the nose-logic of unloading a test module. +i.e. port the nose-logic of unloading a test module. -customize test function collection +customize test function collection ------------------------------------------------------- tags: feature 1.4 - introduce py.test.mark.nocollect for not considering a function for test collection at all. maybe also introduce a py.test.mark.test to explicitely mark a function to become a tested one. Lookup JUnit ways - of tagging tests. + of tagging tests. - allow an easy way to customize "test_", "Test" prefixes for file paths and test function/class names. the current customizable Item requires - too much code/concepts to influence this collection matching. + too much code/concepts to influence this collection matching. maybe introduce pytest_pycollect_filters = { - 'file': 'test*.py', - 'function': 'test*', - 'class': 'Test*', + 'file': 'test*.py', + 'function': 'test*', + 'class': 'Test*', } -introduce py.test.mark.platform +introduce py.test.mark.platform ------------------------------------------------------- tags: feature 1.4 -Introduce nice-to-spell platform-skipping, examples: +Introduce nice-to-spell platform-skipping, examples: @py.test.mark.platform("python3") @py.test.mark.platform("not python3") @@ -82,8 +82,8 @@ Introduce nice-to-spell platform-skippin @py.test.mark.platform("not (jython and win32)", xfail=True) etc. Idea is to allow Python expressions which can operate -on common spellings for operating systems and python -interpreter versions. +on common spellings for operating systems and python +interpreter versions. introduce py.test.mark registration ----------------------------------------- @@ -92,73 +92,73 @@ tags: feature 1.4 introduce a hook that allows to register a named mark decorator with documentation and add "py.test --marks" to get a list of available marks. Deprecate "dynamic" mark -definitions. +definitions. -allow to non-intrusively apply skipfs/xfail/marks +allow to non-intrusively apply skipfs/xfail/marks --------------------------------------------------- tags: feature 1.4 -use case: mark a module or directory structures -to be skipped on certain platforms (i.e. no import -attempt will be made). +use case: mark a module or directory structures +to be skipped on certain platforms (i.e. no import +attempt will be made). -consider introducing a hook/mechanism that allows to apply marks -from conftests or plugins. +consider introducing a hook/mechanism that allows to apply marks +from conftests or plugins. -explicit referencing of conftest.py files +explicit referencing of conftest.py files ----------------------------------------- tags: feature 1.4 -allow to name conftest.py files (in sub directories) that should -be imported early, as to include command line options. +allow to name conftest.py files (in sub directories) that should +be imported early, as to include command line options. -a central py.test ini/yml file +a central py.test ini/yml file ---------------------------------- tags: feature 1.4 introduce a declarative configuration file that allows: -- default options -- to-be-collected test directories +- default options +- to-be-collected test directories - required plugins -- test func/class/file matching patterns -- skip/xfail (non-intrusive) -- pytest.ini and tox.ini and setup.cfg configuration in the same file +- test func/class/file matching patterns +- skip/xfail (non-intrusive) +- pytest.ini and tox.ini and setup.cfg configuration in the same file -new documentation +new documentation ---------------------------------- tags: feature 1.4 -- logo py.test -- reference / customization +- logo py.test +- reference / customization - writing a (local or global) plugin -- examples for unittest or functional testing -- resource management for functional testing -- patterns: page object -- parametrized testing -- better / more integrated plugin docs +- examples for unittest or functional testing +- resource management for functional testing +- patterns: page object +- parametrized testing +- better / more integrated plugin docs i.e. not per-plugin but per-feature referencing a plugin generalize parametrized testing to generate combinations ------------------------------------------------------------- -tags: feature 1.4 +tags: feature 1.4 think about extending metafunc.addcall or add a new method to allow to generate tests with combinations of all generated versions - what to do -about "id" and "param" in such combinations though? +about "id" and "param" in such combinations though? -introduce py.test.mark.multi +introduce py.test.mark.multi ----------------------------------------- tags: feature 1.3 introduce py.test.mark.multi to specify a number -of values for a given function argument. +of values for a given function argument. have imported module mismatch honour relative paths -------------------------------------------------------- tags: bug 1.4 -With 1.1.1 py.test fails at least on windows if an import -is relative and compared against an absolute conftest.py +With 1.1.1 py.test fails at least on windows if an import +is relative and compared against an absolute conftest.py path. Normalize. make node._checkcollectable more robust @@ -167,8 +167,8 @@ tags: bug 1.4 currently node._checkcollectable() can raise exceptions for all kinds of reasons ('conftest.py' loading -problems, missing rsync-dirs, platform-skip-at-import-level -issues, ...). It should just return True/False and cause +problems, missing rsync-dirs, platform-skip-at-import-level +issues, ...). It should just return True/False and cause a good error message. call termination with small timeout @@ -176,15 +176,15 @@ call termination with small timeout tags: feature 1.4 test: testing/pytest/dist/test_dsession.py - test_terminate_on_hanging_node -Call gateway group termination with a small timeout if available. +Call gateway group termination with a small timeout if available. Should make dist-testing less likely to leave lost processes. -consider globals: py.test.ensuretemp and config +consider globals: py.test.ensuretemp and config -------------------------------------------------------------- tags: experimental-wish 1.4 -consider deprecating py.test.ensuretemp and py.test.config -to further reduce py.test globality. Also consider +consider deprecating py.test.ensuretemp and py.test.config +to further reduce py.test globality. Also consider having py.test.config and ensuretemp coming from a plugin rather than being there from the start. @@ -192,16 +192,16 @@ consider allowing funcargs for setup met -------------------------------------------------------------- tags: experimental-wish 1.4 -Users have expressed the wish to have funcargs available to setup +Users have expressed the wish to have funcargs available to setup functions. Experiment with allowing funcargs there - it might also help to make the py.test.ensuretemp and config deprecation. -For filling funcargs for setup methods, we could call funcarg -factories with a request object that not have a cls/function +For filling funcargs for setup methods, we could call funcarg +factories with a request object that not have a cls/function attributes. However, how to handle parametrized test functions -and funcargs? +and funcargs? setup_function -> request can be like it is now -setup_class -> request has no request.function +setup_class -> request has no request.function setup_module -> request has no request.cls consider pytest_addsyspath hook @@ -210,31 +210,31 @@ tags: 1.4 py.test could call a new pytest_addsyspath() in order to systematically allow manipulation of sys.path and to inhibit it via --no-addsyspath -in order to more easily run against installed packages. +in order to more easily run against installed packages. -Alternatively it could also be done via the config object -and pytest_configure. +Alternatively it could also be done via the config object +and pytest_configure. -show plugin information in test header +show plugin information in test header ---------------------------------------------------------------- tags: feature 1.4 -Now that external plugins are becoming more numerous +Now that external plugins are becoming more numerous it would be useful to have external plugins along with -their versions displayed as a header line. +their versions displayed as a header line. -deprecate global py.test.config usage +deprecate global py.test.config usage ---------------------------------------------------------------- tags: feature 1.4 -py.test.ensuretemp and py.test.config are probably the last -objects containing global state. Often using them is not -neccessary. This is about trying to get rid of them, i.e. -deprecating them and checking with PyPy's usages as well -as others. +py.test.ensuretemp and py.test.config are probably the last +objects containing global state. Often using them is not +neccessary. This is about trying to get rid of them, i.e. +deprecating them and checking with PyPy's usages as well +as others. -remove deprecated bits in collect.py +remove deprecated bits in collect.py ------------------------------------------------------------------- tags: feature 1.4 --- a/doc/example/genxml.py +++ b/doc/example/genxml.py @@ -1,16 +1,16 @@ -import py -class ns(py.xml.Namespace): - pass +import py +class ns(py.xml.Namespace): + pass doc = ns.books( ns.book( - ns.author("May Day"), - ns.title("python for java programmers"),), - ns.book( - ns.author("why", class_="somecssclass"), + ns.author("May Day"), + ns.title("python for java programmers"),), + ns.book( + ns.author("why", class_="somecssclass"), ns.title("Java for Python programmers"),), - publisher="N.N", + publisher="N.N", ) print doc.unicode(indent=2).encode('utf8') --- a/doc/example/funcarg/mysetup2/test_sample.py +++ b/doc/example/funcarg/mysetup2/test_sample.py @@ -1,5 +1,5 @@ -def test_answer(mysetup): +def test_answer(mysetup): app = mysetup.myapp() answer = app.question() assert answer == 42 --- a/doc/announce/release-1.0.0.txt +++ b/doc/announce/release-1.0.0.txt @@ -9,47 +9,47 @@ many new advanced automated testing feat * funcargs_ - pythonic zero-boilerplate fixtures for Python test functions : - - totally separates test code, test configuration and test setup + - totally separates test code, test configuration and test setup - ideal for integration and functional tests - allows for flexible and natural test parametrization schemes -* new `plugin architecture`_, allowing easy-to-write project-specific and cross-project single-file plugins. The most notable new external plugin is `oejskit`_ which naturally enables **running and reporting of javascript-unittests in real-life browsers**. +* new `plugin architecture`_, allowing easy-to-write project-specific and cross-project single-file plugins. The most notable new external plugin is `oejskit`_ which naturally enables **running and reporting of javascript-unittests in real-life browsers**. * many new features done in easy-to-improve `default plugins`_, highlights: * xfail: mark tests as "expected to fail" and report separately. - * pastebin: automatically send tracebacks to pocoo paste service + * pastebin: automatically send tracebacks to pocoo paste service * capture: flexibly capture stdout/stderr of subprocesses, per-test ... * monkeypatch: safely monkeypatch modules/classes from within tests - * unittest: run and integrate traditional unittest.py tests + * unittest: run and integrate traditional unittest.py tests * figleaf: generate html coverage reports with the figleaf module - * resultlog: generate buildbot-friendly reporting output + * resultlog: generate buildbot-friendly reporting output * ... -* `distributed testing`_ and `elastic distributed execution`_: +* `distributed testing`_ and `elastic distributed execution`_: - - new unified "TX" URL scheme for specifying remote processes - - new distribution modes "--dist=each" and "--dist=load" - - new sync/async ways to handle 1:N communication - - improved documentation + - new unified "TX" URL scheme for specifying remote processes + - new distribution modes "--dist=each" and "--dist=load" + - new sync/async ways to handle 1:N communication + - improved documentation The py lib continues to offer most of the functionality used by -the testing tool in `independent namespaces`_. +the testing tool in `independent namespaces`_. Some non-test related code, notably greenlets/co-routines and api-generation now live as their own projects which simplifies the -installation procedure because no C-Extensions are required anymore. +installation procedure because no C-Extensions are required anymore. The whole package should work well with Linux, Win32 and OSX, on Python -2.3, 2.4, 2.5 and 2.6. (Expect Python3 compatibility soon!) +2.3, 2.4, 2.5 and 2.6. (Expect Python3 compatibility soon!) -For more info, see the py.test and py lib documentation: +For more info, see the py.test and py lib documentation: http://pytest.org http://pylib.org -have fun, +have fun, holger .. _`independent namespaces`: http://pylib.org @@ -58,6 +58,6 @@ holger .. _`default plugins`: http://codespeak.net/py/dist/test/plugin/index.html .. _`distributed testing`: http://codespeak.net/py/dist/test/dist.html .. _`elastic distributed execution`: http://codespeak.net/py/dist/execnet.html -.. _`1.0.0 py lib release`: http://pypi.python.org/pypi/py +.. _`1.0.0 py lib release`: http://pypi.python.org/pypi/py .. _`oejskit`: http://codespeak.net/py/dist/test/plugin/oejskit.html --- a/doc/announce/release-1.0.2.txt +++ b/doc/announce/release-1.0.2.txt @@ -1,4 +1,4 @@ -1.0.2: packaging fixes +1.0.2: packaging fixes ----------------------------------------------------------------------- this release is purely a release for fixing packaging issues. --- a/doc/example/funcarg/parametrize/test_parametrize2.py +++ b/doc/example/funcarg/parametrize/test_parametrize2.py @@ -13,7 +13,7 @@ def pytest_generate_tests(metafunc): # actual test code - + class TestClass: @params([dict(a=1, b=2), dict(a=3, b=3), dict(a=5, b=4)], ) def test_equals(self, a, b): --- a/doc/bin.txt +++ b/doc/bin.txt @@ -1,11 +1,11 @@ ====================== -pylib scripts +pylib scripts ====================== The pylib installs several scripts to support testing and (python) development. If working from a checkout you may also add ``bin`` to your ``PATH`` environment variable which makes the scripts available on -your shell prompt. +your shell prompt. ``py.test`` and ``py.test-$VERSION`` ============================================ @@ -14,16 +14,16 @@ The ``py.test`` executable is the main t in fact most code in the py lib is geared towards supporting the testing process. See the `py.test documentation`_ for extensive documentation. The ``py.test-$VERSION`` is the same script with -an interpreter specific suffix appended to make +an interpreter specific suffix appended to make several versions of py.test for using specific interpreters accessible: -* CPython2.4: py.test-2.4 +* CPython2.4: py.test-2.4 * CPython2.5: py.test-2.5 -* ... +* ... * CPython3.1: py.test-3.1 * Jython-2.5.1: py.test-jython -* pypy-$SUFFIX: py.test-pypy-$SUFFIX +* pypy-$SUFFIX: py.test-pypy-$SUFFIX .. _`py.test documentation`: test/index.html @@ -33,7 +33,7 @@ accessible: Usage: ``py.which modulename`` Print the ``__file__`` of the module that is imported via ``import modulename``. -The version-suffix is the same as with ``py.test`` above. +The version-suffix is the same as with ``py.test`` above. ``py.cleanup`` ============== --- a/contrib/pytest_resultdb.py +++ b/contrib/pytest_resultdb.py @@ -1,12 +1,12 @@ -"""XXX in progress: resultdb plugin for database logging of test results. +"""XXX in progress: resultdb plugin for database logging of test results. Saves test results to a datastore. XXX this needs to be merged with resultlog plugin -Also mixes in some early ideas about an archive abstraction for test +Also mixes in some early ideas about an archive abstraction for test results. -""" +""" import py py.test.skip("XXX needs to be merged with resultlog") @@ -15,15 +15,15 @@ from pytest_resultlog import ResultLog def pytest_addoption(parser): group = parser.addgroup("resultdb", "resultdb plugin options") - group.addoption('--resultdb', action="store", dest="resultdb", + group.addoption('--resultdb', action="store", dest="resultdb", metavar="path", help="path to the file to store test results.") - group.addoption('--resultdb_format', action="store", + group.addoption('--resultdb_format', action="store", dest="resultdbformat", default='json', help="data format (json, sqlite)") def pytest_configure(config): - # XXX using config.XYZ is not good + # XXX using config.XYZ is not good if config.getvalue('resultdb'): if config.option.resultdb: # local import so missing module won't crash py.test @@ -36,14 +36,14 @@ def pytest_configure(config): except ImportError: raise config.Error('Could not import simplejson module') if config.option.resultdbformat.lower() == 'json': - resultdb = ResultDB(JSONResultArchive, - config.option.resultdb) + resultdb = ResultDB(JSONResultArchive, + config.option.resultdb) elif config.option.resultdbformat.lower() == 'sqlite': - resultdb = ResultDB(SQLiteResultArchive, - config.option.resultdb) + resultdb = ResultDB(SQLiteResultArchive, + config.option.resultdb) else: - raise config.Error('Unknown --resultdb_format: %s' % - config.option.resultdbformat) + raise config.Error('Unknown --resultdb_format: %s' % + config.option.resultdbformat) config.pluginmanager.register(resultdb) @@ -52,7 +52,7 @@ class JSONResultArchive(object): self.archive_path = archive_path import simplejson self.simplejson = simplejson - + def init_db(self): if os.path.exists(self.archive_path): data_file = open(self.archive_path) @@ -84,7 +84,7 @@ class SQLiteResultArchive(object): self.archive_path = archive_path import sqlite3 self.sqlite3 = sqlite3 - + def init_db(self): if not os.path.exists(self.archive_path): conn = self.sqlite3.connect(self.archive_path) @@ -153,7 +153,7 @@ class ResultDB(ResultLog): for item in vars(event).keys(): if item not in event_excludes: data[item] = getattr(event, item) - # use the locally calculated longrepr & shortrepr + # use the locally calculated longrepr & shortrepr data['longrepr'] = longrepr data['shortrepr'] = shortrepr @@ -185,10 +185,10 @@ insert into pytest_results ( longrepr, fspath, itemname) -values (?, ?, ?, ?, ?, ?, ?, ?, ?); +values (?, ?, ?, ?, ?, ?, ?, ?, ?); """ SQL_SELECT_DATA = """ -select +select runid, name, passed, @@ -204,7 +204,7 @@ from pytest_results; # =============================================================================== # -# plugin tests +# plugin tests # # =============================================================================== @@ -214,7 +214,7 @@ class BaseResultArchiveTests(object): cls = None def setup_class(cls): - # XXX refactor setup into a funcarg? + # XXX refactor setup into a funcarg? cls.tempdb = "test_tempdb" def test_init_db(self, testdir): @@ -243,7 +243,7 @@ class BaseResultArchiveTests(object): for key, value in data[0].items(): assert value == result[0][key] assert 'runid' in result[0] - + # make sure the data is persisted tempdb_path = unicode(testdir.tmpdir.join(self.tempdb)) archive = self.cls(tempdb_path) @@ -257,7 +257,7 @@ class TestJSONResultArchive(BaseResultAr def setup_method(self, method): py.test.importorskip("simplejson") - + class TestSQLiteResultArchive(BaseResultArchiveTests): cls = SQLiteResultArchive @@ -270,8 +270,8 @@ class TestSQLiteResultArchive(BaseResult archive = self.cls(tempdb_path) archive.init_db() assert os.path.exists(tempdb_path) - - # is table in the database? + + # is table in the database? import sqlite3 conn = sqlite3.connect(tempdb_path) cursor = conn.cursor() @@ -281,7 +281,7 @@ class TestSQLiteResultArchive(BaseResult cursor.close() conn.close() assert len(tables) == 1 - + def verify_archive_item_shape(item): names = ("runid name passed skipped failed shortrepr " "longrepr fspath itemname").split() @@ -299,14 +299,14 @@ class TestWithFunctionIntegration: archive = SQLiteResultArchive(unicode(resultdb)) archive.init_db() return archive - + def test_collection_report(self, testdir): py.test.skip("Needs a rewrite for db version.") ok = testdir.makepyfile(test_collection_ok="") skip = testdir.makepyfile(test_collection_skip="import py ; py.test.skip('hello')") fail = testdir.makepyfile(test_collection_fail="XXX") - lines = self.getresultdb(testdir, ok) + lines = self.getresultdb(testdir, ok) assert not lines lines = self.getresultdb(testdir, skip) @@ -326,7 +326,7 @@ class TestWithFunctionIntegration: def test_log_test_outcomes(self, testdir): mod = testdir.makepyfile(test_mod=""" - import py + import py def test_pass(): pass def test_skip(): py.test.skip("hello") def test_fail(): raise ValueError("val") @@ -349,7 +349,7 @@ class TestWithFunctionIntegration: raise ValueError except ValueError: excinfo = py.code.ExceptionInfo() - reslog = ResultDB(StringIO.StringIO()) + reslog = ResultDB(StringIO.StringIO()) reslog.pytest_internalerror(excinfo.getrepr) entry = reslog.logfile.getvalue() entry_lines = entry.splitlines() @@ -357,7 +357,7 @@ class TestWithFunctionIntegration: assert entry_lines[0].startswith('! ') assert os.path.basename(__file__)[:-1] in entry_lines[0] #.py/.pyc assert entry_lines[-1][0] == ' ' - assert 'ValueError' in entry + assert 'ValueError' in entry def test_generic(testdir): testdir.makepyfile(""" @@ -371,4 +371,4 @@ def test_generic(testdir): """) testdir.runpytest("--resultdb=result.sqlite") #testdir.tmpdir.join("result.sqlite") - + --- a/doc/announce/release-1.1.0.txt +++ b/doc/announce/release-1.1.0.txt @@ -1,4 +1,4 @@ -py.test/pylib 1.1.0: Python3, Jython, advanced skipping, cleanups ... +py.test/pylib 1.1.0: Python3, Jython, advanced skipping, cleanups ... -------------------------------------------------------------------------------- Features: @@ -10,16 +10,16 @@ Features: Fixes: * code reduction and "de-magification" (e.g. 23 KLoc -> 11 KLOC) -* distribute testing requires the now separately released execnet_ package +* distribute testing requires the now separately released execnet_ package * funcarg-setup/caching, "same-name" test modules now cause an exlicit error -* de-cluttered reporting options, --report for skipped/xfail details +* de-cluttered reporting options, --report for skipped/xfail details Compatibilities -1.1.0 should allow running test code that already worked well with 1.0.2 -plus some more due to improved unittest/nose compatibility. +1.1.0 should allow running test code that already worked well with 1.0.2 +plus some more due to improved unittest/nose compatibility. -More information: http://pytest.org +More information: http://pytest.org thanks and have fun, @@ -36,16 +36,16 @@ Changelog 1.0.2 -> 1.1.0 * remove py.rest tool and internal namespace - it was never really advertised and can still be used with - the old release if needed. If there is interest + the old release if needed. If there is interest it could be revived into its own tool i guess. * fix issue48 and issue59: raise an Error if the module - from an imported test file does not seem to come from + from an imported test file does not seem to come from the filepath - avoids "same-name" confusion that has been reported repeatedly * merged Ronny's nose-compatibility hacks: now - nose-style setup_module() and setup() functions are + nose-style setup_module() and setup() functions are supported * introduce generalized py.test.mark function marking @@ -54,62 +54,62 @@ Changelog 1.0.2 -> 1.1.0 * deprecate parser.addgroup in favour of getgroup which creates option group -* add --report command line option that allows to control showing of skipped/xfailed sections +* add --report command line option that allows to control showing of skipped/xfailed sections -* generalized skipping: a new way to mark python functions with skipif or xfail - at function, class and modules level based on platform or sys-module attributes. +* generalized skipping: a new way to mark python functions with skipif or xfail + at function, class and modules level based on platform or sys-module attributes. * extend py.test.mark decorator to allow for positional args -* introduce and test "py.cleanup -d" to remove empty directories +* introduce and test "py.cleanup -d" to remove empty directories * fix issue #59 - robustify unittest test collection -* make bpython/help interaction work by adding an __all__ attribute +* make bpython/help interaction work by adding an __all__ attribute to ApiModule, cleanup initpkg * use MIT license for pylib, add some contributors * remove py.execnet code and substitute all usages with 'execnet' proper -* fix issue50 - cached_setup now caches more to expectations - for test functions with multiple arguments. +* fix issue50 - cached_setup now caches more to expectations + for test functions with multiple arguments. * merge Jarko's fixes, issue #45 and #46 * add the ability to specify a path for py.lookup to search in -* fix a funcarg cached_setup bug probably only occuring - in distributed testing and "module" scope with teardown. +* fix a funcarg cached_setup bug probably only occuring + in distributed testing and "module" scope with teardown. * many fixes and changes for making the code base python3 compatible, - many thanks to Benjamin Peterson for helping with this. + many thanks to Benjamin Peterson for helping with this. -* consolidate builtins implementation to be compatible with >=2.3, +* consolidate builtins implementation to be compatible with >=2.3, add helpers to ease keeping 2 and 3k compatible code * deprecate py.compat.doctest|subprocess|textwrap|optparse -* deprecate py.magic.autopath, remove py/magic directory +* deprecate py.magic.autopath, remove py/magic directory * move pytest assertion handling to py/code and a pytest_assertion - plugin, add "--no-assert" option, deprecate py.magic namespaces - in favour of (less) py.code ones. + plugin, add "--no-assert" option, deprecate py.magic namespaces + in favour of (less) py.code ones. -* consolidate and cleanup py/code classes and files +* consolidate and cleanup py/code classes and files -* cleanup py/misc, move tests to bin-for-dist +* cleanup py/misc, move tests to bin-for-dist -* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg +* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg -* consolidate py.log implementation, remove old approach. +* consolidate py.log implementation, remove old approach. * introduce py.io.TextIO and py.io.BytesIO for distinguishing between - text/unicode and byte-streams (uses underlying standard lib io.* - if available) + text/unicode and byte-streams (uses underlying standard lib io.* + if available) -* make py.unittest_convert helper script available which converts "unittest.py" +* make py.unittest_convert helper script available which converts "unittest.py" style files into the simpler assert/direct-test-classes py.test/nosetests - style. The script was written by Laura Creighton. - -* simplified internal localpath implementation + style. The script was written by Laura Creighton. + +* simplified internal localpath implementation --- a/doc/example/genhtml.py +++ b/doc/example/genhtml.py @@ -1,10 +1,10 @@ -from py.xml import html +from py.xml import html paras = "First Para", "Second para" doc = html.html( html.head( - html.meta(name="Content-Type", value="text/html; charset=latin1")), + html.meta(name="Content-Type", value="text/html; charset=latin1")), html.body( [html.p(p) for p in paras])) --- a/doc/example/assertion/global_testmodule_config/test_hello.py +++ b/doc/example/assertion/global_testmodule_config/test_hello.py @@ -1,5 +1,5 @@ hello = "world" -def test_func(): +def test_func(): pass --- a/doc/announce/release-0.9.0.txt +++ b/doc/announce/release-0.9.0.txt @@ -1,7 +1,7 @@ py lib 1.0.0: XXX ====================================================================== -Welcome to the 1.0.0 py lib release - a library aiming to -support agile and test-driven python development on various levels. +Welcome to the 1.0.0 py lib release - a library aiming to +support agile and test-driven python development on various levels. XXX --- a/bin-for-dist/hudson.py +++ b/bin-for-dist/hudson.py @@ -16,11 +16,11 @@ BIN=os.path.abspath(os.path.join(BUILDNA if not os.path.exists(BIN): BIN=os.path.abspath(os.path.join(BUILDNAME, 'Scripts')) assert os.path.exists(BIN) - + PYTHON=os.path.join(BIN, 'python') bincall("python", "setup.py", "develop", "-q") -bincall("pip", "install", "-r", "testing/pip-reqs1.txt", +bincall("pip", "install", "-r", "testing/pip-reqs1.txt", "-q", "--download-cache=download") -bincall("py.test", "--ignore", BUILDNAME, - "--xml=junit.xml", +bincall("py.test", "--ignore", BUILDNAME, + "--xml=junit.xml", "--report=skipped", "--runslowtest", *sys.argv[1:]) --- a/README.txt +++ b/README.txt @@ -1,8 +1,8 @@ -The py lib is a Python development support library featuring +The py lib is a Python development support library featuring the following tools and modules: * py.test: tool for distributed automated testing * py.code: dynamic code generation and introspection -* py.path: uniform local and svn path objects +* py.path: uniform local and svn path objects For questions and more information please visit http://pylib.org --- a/doc/announce/release-1.2.0.txt +++ b/doc/announce/release-1.2.0.txt @@ -3,28 +3,28 @@ py.test/pylib 1.2.0: junitxml, standalon py.test is an advanced automated testing tool working with Python2, Python3 and Jython versions on all major operating -systems. It has a simple plugin architecture and can run many -existing common Python test suites without modification. It offers -some unique features not found in other testing tools. +systems. It has a simple plugin architecture and can run many +existing common Python test suites without modification. It offers +some unique features not found in other testing tools. See http://pytest.org for more info. py.test 1.2.0 brings many bug fixes and interesting new abilities: -* --junitxml=path will create an XML file for use with CI processing -* --genscript=path creates a standalone py.test-equivalent test-script +* --junitxml=path will create an XML file for use with CI processing +* --genscript=path creates a standalone py.test-equivalent test-script * --ignore=path prevents collection of anything below that path * --confcutdir=path only lookup conftest.py test configs below that path -* a 'pytest_report_header' hook to add info to the terminal report header +* a 'pytest_report_header' hook to add info to the terminal report header * a 'pytestconfig' function argument gives direct access to option values -* 'pytest_generate_tests' can now be put into a class as well +* 'pytest_generate_tests' can now be put into a class as well * on CPython py.test additionally installs as "py.test-VERSION", on Jython as py.test-jython and on PyPy as py.test-pypy-XYZ -Apart from many bug fixes 1.2.0 also has better pluginization: +Apart from many bug fixes 1.2.0 also has better pluginization: Distributed testing and looponfailing testing now live in the separately installable 'pytest-xdist' plugin. The same is true for 'pytest-figleaf' for doing coverage reporting. Those two plugins -can serve well now as blue prints for doing your own. +can serve well now as blue prints for doing your own. thanks to all who helped and gave feedback, have fun, @@ -34,45 +34,45 @@ holger krekel, January 2010 Changes between 1.2.0 and 1.1.1 ===================================== -- moved dist/looponfailing from py.test core into a new +- moved dist/looponfailing from py.test core into a new separately released pytest-xdist plugin. - new junitxml plugin: --junitxml=path will generate a junit style xml file - which is processable e.g. by the Hudson CI system. + which is processable e.g. by the Hudson CI system. - new option: --genscript=path will generate a standalone py.test script - which will not need any libraries installed. thanks to Ralf Schmitt. + which will not need any libraries installed. thanks to Ralf Schmitt. -- new option: --ignore will prevent specified path from collection. - Can be specified multiple times. +- new option: --ignore will prevent specified path from collection. + Can be specified multiple times. -- new option: --confcutdir=dir will make py.test only consider conftest - files that are relative to the specified dir. +- new option: --confcutdir=dir will make py.test only consider conftest + files that are relative to the specified dir. - new funcarg: "pytestconfig" is the pytest config object for access - to command line args and can now be easily used in a test. + to command line args and can now be easily used in a test. - install 'py.test' and `py.which` with a ``-$VERSION`` suffix to - disambiguate between Python3, python2.X, Jython and PyPy installed versions. + disambiguate between Python3, python2.X, Jython and PyPy installed versions. - new "pytestconfig" funcarg allows access to test config object -- new "pytest_report_header" hook can return additional lines - to be displayed at the header of a test run. +- new "pytest_report_header" hook can return additional lines + to be displayed at the header of a test run. - (experimental) allow "py.test path::name1::name2::..." for pointing to a test within a test collection directly. This might eventually - evolve as a full substitute to "-k" specifications. + evolve as a full substitute to "-k" specifications. - streamlined plugin loading: order is now as documented in - customize.html: setuptools, ENV, commandline, conftest. + customize.html: setuptools, ENV, commandline, conftest. also setuptools entry point names are turned to canonical namees ("pytest_*") -- automatically skip tests that need 'capfd' but have no os.dup +- automatically skip tests that need 'capfd' but have no os.dup -- allow pytest_generate_tests to be defined in classes as well +- allow pytest_generate_tests to be defined in classes as well -- deprecate usage of 'disabled' attribute in favour of pytestmark +- deprecate usage of 'disabled' attribute in favour of pytestmark - deprecate definition of Directory, Module, Class and Function nodes in conftest.py files. Use pytest collect hooks instead. @@ -87,28 +87,28 @@ Changes between 1.2.0 and 1.1.1 change its long command line options to be a bit shorter (see py.test -h). - change: pytest doctest plugin is now enabled by default and has a - new option --doctest-glob to set a pattern for file matches. + new option --doctest-glob to set a pattern for file matches. -- change: remove internal py._* helper vars, only keep py._pydir +- change: remove internal py._* helper vars, only keep py._pydir -- robustify capturing to survive if custom pytest_runtest_setup - code failed and prevented the capturing setup code from running. +- robustify capturing to survive if custom pytest_runtest_setup + code failed and prevented the capturing setup code from running. - make py.test.* helpers provided by default plugins visible early - works transparently both for pydoc and for interactive sessions - which will regularly see e.g. py.test.mark and py.test.importorskip. + which will regularly see e.g. py.test.mark and py.test.importorskip. -- simplify internal plugin manager machinery +- simplify internal plugin manager machinery - simplify internal collection tree by introducing a RootCollector node - fix assert reinterpreation that sees a call containing "keyword=..." -- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish - hooks on slaves during dist-testing, report module/session teardown +- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish + hooks on slaves during dist-testing, report module/session teardown hooks correctly. -- fix issue65: properly handle dist-testing if no - execnet/py lib installed remotely. +- fix issue65: properly handle dist-testing if no + execnet/py lib installed remotely. - skip some install-tests if no execnet is available --- a/contrib/readme.txt +++ b/contrib/readme.txt @@ -1,2 +1,2 @@ -pygreen: experimental IO and execnet operations through greenlets +pygreen: experimental IO and execnet operations through greenlets --- a/doc/example/funcarg/parametrize/test_parametrize3.py +++ b/doc/example/funcarg/parametrize/test_parametrize3.py @@ -1,5 +1,5 @@ -# following hook can be put unchanged into a local or global plugin +# following hook can be put unchanged into a local or global plugin def pytest_generate_tests(metafunc): for scenario in metafunc.cls.scenarios: metafunc.addcall(id=scenario[0], funcargs=scenario[1]) @@ -12,4 +12,4 @@ class TestSampleWithScenarios: scenarios = [scenario1, scenario2] def test_demo(self, attribute): - assert isinstance(attribute, str) + assert isinstance(attribute, str) --- a/doc/announce/release-1.0.1.txt +++ b/doc/announce/release-1.0.1.txt @@ -1,48 +1,48 @@ 1.0.1: improved reporting, nose/unittest.py support, bug fixes ----------------------------------------------------------------------- -This is a bugfix release of pylib/py.test also coming with: +This is a bugfix release of pylib/py.test also coming with: -* improved documentation, improved navigation +* improved documentation, improved navigation * test failure reporting improvements * support for directly running existing nose/unittest.py style tests -visit here for more info, including quickstart and tutorials: +visit here for more info, including quickstart and tutorials: http://pytest.org and http://pylib.org -Changelog 1.0.0 to 1.0.1 +Changelog 1.0.0 to 1.0.1 ------------------------ -* added a default 'pytest_nose' plugin which handles nose.SkipTest, - nose-style function/method/generator setup/teardown and - tries to report functions correctly. +* added a default 'pytest_nose' plugin which handles nose.SkipTest, + nose-style function/method/generator setup/teardown and + tries to report functions correctly. -* improved documentation, better navigation: see http://pytest.org +* improved documentation, better navigation: see http://pytest.org * added a "--help-config" option to show conftest.py / ENV-var names for - all longopt cmdline options, and some special conftest.py variables. - renamed 'conf_capture' conftest setting to 'option_capture' accordingly. + all longopt cmdline options, and some special conftest.py variables. + renamed 'conf_capture' conftest setting to 'option_capture' accordingly. -* unicode fixes: capturing and unicode writes to sys.stdout - (through e.g a print statement) now work within tests, - they are encoded as "utf8" by default, also terminalwriting - was adapted and somewhat unified between windows and linux +* unicode fixes: capturing and unicode writes to sys.stdout + (through e.g a print statement) now work within tests, + they are encoded as "utf8" by default, also terminalwriting + was adapted and somewhat unified between windows and linux -* fix issue #27: better reporting on non-collectable items given on commandline +* fix issue #27: better reporting on non-collectable items given on commandline (e.g. pyc files) -* fix issue #33: added --version flag (thanks Benjamin Peterson) +* fix issue #33: added --version flag (thanks Benjamin Peterson) * fix issue #32: adding support for "incomplete" paths to wcpath.status() -* "Test" prefixed classes are *not* collected by default anymore if they - have an __init__ method +* "Test" prefixed classes are *not* collected by default anymore if they + have an __init__ method * monkeypatch setenv() now accepts a "prepend" parameter * improved reporting of collection error tracebacks -* simplified multicall mechanism and plugin architecture, - renamed some internal methods and argnames +* simplified multicall mechanism and plugin architecture, + renamed some internal methods and argnames --- a/doc/announce/release-1.2.1.txt +++ b/doc/announce/release-1.2.1.txt @@ -1,29 +1,29 @@ -py.test/pylib 1.2.1: little fixes and improvements +py.test/pylib 1.2.1: little fixes and improvements -------------------------------------------------------------------------------- py.test is an advanced automated testing tool working with Python2, Python3 and Jython versions on all major operating -systems. It has a simple plugin architecture and can run many -existing common Python test suites without modification. It offers -some unique features not found in other testing tools. +systems. It has a simple plugin architecture and can run many +existing common Python test suites without modification. It offers +some unique features not found in other testing tools. See http://pytest.org for more info. -py.test 1.2.1 brings bug fixes and some new options and abilities triggered +py.test 1.2.1 brings bug fixes and some new options and abilities triggered by user feedback: * --funcargs [testpath] will show available builtin- and project funcargs. * display a short and concise traceback if funcarg lookup fails. -* early-load "conftest.py" files in non-dot first-level sub directories. +* early-load "conftest.py" files in non-dot first-level sub directories. * --tb=line will print a single line for each failing test (issue67) * py.cleanup has a number of new options, cleanups up setup.py related files * fix issue78: always call python-level teardown functions even if the - according setup failed. + according setup failed. -For more detailed information see the changelog below. +For more detailed information see the changelog below. cheers and have fun, -holger +holger Changes between 1.2.1 and 1.2.0 @@ -34,33 +34,33 @@ Changes between 1.2.1 and 1.2.0 py.cleanup # remove "*.pyc" and "*$py.class" (jython) files py.cleanup -e .swp -e .cache # also remove files with these extensions py.cleanup -s # remove "build" and "dist" directory next to setup.py files - py.cleanup -d # also remove empty directories + py.cleanup -d # also remove empty directories py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'" py.cleanup -n # dry run, only show what would be removed -- add a new option "py.test --funcargs" which shows available funcargs - and their help strings (docstrings on their respective factory function) +- add a new option "py.test --funcargs" which shows available funcargs + and their help strings (docstrings on their respective factory function) for a given test path -- display a short and concise traceback if a funcarg lookup fails +- display a short and concise traceback if a funcarg lookup fails -- early-load "conftest.py" files in non-dot first-level sub directories. - allows to conveniently keep and access test-related options in a ``test`` - subdir and still add command line options. +- early-load "conftest.py" files in non-dot first-level sub directories. + allows to conveniently keep and access test-related options in a ``test`` + subdir and still add command line options. - fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value - fix issue78: always call python-level teardown functions even if the - according setup failed. This includes refinements for calling setup_module/class functions + according setup failed. This includes refinements for calling setup_module/class functions which will now only be called once instead of the previous behaviour where they'd be called multiple times if they raise an exception (including a Skipped exception). Any exception will be re-corded and associated with all tests in the according module/class scope. - fix issue63: assume <40 columns to be a bogus terminal width, default to 80 -- fix pdb debugging to be in the correct frame on raises-related errors +- fix pdb debugging to be in the correct frame on raises-related errors - update apipkg.py to fix an issue where recursive imports might - unnecessarily break importing + unnecessarily break importing -- fix plugin links +- fix plugin links --- a/doc/example/genhtmlcss.py +++ b/doc/example/genhtmlcss.py @@ -1,23 +1,23 @@ import py -html = py.xml.html +html = py.xml.html class my(html): - "a custom style" - class body(html.body): - style = html.Style(font_size = "120%") + "a custom style" + class body(html.body): + style = html.Style(font_size = "120%") - class h2(html.h2): + class h2(html.h2): style = html.Style(background = "grey") - class p(html.p): + class p(html.p): style = html.Style(font_weight="bold") doc = my.html( - my.head(), + my.head(), my.body( my.h2("hello world"), - my.p("bold as bold can") + my.p("bold as bold can") ) ) - -print doc.unicode(indent=2) + +print doc.unicode(indent=2) --- a/doc/example/funcarg/test_multi_python.py +++ b/doc/example/funcarg/test_multi_python.py @@ -1,22 +1,22 @@ """ module containing a parametrized tests testing cross-python -serialization via the pickle module. +serialization via the pickle module. """ import py -pythonlist = ['python2.3', 'python2.4', 'python2.5', 'python2.6'] +pythonlist = ['python2.3', 'python2.4', 'python2.5', 'python2.6'] # 'jython' 'python3.1'] - + def pytest_generate_tests(metafunc): if 'python1' in metafunc.funcargnames: assert 'python2' in metafunc.funcargnames for obj in metafunc.function.multiarg.kwargs['obj']: for py1 in pythonlist: for py2 in pythonlist: - metafunc.addcall(id="%s-%s-%s" % (py1, py2, obj), + metafunc.addcall(id="%s-%s-%s" % (py1, py2, obj), param=(py1, py2, obj)) - + @py.test.mark.multiarg(obj=[42, {}, {1:3},]) def test_basic_objects(python1, python2, obj): python1.dumps(obj) @@ -49,7 +49,7 @@ class Python: f.close() """ % (str(self.picklefile), obj))) py.process.cmdexec("%s %s" %(self.pythonpath, dumpfile)) - + def load_and_is_true(self, expression): loadfile = self.picklefile.dirpath("load.py") loadfile.write(py.code.Source(""" --- a/doc/contact.txt +++ b/doc/contact.txt @@ -1,50 +1,50 @@ -Contact and Communication points +Contact and Communication points =================================== -- `py-dev developers list`_ announcements and discussions. +- `py-dev developers list`_ announcements and discussions. -- #pylib on irc.freenode.net IRC channel for random questions. +- #pylib on irc.freenode.net IRC channel for random questions. -- `tetamap`_: Holger Krekel's blog, often about testing and py.test related news. +- `tetamap`_: Holger Krekel's blog, often about testing and py.test related news. -- `Testing In Python`_: a mailing list for testing tools and discussion. +- `Testing In Python`_: a mailing list for testing tools and discussion. -- `commit mailing list`_ or `@pylibcommit`_ to follow development commits, +- `commit mailing list`_ or `@pylibcommit`_ to follow development commits, - `bitbucket issue tracker`_ use this bitbucket issue tracker to report - bugs or request features. + bugs or request features. -- `merlinux.eu`_ offers on-site teaching and consulting services. +- `merlinux.eu`_ offers on-site teaching and consulting services. -.. _`bitbucket issue tracker`: http://bitbucket.org/hpk42/py-trunk/issues/ +.. _`bitbucket issue tracker`: http://bitbucket.org/hpk42/py-trunk/issues/ .. _`merlinux.eu`: http://merlinux.eu -.. _`get an account`: +.. _`get an account`: .. _tetamap: http://tetamap.wordpress.com -.. _`@pylibcommit`: http://twitter.com/pylibcommit +.. _`@pylibcommit`: http://twitter.com/pylibcommit -.. - get an account on codespeak - --------------------------- +.. + get an account on codespeak + --------------------------- - codespeak_ is where the subversion repository is hosted. If you know - someone who is active on codespeak already or you are otherwise known in - the community (see also: FOAF_) you will get access. But even if - you are new to the python developer community please come to the IRC - or the mailing list and ask questions, get involved. + codespeak_ is where the subversion repository is hosted. If you know + someone who is active on codespeak already or you are otherwise known in + the community (see also: FOAF_) you will get access. But even if + you are new to the python developer community please come to the IRC + or the mailing list and ask questions, get involved. .. _`Testing in Python`: http://lists.idyll.org/listinfo/testing-in-python .. _FOAF: http://en.wikipedia.org/wiki/FOAF .. _us: http://codespeak.net/mailman/listinfo/py-dev .. _codespeak: http://codespeak.net/ -.. _`py-dev`: -.. _`development mailing list`: -.. _`py-dev developers list`: http://codespeak.net/mailman/listinfo/py-dev -.. _`py-svn`: -.. _`commit mailing list`: http://codespeak.net/mailman/listinfo/py-svn +.. _`py-dev`: +.. _`development mailing list`: +.. _`py-dev developers list`: http://codespeak.net/mailman/listinfo/py-dev +.. _`py-svn`: +.. _`commit mailing list`: http://codespeak.net/mailman/listinfo/py-svn --- a/doc/example/funcarg/mysetup2/__init__.py +++ b/doc/example/funcarg/mysetup2/__init__.py @@ -1,1 +1,1 @@ -# XXX this file should not need to be here but is here for proper sys.path mangling +# XXX this file should not need to be here but is here for proper sys.path mangling --- a/bin/_findpy.py +++ b/bin/_findpy.py @@ -1,8 +1,8 @@ -#!/usr/bin/env python +#!/usr/bin/env python # # find and import a version of 'py' that exists in a parent dir -# of the current working directory. fall back to import a +# of the current working directory. fall back to import a # globally available version # import sys @@ -31,9 +31,9 @@ def searchpy(current): if not searchpy(abspath(os.curdir)): if not searchpy(opd(abspath(sys.argv[0]))): if not searchpy(opd(__file__)): - pass # let's hope it is just on sys.path + pass # let's hope it is just on sys.path import py -if __name__ == '__main__': +if __name__ == '__main__': print ("py lib is at %s" % py.__file__) --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,8 @@ Changes between 1.3.2 and 1.3.3a1 - fix weirdness: make terminal width detection work on stdout instead of stdin (thanks Armin Ronacher for reporting) +- remove trailing whitespace in all py/text files + Changes between 1.3.1 and 1.3.2 ================================================== --- a/doc/code.txt +++ b/doc/code.txt @@ -18,7 +18,7 @@ Contents of the library Every object in the ``py.code`` library wraps a code Python object related to code objects, source code, frames and tracebacks: the ``py.code.Code`` class wraps code objects, ``py.code.Source`` source snippets, -``py.code.Traceback` exception tracebacks, ``py.code.Frame`` frame +``py.code.Traceback` exception tracebacks, ``py.code.Frame`` frame objects (as found in e.g. tracebacks) and ``py.code.ExceptionInfo`` the tuple provided by sys.exc_info() (containing exception and traceback information when an exception occurs). Also in the library is a helper function --- a/doc/example/assertion/test_failures.py +++ b/doc/example/assertion/test_failures.py @@ -4,7 +4,7 @@ failure_demo = py.path.local(__file__).d pytest_plugins = "pytest_pytester" -def test_failure_demo_fails_properly(testdir): +def test_failure_demo_fails_properly(testdir): target = testdir.tmpdir.join(failure_demo.basename) failure_demo.copy(target) failure_demo.copy(testdir.tmpdir.join(failure_demo.basename)) --- a/doc/example/funcarg/mysetup/test_sample.py +++ b/doc/example/funcarg/mysetup/test_sample.py @@ -1,5 +1,5 @@ -def test_answer(mysetup): +def test_answer(mysetup): app = mysetup.myapp() answer = app.question() assert answer == 42 --- a/doc/example/funcarg/urloption/conftest.py +++ b/doc/example/funcarg/urloption/conftest.py @@ -1,15 +1,15 @@ -# conftest.py +# conftest.py import py def pytest_addoption(parser): - grp = parser.getgroup("testserver options") + grp = parser.getgroup("testserver options") grp.addoption("--url", action="store", default=None, - help="url for testserver") + help="url for testserver") -def pytest_funcarg__url(request): - url = request.config.getvalue("url") - if url is None: - py.test.skip("need --url") - return url +def pytest_funcarg__url(request): + url = request.config.getvalue("url") + if url is None: + py.test.skip("need --url") + return url --- a/doc/example/funcarg/mysetup2/myapp.py +++ b/doc/example/funcarg/mysetup2/myapp.py @@ -1,5 +1,5 @@ class MyApp: def question(self): - return 6 * 9 + return 6 * 9 --- a/contrib/pytest_twisted/__init__.py +++ b/contrib/pytest_twisted/__init__.py @@ -20,7 +20,7 @@ try: from greenlet import greenlet except ImportError: print "Since pylib 1.0 greenlet are removed and separately packaged: " \ - "http://pypi.python.org/pypi/greenlet" + "http://pypi.python.org/pypi/greenlet" sys.exit(10) @@ -44,7 +44,7 @@ def _run_twisted(logging=False): failure.Failure.cleanFailure = lambda *args: None if logging: _start_twisted_logging() - + def fix_signal_handling(): # see http://twistedmatrix.com/trac/ticket/733 import signal @@ -54,7 +54,7 @@ def _run_twisted(logging=False): def start(): fix_signal_handling() doit(None) - + # recursively called for each test-function/method due done() def doit(val): # val always None # switch context to wait that wrapper() passes back to test-method @@ -68,7 +68,7 @@ def _run_twisted(logging=False): def err(res): reactor.callLater(0.0, doit, res) - + # the test-function *may* return a deferred # here the test-function will actually been called # done() is finalizing a test-process by assuring recursive invoking @@ -92,19 +92,19 @@ def pytest_unconfigure(config): gr_twisted.switch(None) def pytest_pyfunc_call(pyfuncitem): - # XXX1 kwargs? + # XXX1 kwargs? # XXX2 we want to delegate actual call to next plugin - # (which may want to produce test coverage, etc.) + # (which may want to produce test coverage, etc.) res = gr_twisted.switch(lambda: pyfuncitem.call()) if res: res.raiseException() - return True # indicates that we performed the function call + return True # indicates that we performed the function call gr_twisted = greenlet(_run_twisted) gr_tests = greenlet.getcurrent() # =============================================================================== -# plugin tests +# plugin tests # =============================================================================== def test_generic(testdir): @@ -125,7 +125,7 @@ def test_generic(testdir): def done(): log.msg("test_deferred.done() CALLBACK DONE") d.callback(None) - + reactor.callLater(2.5, done) log.msg("test_deferred() returning deferred: %r" % (d,)) return d @@ -136,7 +136,7 @@ def test_generic(testdir): def done(): log.msg("test_deferred2.done() CALLBACK DONE") d.callback(None) - + reactor.callLater(2.5, done) log.msg("test_deferred2() returning deferred: %r" % (d,)) return d @@ -157,7 +157,7 @@ def test_generic(testdir): def done(): log.msg("test_deferred3.done() CALLBACK DONE") d.callback(None) - + reactor.callLater(2.5, done) log.msg("test_deferred3() returning deferred: %r" % (d,)) return d @@ -172,7 +172,7 @@ def test_generic(testdir): def done(): log.msg("TestTwistedSetupMethod.test_deferred() CALLBACK DONE") d.callback(None) - + reactor.callLater(2.5, done) log.msg("TestTwistedSetupMethod.test_deferred() returning deferred: %r" % (d,)) return d --- a/bin-for-dist/findmissingdocstrings.py +++ b/bin-for-dist/findmissingdocstrings.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python import py import inspect @@ -73,4 +73,4 @@ if __name__ == '__main__': for name, obj in all_exported: if isinstance(obj, type): report_different_parameter_names(name, obj) - + --- a/doc/example/assertion/failure_demo.py +++ b/doc/example/assertion/failure_demo.py @@ -7,9 +7,9 @@ def otherfunc(a,b): def somefunc(x,y): otherfunc(x,y) -def otherfunc_multi(a,b): - assert (a == - b) +def otherfunc_multi(a,b): + assert (a == + b) def test_generative(param1, param2): assert param1 * 2 < param2 --- a/contrib/runtesthelper.py +++ b/contrib/runtesthelper.py @@ -1,10 +1,10 @@ """ this little helper allows to run tests multiple times -in the same process. useful for running tests from -a console. +in the same process. useful for running tests from +a console. -NOTE: since 1.3.1 you can just call py.test.cmdline.main() -multiple times - no special logic needed. +NOTE: since 1.3.1 you can just call py.test.cmdline.main() +multiple times - no special logic needed. """ import py, sys --- a/doc/example/funcarg/costlysetup/conftest.py +++ b/doc/example/funcarg/costlysetup/conftest.py @@ -1,7 +1,7 @@ def pytest_funcarg__setup(request): return request.cached_setup( - setup=lambda: CostlySetup(), + setup=lambda: CostlySetup(), teardown=lambda costlysetup: costlysetup.finalize(), scope="session", ) @@ -13,4 +13,4 @@ class CostlySetup: self.timecostly = 1 def finalize(self): - del self.timecostly + del self.timecostly --- a/bin-for-dist/makepluginlist.py +++ b/bin-for-dist/makepluginlist.py @@ -3,30 +3,30 @@ import os, sys WIDTH = 75 plugins = [ - ('advanced python testing', + ('advanced python testing', 'skipping mark pdb figleaf ' 'monkeypatch coverage cov capture capturelog recwarn tmpdir',), ('distributed testing, CI and deployment', 'xdist pastebin junitxml resultlog genscript',), ('testing domains and conventions codecheckers', 'oejskit django unittest nose doctest restdoc'), - ('internal, debugging, help functionality', + ('internal, debugging, help functionality', 'helpconfig terminal hooklog') - #('internal plugins / core functionality', + #('internal plugins / core functionality', # #'runner execnetcleanup # pytester', # 'runner execnetcleanup' # pytester', #) ] externals = { - 'oejskit': "run javascript tests in real life browsers", + 'oejskit': "run javascript tests in real life browsers", 'xdist': None, 'figleaf': None, - 'capturelog': None, - 'coverage': None, - 'cov': None, - 'codecheckers': None, - 'django': "for testing django applications", + 'capturelog': None, + 'coverage': None, + 'cov': None, + 'codecheckers': None, + 'django': "for testing django applications", } def warn(*args): @@ -107,7 +107,7 @@ class RestWriter: assert self._all_links[key] == link[1], (key, link[1]) else: self._all_links[key] = link[1] - + def write_all_links(cls, linkpath): p = linkpath.new(basename="links.txt") p_writer = RestWriter(p) @@ -142,7 +142,7 @@ class PluginOverview(RestWriter): self.add_internal_link(name, htmlpath) else: doc = PluginDoc(docpath) - doc.make(config=config, name=name) + doc.make(config=config, name=name) self.add_internal_link(name, doc.target) if name in externals: self.para("%s_ (external) %s" %(name, doc.oneliner)) @@ -173,9 +173,9 @@ class PluginDoc(RestWriter): moduledoc = doc[i+1:].strip() self.name = oneliner # plugin.__name__.split(".")[-1] - self.oneliner = oneliner + self.oneliner = oneliner self.moduledoc = moduledoc - + #self.h1("%s plugin" % self.name) # : %s" %(self.name, self.oneliner)) self.h1(oneliner) #self.Print(self.oneliner) @@ -185,13 +185,13 @@ class PluginDoc(RestWriter): self.Print() self.Print(moduledoc) - + self.emit_funcargs(plugin) self.emit_options(plugin) if name not in externals: self.emit_source(plugin, config.hg_changeset) - #self.sourcelink = (purename, - # "http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/" + + #self.sourcelink = (purename, + # "http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/" + # purename + ".py") # def emit_source(self, plugin, hg_changeset): @@ -199,35 +199,35 @@ class PluginDoc(RestWriter): if basename.endswith("pyc"): basename = basename[:-1] #self.para("`%s`_ source code" % basename) - #self.links.append((basename, + #self.links.append((basename, # "http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/" + # basename)) self.h1("Start improving this plugin in 30 seconds") self.para(py.code.Source(""" - 1. Download `%s`_ plugin source code - 2. put it somewhere as ``%s`` into your import path + 1. Download `%s`_ plugin source code + 2. put it somewhere as ``%s`` into your import path 3. a subsequent ``py.test`` run will use your local version - Checkout customize_, other plugins_ or `get in contact`_. + Checkout customize_, other plugins_ or `get in contact`_. """ % (basename, basename))) # your work appreciated if you offer back your version. In this case - # it probably makes sense if you `checkout the py.test + # it probably makes sense if you `checkout the py.test # development version`_ and apply your changes to the plugin - # version in there. - #self.links.append((basename, - # "http://bitbucket.org/hpk42/py-trunk/raw/%s/" + # version in there. + #self.links.append((basename, + # "http://bitbucket.org/hpk42/py-trunk/raw/%s/" # "py/test/plugin/%s" %(hg_changeset, basename))) - self.links.append((basename, - "http://bitbucket.org/hpk42/py-trunk/raw/%s/" + self.links.append((basename, + "http://bitbucket.org/hpk42/py-trunk/raw/%s/" "py/_plugin/%s" %(pyversion, basename))) self.links.append(('customize', '../customize.html')) self.links.append(('plugins', 'index.html')) self.links.append(('get in contact', '../../contact.html')) - self.links.append(('checkout the py.test development version', + self.links.append(('checkout the py.test development version', '../../install.html#checkout')) - + if 0: # this breaks the page layout and makes large doc files - #self.h2("plugin source code") + #self.h2("plugin source code") self.Print() self.para("For your convenience here is also an inlined version " "of ``%s``:" %basename) @@ -285,15 +285,15 @@ if __name__ == "__main__": pydir = py.path.local(py.__file__).dirpath() pyversion = py.version - cmd = "hg tip --template '{node}'" + cmd = "hg tip --template '{node}'" old = pydir.dirpath().chdir() _config.hg_changeset = py.process.cmdexec(cmd).strip() testdir = pydir.dirpath("doc", 'test') - + ov = PluginOverview(testdir.join("plugin", "index.txt")) ov.make(config=_config) - + ov = HookSpec(testdir.join("plugin", "hookspec.txt")) ov.make(config=_config) --- a/doc/announce/release-1.3.1.txt +++ b/doc/announce/release-1.3.1.txt @@ -1,21 +1,21 @@ py.test/pylib 1.3.1: new py.test.xfail, --maxfail, better reporting =========================================================================== -The pylib/py.test 1.3.1 release brings: +The pylib/py.test 1.3.1 release brings: -- the new imperative ``py.test.xfail()`` helper in order to have a test or +- the new imperative ``py.test.xfail()`` helper in order to have a test or setup function result in an "expected failure" - a new option ``--maxfail=NUM`` to stop the test run after some failures - markers/decorators are now applicable to test classes (>=Python2.6) - improved reporting, shorter tracebacks in several cases -- some simplified internals, more compatibility with Jython and PyPy +- some simplified internals, more compatibility with Jython and PyPy - bug fixes and various refinements See the below CHANGELOG entry below for more details and -http://pylib.org/install.html for installation instructions. +http://pylib.org/install.html for installation instructions. -If you used older versions of py.test you should be able to upgrade -to 1.3.1 without changes to your test source code. +If you used older versions of py.test you should be able to upgrade +to 1.3.1 without changes to your test source code. py.test is an automated testing tool working with Python2, Python3, Jython and PyPy versions on all major operating systems. It @@ -23,7 +23,7 @@ offers a no-boilerplate testing approach tools and enhancements in the standard Python library for more than five years. It has a simple and extensive plugin architecture, configurable reporting and provides unique ways to make it fit to your testing -process and needs. +process and needs. See http://pytest.org for more info. @@ -34,27 +34,27 @@ holger krekel Changes between 1.3.0 and 1.3.1 ================================================== -New features +New features ++++++++++++++++++ -- issue91: introduce new py.test.xfail(reason) helper - to imperatively mark a test as expected to fail. Can +- issue91: introduce new py.test.xfail(reason) helper + to imperatively mark a test as expected to fail. Can be used from within setup and test functions. This is - useful especially for parametrized tests when certain + useful especially for parametrized tests when certain configurations are expected-to-fail. In this case the declarative approach with the @py.test.mark.xfail cannot - be used as it would mark all configurations as xfail. + be used as it would mark all configurations as xfail. - issue102: introduce new --maxfail=NUM option to stop test runs after NUM failures. This is a generalization of the '-x' or '--exitfirst' option which is now equivalent - to '--maxfail=1'. Both '-x' and '--maxfail' will - now also print a line near the end indicating the Interruption. + to '--maxfail=1'. Both '-x' and '--maxfail' will + now also print a line near the end indicating the Interruption. - issue89: allow py.test.mark decorators to be used on classes - (class decorators were introduced with python2.6) and + (class decorators were introduced with python2.6) and also allow to have multiple markers applied at class/module level - by specifying a list. + by specifying a list. - improve and refine letter reporting in the progress bar: . pass @@ -64,19 +64,19 @@ New features X xpassed test (test that was expected to fail but passed) You can use any combination of 'fsxX' with the '-r' extended - reporting option. The xfail/xpass results will show up as - skipped tests in the junitxml output - which also fixes + reporting option. The xfail/xpass results will show up as + skipped tests in the junitxml output - which also fixes issue99. -- make py.test.cmdline.main() return the exitstatus instead of raising +- make py.test.cmdline.main() return the exitstatus instead of raising SystemExit and also allow it to be called multiple times. This of - course requires that your application and tests are properly teared - down and don't have global state. + course requires that your application and tests are properly teared + down and don't have global state. -Fixes / Maintenance +Fixes / Maintenance ++++++++++++++++++++++ -- improved traceback presentation: +- improved traceback presentation: - improved and unified reporting for "--tb=short" option - Errors during test module imports are much shorter, (using --tb=short style) - raises shows shorter more relevant tracebacks @@ -84,20 +84,20 @@ Fixes / Maintenance - improve support for raises and other dynamically compiled code by manipulating python's linecache.cache instead of the previous - rather hacky way of creating custom code objects. This makes + rather hacky way of creating custom code objects. This makes it seemlessly work on Jython and PyPy where it previously didn't. -- fix issue96: make capturing more resilient against Control-C +- fix issue96: make capturing more resilient against Control-C interruptions (involved somewhat substantial refactoring - to the underlying capturing functionality to avoid race + to the underlying capturing functionality to avoid race conditions). -- fix chaining of conditional skipif/xfail decorators - so it works now +- fix chaining of conditional skipif/xfail decorators - so it works now as expected to use multiple @py.test.mark.skipif(condition) decorators, - including specific reporting which of the conditions lead to skipping. + including specific reporting which of the conditions lead to skipping. -- fix issue95: late-import zlib so that it's not required - for general py.test startup. +- fix issue95: late-import zlib so that it's not required + for general py.test startup. - fix issue94: make reporting more robust against bogus source code (and internally be more careful when presenting unexpected byte sequences) --- a/doc/confrest.py +++ b/doc/confrest.py @@ -2,7 +2,7 @@ import py from py._plugin.pytest_restdoc import convert_rest_html, strip_html_header -html = py.xml.html +html = py.xml.html class css: #pagetitle = "pagetitle" @@ -11,7 +11,7 @@ class css: navspace = "navspace" versioninfo = "versioninfo" -class Page(object): +class Page(object): doctype = ('\n') googlefragment = """ @@ -27,18 +27,18 @@ pageTracker._trackPageview(); """ def __init__(self, project, title, targetpath, stylesheeturl=None, - type="text/html", encoding="ISO-8859-1"): - self.project = project - self.title = project.prefix_title + title + type="text/html", encoding="ISO-8859-1"): + self.project = project + self.title = project.prefix_title + title self.targetpath = targetpath - self.stylesheeturl = stylesheeturl - self.type = type - self.encoding = encoding + self.stylesheeturl = stylesheeturl + self.type = type + self.encoding = encoding self.body = html.body() - self.head = html.head() - self._root = html.html(self.head, self.body) - self.fill() + self.head = html.head() + self._root = html.html(self.head, self.body) + self.fill() def a_href(self, name, url, **kwargs): return html.a(name, class_="menu", href=url, **kwargs) @@ -54,7 +54,7 @@ pageTracker._trackPageview(); return html.a(name, class_="menu", href=relpath(self.targetpath.strpath, apipath.join(relhtmlpath).strpath)) - + def fill_menubar(self): items = [ self.a_docref("INSTALL", "install.html"), @@ -73,7 +73,7 @@ pageTracker._trackPageview(); self.a_href("hudson-tests", "http://hudson.testrun.org") ), html.div( - html.h3("supporting APIs:"), + html.h3("supporting APIs:"), self.a_docref("Index", "index.html"), self.a_docref("py.path", "path.html"), self.a_docref("py.code", "code.html"), @@ -86,12 +86,12 @@ pageTracker._trackPageview(); self.menubar = html.div(id=css.menubar, *[ html.div(item) for item in items]) version = py.version - announcelink = self.a_docref("%s ANN" % version, + announcelink = self.a_docref("%s ANN" % version, "announce/release-%s.html" %(version,)) - self.menubar.insert(0, + self.menubar.insert(0, html.div(announcelink)) - #self.a_href("%s-%s" % (self.title, py.version), - # "http://pypi.python.org/pypi/py/%s" % version, + #self.a_href("%s-%s" % (self.title, py.version), + # "http://pypi.python.org/pypi/py/%s" % version, #id="versioninfo", def fill(self): @@ -108,31 +108,31 @@ pageTracker._trackPageview(); self.body.append(html.div( self.project.logo, self.menubar, - id=css.navspace, + id=css.navspace, )) - + #self.body.append(html.div(self.title, id=css.pagetitle)) self.contentspace = html.div(id=css.contentspace) self.body.append(self.contentspace) - def unicode(self, doctype=True): - page = self._root.unicode() + def unicode(self, doctype=True): + page = self._root.unicode() page = page.replace("", self.googlefragment + "") - if doctype: - return self.doctype + page - else: - return page + if doctype: + return self.doctype + page + else: + return page -class PyPage(Page): +class PyPage(Page): def get_menubar(self): menubar = super(PyPage, self).get_menubar() - # base layout + # base layout menubar.append( html.a("issue", href="https://codespeak.net/issue/py-dev/", class_="menu"), ) return menubar - + def getrealname(username): try: @@ -143,30 +143,30 @@ def getrealname(username): user = uconf.system.User(username) except KeyboardInterrupt: raise - try: + try: return user.realname or username except KeyError: return username - + class Project: mydir = py.path.local(__file__).dirpath() title = "py lib" prefix_title = "" # we have a logo already containing "py lib" - encoding = 'latin1' + encoding = 'latin1' logo = html.div( html.a( - html.img(alt="py lib", id='pyimg', height=114/2, width=154/2, - src="http://codespeak.net/img/pylib.png"), + html.img(alt="py lib", id='pyimg', height=114/2, width=154/2, + src="http://codespeak.net/img/pylib.png"), href="http://pylib.org")) - Page = PyPage + Page = PyPage def __init__(self, sourcepath=None): if sourcepath is None: sourcepath = self.mydir self.setpath(sourcepath) - def setpath(self, sourcepath, docpath=None, + def setpath(self, sourcepath, docpath=None, apigenpath=None, stylesheet=None): self.sourcepath = sourcepath if docpath is None: @@ -197,7 +197,7 @@ class Project: reloutputpath = txtpath.new(ext='.html').relto(self.sourcepath) return self.docpath.join(reloutputpath) - def process(self, txtpath): + def process(self, txtpath): encoding = self.encoding content = self.get_content(txtpath, encoding) outputpath = self.get_htmloutputpath(txtpath) @@ -214,16 +214,16 @@ class Project: stylesheet=stylesheet, encoding=encoding) content = strip_html_header(content, encoding=encoding) - title = txtpath.purebasename + title = txtpath.purebasename if txtpath.dirpath().basename == "test": title = "py.test " + title # title = "[%s] %s" % (txtpath.purebasename, py.version) - page = self.Page(self, title, + page = self.Page(self, title, outputpath, stylesheeturl=stylesheet) try: modified = py.process.cmdexec( - "hg tip --template 'modified {date|shortdate}'" + "hg tip --template 'modified {date|shortdate}'" ) except py.process.cmdexec.Error: modified = " " @@ -231,10 +231,10 @@ class Project: #page.body.append(html.div(modified, id="docinfoline")) page.contentspace.append(py.xml.raw(content)) - outputpath.ensure().write(page.unicode().encode(encoding)) + outputpath.ensure().write(page.unicode().encode(encoding)) # XXX this function comes from apigen/linker.py, put it -# somewhere in py lib +# somewhere in py lib import os def relpath(p1, p2, sep=os.path.sep, back='..', normalize=True): """ create a relative path from p1 to p2 @@ -268,7 +268,7 @@ def relpath(p1, p2, sep=os.path.sep, bac # AA BB # AA CC -> CC # - # AA BB + # AA BB # AA -> ../AA diffindex = 0 --- a/doc/example/funcarg/parametrize/test_parametrize.py +++ b/doc/example/funcarg/parametrize/test_parametrize.py @@ -3,13 +3,13 @@ import py def pytest_generate_tests(metafunc): for funcargs in metafunc.cls.params[metafunc.function.__name__]: metafunc.addcall(funcargs=funcargs) - + class TestClass: params = { 'test_equals': [dict(a=1, b=2), dict(a=3, b=3), dict(a=5, b=4)], 'test_zerodivision': [dict(a=1, b=0), dict(a=3, b=2)], } - + def test_equals(self, a, b): assert a == b --- a/doc/example/funcarg/mysetup2/conftest.py +++ b/doc/example/funcarg/mysetup2/conftest.py @@ -7,11 +7,11 @@ def pytest_funcarg__mysetup(request): def pytest_addoption(parser): parser.addoption("--ssh", action="store", default=None, help="specify ssh host to run tests with") - + class MySetup: def __init__(self, request): - self.config = request.config + self.config = request.config def myapp(self): return MyApp() @@ -21,4 +21,4 @@ class MySetup: if host is None: py.test.skip("specify ssh host with --ssh") return execnet.SshGateway(host) - + --- a/conftest.py +++ b/conftest.py @@ -12,7 +12,7 @@ pid = os.getpid() def pytest_addoption(parser): group = parser.getgroup("pylib", "py lib testing options") - group.addoption('--sshhost', + group.addoption('--sshhost', action="store", dest="sshhost", default=None, help=("ssh xspec for ssh functional tests. ")) group.addoption('--runslowtests', @@ -43,7 +43,7 @@ def pytest_funcarg__sshhost(request): val = request.config.getvalue("sshhost") if val: return val - py.test.skip("need --sshhost option") + py.test.skip("need --sshhost option") def pytest_generate_tests(metafunc): multi = getattr(metafunc.function, 'multi', None) if multi is not None: @@ -52,11 +52,11 @@ def pytest_generate_tests(metafunc): for val in l: metafunc.addcall(funcargs={name: val}) elif 'anypython' in metafunc.funcargnames: - for name in ('python2.4', 'python2.5', 'python2.6', + for name in ('python2.4', 'python2.5', 'python2.6', 'python2.7', 'python3.1', 'pypy-c', 'jython'): metafunc.addcall(id=name, param=name) -# XXX copied from execnet's conftest.py - needs to be merged +# XXX copied from execnet's conftest.py - needs to be merged winpymap = { 'python2.7': r'C:\Python27\python.exe', 'python2.6': r'C:\Python26\python.exe', @@ -73,7 +73,7 @@ def getexecutable(name, cache={}): if executable: if name == "jython": import subprocess - popen = subprocess.Popen([str(executable), "--version"], + popen = subprocess.Popen([str(executable), "--version"], universal_newlines=True, stderr=subprocess.PIPE) out, err = popen.communicate() if not err or "2.5" not in err: --- a/doc/announce/release-1.3.2.txt +++ b/doc/announce/release-1.3.2.txt @@ -1,4 +1,4 @@ -py.test/pylib 1.3.2: API and reporting refinements, many fixes +py.test/pylib 1.3.2: API and reporting refinements, many fixes =========================================================================== The pylib/py.test 1.3.2 release brings many bug fixes and some new @@ -6,25 +6,25 @@ features. It was refined for and tested Python2.7 and remains compatibile to the usual armada of interpreters (Python2.4 through to Python3.1.2, Jython and PyPy). Note that for using distributed testing features you'll need to upgrade to the jointly released -pytest-xdist-1.4 because of some internal refactorings. +pytest-xdist-1.4 because of some internal refactorings. -See http://pytest.org for general documentation and below for -a detailed CHANGELOG. +See http://pytest.org for general documentation and below for +a detailed CHANGELOG. -cheers & particular thanks to Benjamin Peterson, Ronny Pfannschmidt -and all issue and patch contributors, +cheers & particular thanks to Benjamin Peterson, Ronny Pfannschmidt +and all issue and patch contributors, holger krekel Changes between 1.3.1 and 1.3.2 ================================================== -New features +New features ++++++++++++++++++ - fix issue103: introduce py.test.raises as context manager, examples:: - with py.test.raises(ZeroDivisionError): + with py.test.raises(ZeroDivisionError): x = 0 1 / x @@ -33,10 +33,10 @@ New features # you may do extra checks on excinfo.value|type|traceback here - (thanks Ronny Pfannschmidt) + (thanks Ronny Pfannschmidt) -- Funcarg factories can now dynamically apply a marker to a - test invocation. This is for example useful if a factory +- Funcarg factories can now dynamically apply a marker to a + test invocation. This is for example useful if a factory provides parameters to a test which are expected-to-fail:: def pytest_funcarg__arg(request): @@ -46,75 +46,75 @@ New features def test_function(arg): ... -- improved error reporting on collection and import errors. This makes +- improved error reporting on collection and import errors. This makes use of a more general mechanism, namely that for custom test item/collect - nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can - override it to return a string error representation of your choice - which is going to be reported as a (red) string. + nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can + override it to return a string error representation of your choice + which is going to be reported as a (red) string. -- introduce '--junitprefix=STR' option to prepend a prefix - to all reports in the junitxml file. +- introduce '--junitprefix=STR' option to prepend a prefix + to all reports in the junitxml file. Bug fixes / Maintenance ++++++++++++++++++++++++++ -- make tests and the ``pytest_recwarn`` plugin in particular fully compatible - to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that - you can properly check for their existence in a cross-python manner). -- refine --pdb: ignore xfailed tests, unify its TB-reporting and +- make tests and the ``pytest_recwarn`` plugin in particular fully compatible + to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that + you can properly check for their existence in a cross-python manner). +- refine --pdb: ignore xfailed tests, unify its TB-reporting and don't display failures again at the end. - fix assertion interpretation with the ** operator (thanks Benjamin Peterson) - fix issue105 assignment on the same line as a failing assertion (thanks Benjamin Peterson) - fix issue104 proper escaping for test names in junitxml plugin (thanks anonymous) - fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) - fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) -- fix py.code.compile(source) to generate unique filenames -- fix assertion re-interp problems on PyPy, by defering code +- fix py.code.compile(source) to generate unique filenames +- fix assertion re-interp problems on PyPy, by defering code compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) - fix py.path.local.pyimport() to work with directories - streamline py.path.local.mkdtemp implementation and usage - don't print empty lines when showing junitxml-filename - add optional boolean ignore_errors parameter to py.path.local.remove -- fix terminal writing on win32/python2.4 -- py.process.cmdexec() now tries harder to return properly encoded unicode objects +- fix terminal writing on win32/python2.4 +- py.process.cmdexec() now tries harder to return properly encoded unicode objects on all python versions - install plain py.test/py.which scripts also for Jython, this helps to get canonical script paths in virtualenv situations -- make path.bestrelpath(path) return ".", note that when calling - X.bestrelpath the assumption is that X is a directory. -- make initial conftest discovery ignore "--" prefixed arguments -- fix resultlog plugin when used in an multicpu/multihost xdist situation - (thanks Jakub Gustak) -- perform distributed testing related reporting in the xdist-plugin - rather than having dist-related code in the generic py.test +- make path.bestrelpath(path) return ".", note that when calling + X.bestrelpath the assumption is that X is a directory. +- make initial conftest discovery ignore "--" prefixed arguments +- fix resultlog plugin when used in an multicpu/multihost xdist situation + (thanks Jakub Gustak) +- perform distributed testing related reporting in the xdist-plugin + rather than having dist-related code in the generic py.test distribution -- fix homedir detection on Windows +- fix homedir detection on Windows - ship distribute_setup.py version 0.6.13 Changes between 1.3.0 and 1.3.1 ================================================== -New features +New features ++++++++++++++++++ -- issue91: introduce new py.test.xfail(reason) helper - to imperatively mark a test as expected to fail. Can +- issue91: introduce new py.test.xfail(reason) helper + to imperatively mark a test as expected to fail. Can be used from within setup and test functions. This is - useful especially for parametrized tests when certain + useful especially for parametrized tests when certain configurations are expected-to-fail. In this case the declarative approach with the @py.test.mark.xfail cannot - be used as it would mark all configurations as xfail. + be used as it would mark all configurations as xfail. - issue102: introduce new --maxfail=NUM option to stop test runs after NUM failures. This is a generalization of the '-x' or '--exitfirst' option which is now equivalent - to '--maxfail=1'. Both '-x' and '--maxfail' will - now also print a line near the end indicating the Interruption. + to '--maxfail=1'. Both '-x' and '--maxfail' will + now also print a line near the end indicating the Interruption. - issue89: allow py.test.mark decorators to be used on classes - (class decorators were introduced with python2.6) and + (class decorators were introduced with python2.6) and also allow to have multiple markers applied at class/module level - by specifying a list. + by specifying a list. - improve and refine letter reporting in the progress bar: . pass @@ -124,19 +124,19 @@ New features X xpassed test (test that was expected to fail but passed) You can use any combination of 'fsxX' with the '-r' extended - reporting option. The xfail/xpass results will show up as - skipped tests in the junitxml output - which also fixes + reporting option. The xfail/xpass results will show up as + skipped tests in the junitxml output - which also fixes issue99. -- make py.test.cmdline.main() return the exitstatus instead of raising +- make py.test.cmdline.main() return the exitstatus instead of raising SystemExit and also allow it to be called multiple times. This of - course requires that your application and tests are properly teared - down and don't have global state. + course requires that your application and tests are properly teared + down and don't have global state. -Fixes / Maintenance +Fixes / Maintenance ++++++++++++++++++++++ -- improved traceback presentation: +- improved traceback presentation: - improved and unified reporting for "--tb=short" option - Errors during test module imports are much shorter, (using --tb=short style) - raises shows shorter more relevant tracebacks @@ -144,20 +144,20 @@ Fixes / Maintenance - improve support for raises and other dynamically compiled code by manipulating python's linecache.cache instead of the previous - rather hacky way of creating custom code objects. This makes + rather hacky way of creating custom code objects. This makes it seemlessly work on Jython and PyPy where it previously didn't. -- fix issue96: make capturing more resilient against Control-C +- fix issue96: make capturing more resilient against Control-C interruptions (involved somewhat substantial refactoring - to the underlying capturing functionality to avoid race + to the underlying capturing functionality to avoid race conditions). -- fix chaining of conditional skipif/xfail decorators - so it works now +- fix chaining of conditional skipif/xfail decorators - so it works now as expected to use multiple @py.test.mark.skipif(condition) decorators, - including specific reporting which of the conditions lead to skipping. + including specific reporting which of the conditions lead to skipping. -- fix issue95: late-import zlib so that it's not required - for general py.test startup. +- fix issue95: late-import zlib so that it's not required + for general py.test startup. - fix issue94: make reporting more robust against bogus source code (and internally be more careful when presenting unexpected byte sequences) @@ -169,40 +169,40 @@ Changes between 1.2.1 and 1.3.0 - deprecate --report option in favour of a new shorter and easier to remember -r option: it takes a string argument consisting of any combination of 'xfsX' characters. They relate to the single chars - you see during the dotted progress printing and will print an extra line + you see during the dotted progress printing and will print an extra line per test at the end of the test run. This extra line indicates the exact position or test ID that you directly paste to the py.test cmdline in order - to re-run a particular test. + to re-run a particular test. -- allow external plugins to register new hooks via the new +- allow external plugins to register new hooks via the new pytest_addhooks(pluginmanager) hook. The new release of - the pytest-xdist plugin for distributed and looponfailing - testing requires this feature. + the pytest-xdist plugin for distributed and looponfailing + testing requires this feature. - add a new pytest_ignore_collect(path, config) hook to allow projects and - plugins to define exclusion behaviour for their directory structure - + plugins to define exclusion behaviour for their directory structure - for example you may define in a conftest.py this method:: def pytest_ignore_collect(path): return path.check(link=1) - to prevent even a collection try of any tests in symlinked dirs. + to prevent even a collection try of any tests in symlinked dirs. - new pytest_pycollect_makemodule(path, parent) hook for - allowing customization of the Module collection object for a - matching test module. + allowing customization of the Module collection object for a + matching test module. -- extend and refine xfail mechanism: +- extend and refine xfail mechanism: ``@py.test.mark.xfail(run=False)`` do not run the decorated test ``@py.test.mark.xfail(reason="...")`` prints the reason string in xfail summaries specifiying ``--runxfail`` on command line virtually ignores xfail markers -- expose (previously internal) commonly useful methods: +- expose (previously internal) commonly useful methods: py.io.get_terminal_with() -> return terminal width py.io.ansi_print(...) -> print colored/bold text on linux/win32 py.io.saferepr(obj) -> return limited representation string -- expose test outcome related exceptions as py.test.skip.Exception, +- expose test outcome related exceptions as py.test.skip.Exception, py.test.raises.Exception etc., useful mostly for plugins doing special outcome interpretation/tweaking @@ -210,22 +210,22 @@ Changes between 1.2.1 and 1.3.0 - fix/refine python3 compatibility (thanks Benjamin Peterson) -- fixes for making the jython/win32 combination work, note however: +- fixes for making the jython/win32 combination work, note however: jython2.5.1/win32 does not provide a command line launcher, see http://bugs.jython.org/issue1491 . See pylib install documentation - for how to work around. + for how to work around. - fixes for handling of unicode exception values and unprintable objects -- (issue87) fix unboundlocal error in assertionold code +- (issue87) fix unboundlocal error in assertionold code - (issue86) improve documentation for looponfailing - refine IO capturing: stdin-redirect pseudo-file now has a NOP close() method -- ship distribute_setup.py version 0.6.10 +- ship distribute_setup.py version 0.6.10 -- added links to the new capturelog and coverage plugins +- added links to the new capturelog and coverage plugins Changes between 1.2.1 and 1.2.0 @@ -236,79 +236,79 @@ Changes between 1.2.1 and 1.2.0 py.cleanup # remove "*.pyc" and "*$py.class" (jython) files py.cleanup -e .swp -e .cache # also remove files with these extensions py.cleanup -s # remove "build" and "dist" directory next to setup.py files - py.cleanup -d # also remove empty directories + py.cleanup -d # also remove empty directories py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'" py.cleanup -n # dry run, only show what would be removed -- add a new option "py.test --funcargs" which shows available funcargs - and their help strings (docstrings on their respective factory function) +- add a new option "py.test --funcargs" which shows available funcargs + and their help strings (docstrings on their respective factory function) for a given test path -- display a short and concise traceback if a funcarg lookup fails +- display a short and concise traceback if a funcarg lookup fails -- early-load "conftest.py" files in non-dot first-level sub directories. - allows to conveniently keep and access test-related options in a ``test`` - subdir and still add command line options. +- early-load "conftest.py" files in non-dot first-level sub directories. + allows to conveniently keep and access test-related options in a ``test`` + subdir and still add command line options. - fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value - fix issue78: always call python-level teardown functions even if the - according setup failed. This includes refinements for calling setup_module/class functions + according setup failed. This includes refinements for calling setup_module/class functions which will now only be called once instead of the previous behaviour where they'd be called multiple times if they raise an exception (including a Skipped exception). Any exception will be re-corded and associated with all tests in the according module/class scope. - fix issue63: assume <40 columns to be a bogus terminal width, default to 80 -- fix pdb debugging to be in the correct frame on raises-related errors +- fix pdb debugging to be in the correct frame on raises-related errors - update apipkg.py to fix an issue where recursive imports might - unnecessarily break importing + unnecessarily break importing -- fix plugin links +- fix plugin links Changes between 1.2 and 1.1.1 ===================================== -- moved dist/looponfailing from py.test core into a new +- moved dist/looponfailing from py.test core into a new separately released pytest-xdist plugin. - new junitxml plugin: --junitxml=path will generate a junit style xml file - which is processable e.g. by the Hudson CI system. + which is processable e.g. by the Hudson CI system. - new option: --genscript=path will generate a standalone py.test script - which will not need any libraries installed. thanks to Ralf Schmitt. + which will not need any libraries installed. thanks to Ralf Schmitt. -- new option: --ignore will prevent specified path from collection. - Can be specified multiple times. +- new option: --ignore will prevent specified path from collection. + Can be specified multiple times. -- new option: --confcutdir=dir will make py.test only consider conftest - files that are relative to the specified dir. +- new option: --confcutdir=dir will make py.test only consider conftest + files that are relative to the specified dir. - new funcarg: "pytestconfig" is the pytest config object for access - to command line args and can now be easily used in a test. + to command line args and can now be easily used in a test. - install 'py.test' and `py.which` with a ``-$VERSION`` suffix to - disambiguate between Python3, python2.X, Jython and PyPy installed versions. + disambiguate between Python3, python2.X, Jython and PyPy installed versions. - new "pytestconfig" funcarg allows access to test config object -- new "pytest_report_header" hook can return additional lines - to be displayed at the header of a test run. +- new "pytest_report_header" hook can return additional lines + to be displayed at the header of a test run. - (experimental) allow "py.test path::name1::name2::..." for pointing to a test within a test collection directly. This might eventually - evolve as a full substitute to "-k" specifications. + evolve as a full substitute to "-k" specifications. - streamlined plugin loading: order is now as documented in - customize.html: setuptools, ENV, commandline, conftest. + customize.html: setuptools, ENV, commandline, conftest. also setuptools entry point names are turned to canonical namees ("pytest_*") -- automatically skip tests that need 'capfd' but have no os.dup +- automatically skip tests that need 'capfd' but have no os.dup -- allow pytest_generate_tests to be defined in classes as well +- allow pytest_generate_tests to be defined in classes as well -- deprecate usage of 'disabled' attribute in favour of pytestmark +- deprecate usage of 'disabled' attribute in favour of pytestmark - deprecate definition of Directory, Module, Class and Function nodes in conftest.py files. Use pytest collect hooks instead. @@ -323,28 +323,28 @@ Changes between 1.2 and 1.1.1 change its long command line options to be a bit shorter (see py.test -h). - change: pytest doctest plugin is now enabled by default and has a - new option --doctest-glob to set a pattern for file matches. + new option --doctest-glob to set a pattern for file matches. -- change: remove internal py._* helper vars, only keep py._pydir +- change: remove internal py._* helper vars, only keep py._pydir -- robustify capturing to survive if custom pytest_runtest_setup - code failed and prevented the capturing setup code from running. +- robustify capturing to survive if custom pytest_runtest_setup + code failed and prevented the capturing setup code from running. - make py.test.* helpers provided by default plugins visible early - works transparently both for pydoc and for interactive sessions - which will regularly see e.g. py.test.mark and py.test.importorskip. + which will regularly see e.g. py.test.mark and py.test.importorskip. -- simplify internal plugin manager machinery +- simplify internal plugin manager machinery - simplify internal collection tree by introducing a RootCollector node - fix assert reinterpreation that sees a call containing "keyword=..." -- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish - hooks on slaves during dist-testing, report module/session teardown +- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish + hooks on slaves during dist-testing, report module/session teardown hooks correctly. -- fix issue65: properly handle dist-testing if no - execnet/py lib installed remotely. +- fix issue65: properly handle dist-testing if no + execnet/py lib installed remotely. - skip some install-tests if no execnet is available @@ -354,15 +354,15 @@ Changes between 1.2 and 1.1.1 Changes between 1.1.1 and 1.1.0 ===================================== -- introduce automatic plugin registration via 'pytest11' +- introduce automatic plugin registration via 'pytest11' entrypoints via setuptools' pkg_resources.iter_entry_points -- fix py.test dist-testing to work with execnet >= 1.0.0b4 +- fix py.test dist-testing to work with execnet >= 1.0.0b4 -- re-introduce py.test.cmdline.main() for better backward compatibility +- re-introduce py.test.cmdline.main() for better backward compatibility - svn paths: fix a bug with path.check(versioned=True) for svn paths, - allow '%' in svn paths, make svnwc.update() default to interactive mode + allow '%' in svn paths, make svnwc.update() default to interactive mode like in 1.0.x and add svnwc.update(interactive=False) to inhibit interaction. - refine distributed tarball to contain test and no pyc files @@ -377,16 +377,16 @@ Changes between 1.1.0 and 1.0.2 * remove py.rest tool and internal namespace - it was never really advertised and can still be used with - the old release if needed. If there is interest + the old release if needed. If there is interest it could be revived into its own tool i guess. * fix issue48 and issue59: raise an Error if the module - from an imported test file does not seem to come from + from an imported test file does not seem to come from the filepath - avoids "same-name" confusion that has been reported repeatedly * merged Ronny's nose-compatibility hacks: now - nose-style setup_module() and setup() functions are + nose-style setup_module() and setup() functions are supported * introduce generalized py.test.mark function marking @@ -395,112 +395,112 @@ Changes between 1.1.0 and 1.0.2 * deprecate parser.addgroup in favour of getgroup which creates option group -* add --report command line option that allows to control showing of skipped/xfailed sections +* add --report command line option that allows to control showing of skipped/xfailed sections -* generalized skipping: a new way to mark python functions with skipif or xfail - at function, class and modules level based on platform or sys-module attributes. +* generalized skipping: a new way to mark python functions with skipif or xfail + at function, class and modules level based on platform or sys-module attributes. * extend py.test.mark decorator to allow for positional args -* introduce and test "py.cleanup -d" to remove empty directories +* introduce and test "py.cleanup -d" to remove empty directories * fix issue #59 - robustify unittest test collection -* make bpython/help interaction work by adding an __all__ attribute +* make bpython/help interaction work by adding an __all__ attribute to ApiModule, cleanup initpkg * use MIT license for pylib, add some contributors * remove py.execnet code and substitute all usages with 'execnet' proper -* fix issue50 - cached_setup now caches more to expectations - for test functions with multiple arguments. +* fix issue50 - cached_setup now caches more to expectations + for test functions with multiple arguments. * merge Jarko's fixes, issue #45 and #46 * add the ability to specify a path for py.lookup to search in -* fix a funcarg cached_setup bug probably only occuring - in distributed testing and "module" scope with teardown. +* fix a funcarg cached_setup bug probably only occuring + in distributed testing and "module" scope with teardown. * many fixes and changes for making the code base python3 compatible, - many thanks to Benjamin Peterson for helping with this. + many thanks to Benjamin Peterson for helping with this. -* consolidate builtins implementation to be compatible with >=2.3, +* consolidate builtins implementation to be compatible with >=2.3, add helpers to ease keeping 2 and 3k compatible code * deprecate py.compat.doctest|subprocess|textwrap|optparse -* deprecate py.magic.autopath, remove py/magic directory +* deprecate py.magic.autopath, remove py/magic directory * move pytest assertion handling to py/code and a pytest_assertion - plugin, add "--no-assert" option, deprecate py.magic namespaces - in favour of (less) py.code ones. + plugin, add "--no-assert" option, deprecate py.magic namespaces + in favour of (less) py.code ones. -* consolidate and cleanup py/code classes and files +* consolidate and cleanup py/code classes and files -* cleanup py/misc, move tests to bin-for-dist +* cleanup py/misc, move tests to bin-for-dist -* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg +* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg -* consolidate py.log implementation, remove old approach. +* consolidate py.log implementation, remove old approach. * introduce py.io.TextIO and py.io.BytesIO for distinguishing between - text/unicode and byte-streams (uses underlying standard lib io.* - if available) + text/unicode and byte-streams (uses underlying standard lib io.* + if available) -* make py.unittest_convert helper script available which converts "unittest.py" +* make py.unittest_convert helper script available which converts "unittest.py" style files into the simpler assert/direct-test-classes py.test/nosetests - style. The script was written by Laura Creighton. - -* simplified internal localpath implementation + style. The script was written by Laura Creighton. + +* simplified internal localpath implementation Changes between 1.0.1 and 1.0.2 ===================================== -* fixing packaging issues, triggered by fedora redhat packaging, - also added doc, examples and contrib dirs to the tarball. +* fixing packaging issues, triggered by fedora redhat packaging, + also added doc, examples and contrib dirs to the tarball. -* added a documentation link to the new django plugin. +* added a documentation link to the new django plugin. Changes between 1.0.0 and 1.0.1 ===================================== -* added a 'pytest_nose' plugin which handles nose.SkipTest, - nose-style function/method/generator setup/teardown and - tries to report functions correctly. +* added a 'pytest_nose' plugin which handles nose.SkipTest, + nose-style function/method/generator setup/teardown and + tries to report functions correctly. -* capturing of unicode writes or encoded strings to sys.stdout/err - work better, also terminalwriting was adapted and somewhat - unified between windows and linux. +* capturing of unicode writes or encoded strings to sys.stdout/err + work better, also terminalwriting was adapted and somewhat + unified between windows and linux. * improved documentation layout and content a lot * added a "--help-config" option to show conftest.py / ENV-var names for - all longopt cmdline options, and some special conftest.py variables. - renamed 'conf_capture' conftest setting to 'option_capture' accordingly. + all longopt cmdline options, and some special conftest.py variables. + renamed 'conf_capture' conftest setting to 'option_capture' accordingly. -* fix issue #27: better reporting on non-collectable items given on commandline +* fix issue #27: better reporting on non-collectable items given on commandline (e.g. pyc files) -* fix issue #33: added --version flag (thanks Benjamin Peterson) +* fix issue #33: added --version flag (thanks Benjamin Peterson) * fix issue #32: adding support for "incomplete" paths to wcpath.status() -* "Test" prefixed classes are *not* collected by default anymore if they - have an __init__ method +* "Test" prefixed classes are *not* collected by default anymore if they + have an __init__ method * monkeypatch setenv() now accepts a "prepend" parameter * improved reporting of collection error tracebacks -* simplified multicall mechanism and plugin architecture, - renamed some internal methods and argnames +* simplified multicall mechanism and plugin architecture, + renamed some internal methods and argnames Changes between 1.0.0b9 and 1.0.0 ===================================== -* more terse reporting try to show filesystem path relatively to current dir +* more terse reporting try to show filesystem path relatively to current dir * improve xfail output a bit Changes between 1.0.0b8 and 1.0.0b9 @@ -513,26 +513,26 @@ Changes between 1.0.0b8 and 1.0.0b9 * setup/teardown or collection problems now show as ERRORs or with big "E"'s in the progress lines. they are reported - and counted separately. - -* dist-testing: properly handle test items that get locally - collected but cannot be collected on the remote side - often + and counted separately. + +* dist-testing: properly handle test items that get locally + collected but cannot be collected on the remote side - often due to platform/dependency reasons * simplified py.test.mark API - see keyword plugin documentation * integrate better with logging: capturing now by default captures - test functions and their immediate setup/teardown in a single stream + test functions and their immediate setup/teardown in a single stream * capsys and capfd funcargs now have a readouterr() and a close() method - (underlyingly py.io.StdCapture/FD objects are used which grew a + (underlyingly py.io.StdCapture/FD objects are used which grew a readouterr() method as well to return snapshots of captured out/err) -* make assert-reinterpretation work better with comparisons not +* make assert-reinterpretation work better with comparisons not returning bools (reported with numpy from thanks maciej fijalkowski) -* reworked per-test output capturing into the pytest_iocapture.py plugin - and thus removed capturing code from config object +* reworked per-test output capturing into the pytest_iocapture.py plugin + and thus removed capturing code from config object * item.repr_failure(excinfo) instead of item.repr_failure(excinfo, outerr) @@ -542,126 +542,126 @@ Changes between 1.0.0b7 and 1.0.0b8 * pytest_unittest-plugin is now enabled by default -* introduced pytest_keyboardinterrupt hook and - refined pytest_sessionfinish hooked, added tests. +* introduced pytest_keyboardinterrupt hook and + refined pytest_sessionfinish hooked, added tests. * workaround a buggy logging module interaction ("closing already closed - files"). Thanks to Sridhar Ratnakumar for triggering. + files"). Thanks to Sridhar Ratnakumar for triggering. -* if plugins use "py.test.importorskip" for importing - a dependency only a warning will be issued instead - of exiting the testing process. +* if plugins use "py.test.importorskip" for importing + a dependency only a warning will be issued instead + of exiting the testing process. -* many improvements to docs: +* many improvements to docs: - refined funcargs doc , use the term "factory" instead of "provider" - - added a new talk/tutorial doc page + - added a new talk/tutorial doc page - better download page - better plugin docstrings - added new plugins page and automatic doc generation script -* fixed teardown problem related to partially failing funcarg setups - (thanks MrTopf for reporting), "pytest_runtest_teardown" is now - always invoked even if the "pytest_runtest_setup" failed. +* fixed teardown problem related to partially failing funcarg setups + (thanks MrTopf for reporting), "pytest_runtest_teardown" is now + always invoked even if the "pytest_runtest_setup" failed. -* tweaked doctest output for docstrings in py modules, - thanks Radomir. +* tweaked doctest output for docstrings in py modules, + thanks Radomir. Changes between 1.0.0b3 and 1.0.0b7 ============================================= -* renamed py.test.xfail back to py.test.mark.xfail to avoid +* renamed py.test.xfail back to py.test.mark.xfail to avoid two ways to decorate for xfail -* re-added py.test.mark decorator for setting keywords on functions - (it was actually documented so removing it was not nice) +* re-added py.test.mark decorator for setting keywords on functions + (it was actually documented so removing it was not nice) -* remove scope-argument from request.addfinalizer() because - request.cached_setup has the scope arg. TOOWTDI. +* remove scope-argument from request.addfinalizer() because + request.cached_setup has the scope arg. TOOWTDI. * perform setup finalization before reporting failures -* apply modified patches from Andreas Kloeckner to allow - test functions to have no func_code (#22) and to make - "-k" and function keywords work (#20) +* apply modified patches from Andreas Kloeckner to allow + test functions to have no func_code (#22) and to make + "-k" and function keywords work (#20) -* apply patch from Daniel Peolzleithner (issue #23) +* apply patch from Daniel Peolzleithner (issue #23) -* resolve issue #18, multiprocessing.Manager() and - redirection clash +* resolve issue #18, multiprocessing.Manager() and + redirection clash * make __name__ == "__channelexec__" for remote_exec code Changes between 1.0.0b1 and 1.0.0b3 ============================================= -* plugin classes are removed: one now defines - hooks directly in conftest.py or global pytest_*.py - files. +* plugin classes are removed: one now defines + hooks directly in conftest.py or global pytest_*.py + files. -* added new pytest_namespace(config) hook that allows - to inject helpers directly to the py.test.* namespace. +* added new pytest_namespace(config) hook that allows + to inject helpers directly to the py.test.* namespace. -* documented and refined many hooks +* documented and refined many hooks -* added new style of generative tests via - pytest_generate_tests hook that integrates - well with function arguments. - +* added new style of generative tests via + pytest_generate_tests hook that integrates + well with function arguments. + Changes between 0.9.2 and 1.0.0b1 ============================================= -* introduced new "funcarg" setup method, - see doc/test/funcarg.txt +* introduced new "funcarg" setup method, + see doc/test/funcarg.txt -* introduced plugin architecuture and many - new py.test plugins, see +* introduced plugin architecuture and many + new py.test plugins, see doc/test/plugins.txt -* teardown_method is now guaranteed to get - called after a test method has run. - +* teardown_method is now guaranteed to get + called after a test method has run. + * new method: py.test.importorskip(mod,minversion) will either import or call py.test.skip() * completely revised internal py.test architecture -* new py.process.ForkedFunc object allowing to +* new py.process.ForkedFunc object allowing to fork execution of a function to a sub process - and getting a result back. + and getting a result back. XXX lots of things missing here XXX Changes between 0.9.1 and 0.9.2 =============================== -* refined installation and metadata, created new setup.py, - now based on setuptools/ez_setup (thanks to Ralf Schmitt +* refined installation and metadata, created new setup.py, + now based on setuptools/ez_setup (thanks to Ralf Schmitt for his support). -* improved the way of making py.* scripts available in - windows environments, they are now added to the - Scripts directory as ".cmd" files. +* improved the way of making py.* scripts available in + windows environments, they are now added to the + Scripts directory as ".cmd" files. -* py.path.svnwc.status() now is more complete and +* py.path.svnwc.status() now is more complete and uses xml output from the 'svn' command if available (Guido Wesdorp) * fix for py.path.svn* to work with svn 1.5 (Chris Lamb) -* fix path.relto(otherpath) method on windows to +* fix path.relto(otherpath) method on windows to use normcase for checking if a path is relative. -* py.test's traceback is better parseable from editors +* py.test's traceback is better parseable from editors (follows the filenames:LINENO: MSG convention) (thanks to Osmo Salomaa) -* fix to javascript-generation, "py.test --runbrowser" +* fix to javascript-generation, "py.test --runbrowser" should work more reliably now -* removed previously accidentally added - py.test.broken and py.test.notimplemented helpers. +* removed previously accidentally added + py.test.broken and py.test.notimplemented helpers. * there now is a py.__version__ attribute --- a/doc/execnet.txt +++ b/doc/execnet.txt @@ -1,12 +1,12 @@ ============================================================================== -py.execnet: *elastic* distributed programming +py.execnet: *elastic* distributed programming ============================================================================== Since pylib 1.1 "py.execnet" ceased to exist and is now available as a separately developed `execnet standalone package`_. -If you have previosly used "py.execnet.*" and the 1.0 API just -rename all occurences of the string "``py.execnet.``" with the +If you have previosly used "py.execnet.*" and the 1.0 API just +rename all occurences of the string "``py.execnet.``" with the string "``execnet.``" as execnet-1.0 is API compatible. -.. _`execnet standalone package`: http://codespeak.net/execnet +.. _`execnet standalone package`: http://codespeak.net/execnet --- a/doc/example/funcarg/mysetup/__init__.py +++ b/doc/example/funcarg/mysetup/__init__.py @@ -1,1 +1,1 @@ -# XXX this file should not need to be here but is here for proper sys.path mangling +# XXX this file should not need to be here but is here for proper sys.path mangling --- a/doc/announce/release-0.9.2.txt +++ b/doc/announce/release-0.9.2.txt @@ -1,17 +1,17 @@ py lib 0.9.2: bugfix release ============================= -Welcome to the 0.9.2 py lib and py.test release - +Welcome to the 0.9.2 py lib and py.test release - mainly fixing Windows issues, providing better packaging and integration with setuptools. -Here is a quick summary of what the py lib provides: +Here is a quick summary of what the py lib provides: * py.test: cross-project testing tool with many advanced features * py.execnet: ad-hoc code distribution to SSH, Socket and local sub processes * py.magic.greenlet: micro-threads on standard CPython ("stackless-light") -* py.path: path abstractions over local and subversion files -* rich documentation of py's exported API +* py.path: path abstractions over local and subversion files +* rich documentation of py's exported API * tested against Linux, Win32, OSX, works on python 2.3-2.6 See here for more information: --- a/doc/example/funcarg/mysetup2/test_ssh.py +++ b/doc/example/funcarg/mysetup2/test_ssh.py @@ -2,4 +2,4 @@ class TestClass: def test_function(self, mysetup): conn = mysetup.getsshconnection() - # work with conn + # work with conn --- a/contrib/pytest_ignoreout.py +++ b/contrib/pytest_ignoreout.py @@ -5,4 +5,4 @@ def pytest_runtest_call(item, __multical try: return __multicall__.execute() finally: - outerr = cap.reset() + outerr = cap.reset() --- a/bin-for-dist/test_install.py +++ b/bin-for-dist/test_install.py @@ -13,9 +13,9 @@ pytest_plugins = 'pytest_pytester', def pytest_funcarg__venv(request): p = request.config.mktemp(request.function.__name__, numbered=True) - venv = VirtualEnv(str(p)) - return venv - + venv = VirtualEnv(str(p)) + return venv + def pytest_funcarg__py_setup(request): testdir = request.getfuncargvalue('testdir') rootdir = py.path.local(py.__file__).dirpath().dirpath() @@ -48,14 +48,14 @@ class SetupBuilder: destdir = py.path.local(destdir) target = destdir.join(sdist.basename) sdist.copy(target) - return target + return target def subcall(args): if hasattr(subprocess, 'check_call'): subprocess.check_call(args) else: subprocess.call(args) -# code taken from Ronny Pfannenschmidt's virtualenvmanager +# code taken from Ronny Pfannenschmidt's virtualenvmanager class VirtualEnv(object): def __init__(self, path): @@ -119,7 +119,7 @@ class VirtualEnv(object): def test_make_sdist_and_run_it(py_setup, venv): sdist = py_setup.make_sdist(venv.path) - venv.easy_install(str(sdist)) + venv.easy_install(str(sdist)) gw = venv.makegateway() ch = gw.remote_exec("import py ; channel.send(py.__version__)") version = ch.receive() @@ -127,7 +127,7 @@ def test_make_sdist_and_run_it(py_setup, def test_plugin_setuptools_entry_point_integration(py_setup, venv, tmpdir): sdist = py_setup.make_sdist(venv.path) - venv.easy_install(str(sdist)) + venv.easy_install(str(sdist)) # create a sample plugin basedir = tmpdir.mkdir("testplugin") basedir.join("setup.py").write("""if 1: @@ -151,7 +151,7 @@ def test_cmdline_entrypoints(monkeypatch monkeypatch.syspath_prepend(py.path.local(__file__).dirpath().dirpath()) from setup import cmdline_entrypoints versioned_scripts = ['py.test', 'py.which'] - unversioned_scripts = versioned_scripts + [ 'py.cleanup', + unversioned_scripts = versioned_scripts + [ 'py.cleanup', 'py.convert_unittest', 'py.countloc', 'py.lookup', 'py.svnwcrevert'] for ver in [(2,4,0), (2,5,0), (2,6,0), (2,7,0), (3,0,1), (3,1,1)]: for platform in ('posix', 'win32'): @@ -187,7 +187,7 @@ def test_slave_popen_needs_no_pylib(test def test_func(): pass """) - result = testdir.runpytest(p, '--rsyncdir=%s' % str(p), + result = testdir.runpytest(p, '--rsyncdir=%s' % str(p), '--dist=each', '--tx=popen//python=%s' % python) result.stdout.fnmatch_lines([ "*1 passed*" @@ -215,13 +215,13 @@ def test_slave_needs_no_execnet(testdir, ch = gw.remote_exec("import execnet") py.test.raises(ch.RemoteError, ch.waitclose) gw.exit() - + p = testdir.makepyfile(""" import py def test_func(): pass """) - result = testdir.runpytest(p, '--rsyncdir=%s' % str(p), + result = testdir.runpytest(p, '--rsyncdir=%s' % str(p), '--dist=each', '--tx=%s' % newspec) result.stdout.fnmatch_lines([ "*1 passed*" --- a/doc/announce/release-1.3.0.txt +++ b/doc/announce/release-1.3.0.txt @@ -1,10 +1,10 @@ -py.test/pylib 1.3.0: new options, per-plugin hooks, fixes ... +py.test/pylib 1.3.0: new options, per-plugin hooks, fixes ... =========================================================================== -The 1.3.0 release introduces new options, bug fixes and improved compatibility +The 1.3.0 release introduces new options, bug fixes and improved compatibility with Python3 and Jython-2.5.1 on Windows. If you already use py-1.2 chances -are you can use py-1.3.0. See the below CHANGELOG for more details and -http://pylib.org/install.html for installation instructions. +are you can use py-1.3.0. See the below CHANGELOG for more details and +http://pylib.org/install.html for installation instructions. py.test is an advanced automated testing tool working with Python2, Python3, Jython and PyPy versions on all major operating systems. It @@ -12,7 +12,7 @@ offers a no-boilerplate testing approach tools and enhancements in the standard Python library for more than five years. It has a simple and extensive plugin architecture, configurable reporting and provides unique ways to make it fit to your testing -process and needs. +process and needs. See http://pytest.org for more info. @@ -26,28 +26,28 @@ Changes between 1.2.1 and 1.3.0 - deprecate --report option in favour of a new shorter and easier to remember -r option: it takes a string argument consisting of any combination of 'xfsX' characters. They relate to the single chars - you see during the dotted progress printing and will print an extra line + you see during the dotted progress printing and will print an extra line per test at the end of the test run. This extra line indicates the exact position or test ID that you directly paste to the py.test cmdline in order - to re-run a particular test. + to re-run a particular test. -- allow external plugins to register new hooks via the new +- allow external plugins to register new hooks via the new pytest_addhooks(pluginmanager) hook. The new release of - the pytest-xdist plugin for distributed and looponfailing - testing requires this feature. + the pytest-xdist plugin for distributed and looponfailing + testing requires this feature. - add a new pytest_ignore_collect(path, config) hook to allow projects and - plugins to define exclusion behaviour for their directory structure - + plugins to define exclusion behaviour for their directory structure - for example you may define in a conftest.py this method:: def pytest_ignore_collect(path): return path.check(link=1) - to prevent even collection of any tests in symlinked dirs. + to prevent even collection of any tests in symlinked dirs. - new pytest_pycollect_makemodule(path, parent) hook for - allowing customization of the Module collection object for a - matching test module. + allowing customization of the Module collection object for a + matching test module. - extend and refine xfail mechanism:: @@ -55,14 +55,14 @@ Changes between 1.2.1 and 1.3.0 @py.test.mark.xfail(reason="...") prints the reason string in xfail summaries specifiying ``--runxfail`` on command line ignores xfail markers to show - you the underlying traceback. + you the underlying traceback. -- expose (previously internal) commonly useful methods: +- expose (previously internal) commonly useful methods: py.io.get_terminal_with() -> return terminal width py.io.ansi_print(...) -> print colored/bold text on linux/win32 py.io.saferepr(obj) -> return limited representation string -- expose test outcome related exceptions as py.test.skip.Exception, +- expose test outcome related exceptions as py.test.skip.Exception, py.test.raises.Exception etc., useful mostly for plugins doing special outcome interpretation/tweaking @@ -70,22 +70,22 @@ Changes between 1.2.1 and 1.3.0 - fix/refine python3 compatibility (thanks Benjamin Peterson) -- fixes for making the jython/win32 combination work, note however: +- fixes for making the jython/win32 combination work, note however: jython2.5.1/win32 does not provide a command line launcher, see http://bugs.jython.org/issue1491 . See pylib install documentation - for how to work around. + for how to work around. - fixes for handling of unicode exception values and unprintable objects -- (issue87) fix unboundlocal error in assertionold code +- (issue87) fix unboundlocal error in assertionold code - (issue86) improve documentation for looponfailing - refine IO capturing: stdin-redirect pseudo-file now has a NOP close() method -- ship distribute_setup.py version 0.6.10 +- ship distribute_setup.py version 0.6.10 -- added links to the new capturelog and coverage plugins +- added links to the new capturelog and coverage plugins Changes between 1.2.1 and 1.2.0 @@ -96,79 +96,79 @@ Changes between 1.2.1 and 1.2.0 py.cleanup # remove "*.pyc" and "*$py.class" (jython) files py.cleanup -e .swp -e .cache # also remove files with these extensions py.cleanup -s # remove "build" and "dist" directory next to setup.py files - py.cleanup -d # also remove empty directories + py.cleanup -d # also remove empty directories py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'" py.cleanup -n # dry run, only show what would be removed -- add a new option "py.test --funcargs" which shows available funcargs - and their help strings (docstrings on their respective factory function) +- add a new option "py.test --funcargs" which shows available funcargs + and their help strings (docstrings on their respective factory function) for a given test path -- display a short and concise traceback if a funcarg lookup fails +- display a short and concise traceback if a funcarg lookup fails -- early-load "conftest.py" files in non-dot first-level sub directories. - allows to conveniently keep and access test-related options in a ``test`` - subdir and still add command line options. +- early-load "conftest.py" files in non-dot first-level sub directories. + allows to conveniently keep and access test-related options in a ``test`` + subdir and still add command line options. - fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value - fix issue78: always call python-level teardown functions even if the - according setup failed. This includes refinements for calling setup_module/class functions + according setup failed. This includes refinements for calling setup_module/class functions which will now only be called once instead of the previous behaviour where they'd be called multiple times if they raise an exception (including a Skipped exception). Any exception will be re-corded and associated with all tests in the according module/class scope. - fix issue63: assume <40 columns to be a bogus terminal width, default to 80 -- fix pdb debugging to be in the correct frame on raises-related errors +- fix pdb debugging to be in the correct frame on raises-related errors - update apipkg.py to fix an issue where recursive imports might - unnecessarily break importing + unnecessarily break importing -- fix plugin links +- fix plugin links Changes between 1.2 and 1.1.1 ===================================== -- moved dist/looponfailing from py.test core into a new +- moved dist/looponfailing from py.test core into a new separately released pytest-xdist plugin. - new junitxml plugin: --junitxml=path will generate a junit style xml file - which is processable e.g. by the Hudson CI system. + which is processable e.g. by the Hudson CI system. - new option: --genscript=path will generate a standalone py.test script - which will not need any libraries installed. thanks to Ralf Schmitt. + which will not need any libraries installed. thanks to Ralf Schmitt. -- new option: --ignore will prevent specified path from collection. - Can be specified multiple times. +- new option: --ignore will prevent specified path from collection. + Can be specified multiple times. -- new option: --confcutdir=dir will make py.test only consider conftest - files that are relative to the specified dir. +- new option: --confcutdir=dir will make py.test only consider conftest + files that are relative to the specified dir. - new funcarg: "pytestconfig" is the pytest config object for access - to command line args and can now be easily used in a test. + to command line args and can now be easily used in a test. - install 'py.test' and `py.which` with a ``-$VERSION`` suffix to - disambiguate between Python3, python2.X, Jython and PyPy installed versions. + disambiguate between Python3, python2.X, Jython and PyPy installed versions. - new "pytestconfig" funcarg allows access to test config object -- new "pytest_report_header" hook can return additional lines - to be displayed at the header of a test run. +- new "pytest_report_header" hook can return additional lines + to be displayed at the header of a test run. - (experimental) allow "py.test path::name1::name2::..." for pointing to a test within a test collection directly. This might eventually - evolve as a full substitute to "-k" specifications. + evolve as a full substitute to "-k" specifications. - streamlined plugin loading: order is now as documented in - customize.html: setuptools, ENV, commandline, conftest. + customize.html: setuptools, ENV, commandline, conftest. also setuptools entry point names are turned to canonical namees ("pytest_*") -- automatically skip tests that need 'capfd' but have no os.dup +- automatically skip tests that need 'capfd' but have no os.dup -- allow pytest_generate_tests to be defined in classes as well +- allow pytest_generate_tests to be defined in classes as well -- deprecate usage of 'disabled' attribute in favour of pytestmark +- deprecate usage of 'disabled' attribute in favour of pytestmark - deprecate definition of Directory, Module, Class and Function nodes in conftest.py files. Use pytest collect hooks instead. @@ -183,28 +183,28 @@ Changes between 1.2 and 1.1.1 change its long command line options to be a bit shorter (see py.test -h). - change: pytest doctest plugin is now enabled by default and has a - new option --doctest-glob to set a pattern for file matches. + new option --doctest-glob to set a pattern for file matches. -- change: remove internal py._* helper vars, only keep py._pydir +- change: remove internal py._* helper vars, only keep py._pydir -- robustify capturing to survive if custom pytest_runtest_setup - code failed and prevented the capturing setup code from running. +- robustify capturing to survive if custom pytest_runtest_setup + code failed and prevented the capturing setup code from running. - make py.test.* helpers provided by default plugins visible early - works transparently both for pydoc and for interactive sessions - which will regularly see e.g. py.test.mark and py.test.importorskip. + which will regularly see e.g. py.test.mark and py.test.importorskip. -- simplify internal plugin manager machinery +- simplify internal plugin manager machinery - simplify internal collection tree by introducing a RootCollector node - fix assert reinterpreation that sees a call containing "keyword=..." -- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish - hooks on slaves during dist-testing, report module/session teardown +- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish + hooks on slaves during dist-testing, report module/session teardown hooks correctly. -- fix issue65: properly handle dist-testing if no - execnet/py lib installed remotely. +- fix issue65: properly handle dist-testing if no + execnet/py lib installed remotely. - skip some install-tests if no execnet is available @@ -214,15 +214,15 @@ Changes between 1.2 and 1.1.1 Changes between 1.1.1 and 1.1.0 ===================================== -- introduce automatic plugin registration via 'pytest11' +- introduce automatic plugin registration via 'pytest11' entrypoints via setuptools' pkg_resources.iter_entry_points -- fix py.test dist-testing to work with execnet >= 1.0.0b4 +- fix py.test dist-testing to work with execnet >= 1.0.0b4 -- re-introduce py.test.cmdline.main() for better backward compatibility +- re-introduce py.test.cmdline.main() for better backward compatibility - svn paths: fix a bug with path.check(versioned=True) for svn paths, - allow '%' in svn paths, make svnwc.update() default to interactive mode + allow '%' in svn paths, make svnwc.update() default to interactive mode like in 1.0.x and add svnwc.update(interactive=False) to inhibit interaction. - refine distributed tarball to contain test and no pyc files @@ -237,16 +237,16 @@ Changes between 1.1.0 and 1.0.2 * remove py.rest tool and internal namespace - it was never really advertised and can still be used with - the old release if needed. If there is interest + the old release if needed. If there is interest it could be revived into its own tool i guess. * fix issue48 and issue59: raise an Error if the module - from an imported test file does not seem to come from + from an imported test file does not seem to come from the filepath - avoids "same-name" confusion that has been reported repeatedly * merged Ronny's nose-compatibility hacks: now - nose-style setup_module() and setup() functions are + nose-style setup_module() and setup() functions are supported * introduce generalized py.test.mark function marking @@ -255,112 +255,112 @@ Changes between 1.1.0 and 1.0.2 * deprecate parser.addgroup in favour of getgroup which creates option group -* add --report command line option that allows to control showing of skipped/xfailed sections +* add --report command line option that allows to control showing of skipped/xfailed sections -* generalized skipping: a new way to mark python functions with skipif or xfail - at function, class and modules level based on platform or sys-module attributes. +* generalized skipping: a new way to mark python functions with skipif or xfail + at function, class and modules level based on platform or sys-module attributes. * extend py.test.mark decorator to allow for positional args -* introduce and test "py.cleanup -d" to remove empty directories +* introduce and test "py.cleanup -d" to remove empty directories * fix issue #59 - robustify unittest test collection -* make bpython/help interaction work by adding an __all__ attribute +* make bpython/help interaction work by adding an __all__ attribute to ApiModule, cleanup initpkg * use MIT license for pylib, add some contributors * remove py.execnet code and substitute all usages with 'execnet' proper -* fix issue50 - cached_setup now caches more to expectations - for test functions with multiple arguments. +* fix issue50 - cached_setup now caches more to expectations + for test functions with multiple arguments. * merge Jarko's fixes, issue #45 and #46 * add the ability to specify a path for py.lookup to search in -* fix a funcarg cached_setup bug probably only occuring - in distributed testing and "module" scope with teardown. +* fix a funcarg cached_setup bug probably only occuring + in distributed testing and "module" scope with teardown. * many fixes and changes for making the code base python3 compatible, - many thanks to Benjamin Peterson for helping with this. + many thanks to Benjamin Peterson for helping with this. -* consolidate builtins implementation to be compatible with >=2.3, +* consolidate builtins implementation to be compatible with >=2.3, add helpers to ease keeping 2 and 3k compatible code * deprecate py.compat.doctest|subprocess|textwrap|optparse -* deprecate py.magic.autopath, remove py/magic directory +* deprecate py.magic.autopath, remove py/magic directory * move pytest assertion handling to py/code and a pytest_assertion - plugin, add "--no-assert" option, deprecate py.magic namespaces - in favour of (less) py.code ones. + plugin, add "--no-assert" option, deprecate py.magic namespaces + in favour of (less) py.code ones. -* consolidate and cleanup py/code classes and files +* consolidate and cleanup py/code classes and files -* cleanup py/misc, move tests to bin-for-dist +* cleanup py/misc, move tests to bin-for-dist -* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg +* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg -* consolidate py.log implementation, remove old approach. +* consolidate py.log implementation, remove old approach. * introduce py.io.TextIO and py.io.BytesIO for distinguishing between - text/unicode and byte-streams (uses underlying standard lib io.* - if available) + text/unicode and byte-streams (uses underlying standard lib io.* + if available) -* make py.unittest_convert helper script available which converts "unittest.py" +* make py.unittest_convert helper script available which converts "unittest.py" style files into the simpler assert/direct-test-classes py.test/nosetests - style. The script was written by Laura Creighton. - -* simplified internal localpath implementation + style. The script was written by Laura Creighton. + +* simplified internal localpath implementation Changes between 1.0.1 and 1.0.2 ===================================== -* fixing packaging issues, triggered by fedora redhat packaging, - also added doc, examples and contrib dirs to the tarball. +* fixing packaging issues, triggered by fedora redhat packaging, + also added doc, examples and contrib dirs to the tarball. -* added a documentation link to the new django plugin. +* added a documentation link to the new django plugin. Changes between 1.0.0 and 1.0.1 ===================================== -* added a 'pytest_nose' plugin which handles nose.SkipTest, - nose-style function/method/generator setup/teardown and - tries to report functions correctly. +* added a 'pytest_nose' plugin which handles nose.SkipTest, + nose-style function/method/generator setup/teardown and + tries to report functions correctly. -* capturing of unicode writes or encoded strings to sys.stdout/err - work better, also terminalwriting was adapted and somewhat - unified between windows and linux. +* capturing of unicode writes or encoded strings to sys.stdout/err + work better, also terminalwriting was adapted and somewhat + unified between windows and linux. * improved documentation layout and content a lot * added a "--help-config" option to show conftest.py / ENV-var names for - all longopt cmdline options, and some special conftest.py variables. - renamed 'conf_capture' conftest setting to 'option_capture' accordingly. + all longopt cmdline options, and some special conftest.py variables. + renamed 'conf_capture' conftest setting to 'option_capture' accordingly. -* fix issue #27: better reporting on non-collectable items given on commandline +* fix issue #27: better reporting on non-collectable items given on commandline (e.g. pyc files) -* fix issue #33: added --version flag (thanks Benjamin Peterson) +* fix issue #33: added --version flag (thanks Benjamin Peterson) * fix issue #32: adding support for "incomplete" paths to wcpath.status() -* "Test" prefixed classes are *not* collected by default anymore if they - have an __init__ method +* "Test" prefixed classes are *not* collected by default anymore if they + have an __init__ method * monkeypatch setenv() now accepts a "prepend" parameter * improved reporting of collection error tracebacks -* simplified multicall mechanism and plugin architecture, - renamed some internal methods and argnames +* simplified multicall mechanism and plugin architecture, + renamed some internal methods and argnames Changes between 1.0.0b9 and 1.0.0 ===================================== -* more terse reporting try to show filesystem path relatively to current dir +* more terse reporting try to show filesystem path relatively to current dir * improve xfail output a bit Changes between 1.0.0b8 and 1.0.0b9 @@ -373,26 +373,26 @@ Changes between 1.0.0b8 and 1.0.0b9 * setup/teardown or collection problems now show as ERRORs or with big "E"'s in the progress lines. they are reported - and counted separately. - -* dist-testing: properly handle test items that get locally - collected but cannot be collected on the remote side - often + and counted separately. + +* dist-testing: properly handle test items that get locally + collected but cannot be collected on the remote side - often due to platform/dependency reasons * simplified py.test.mark API - see keyword plugin documentation * integrate better with logging: capturing now by default captures - test functions and their immediate setup/teardown in a single stream + test functions and their immediate setup/teardown in a single stream * capsys and capfd funcargs now have a readouterr() and a close() method - (underlyingly py.io.StdCapture/FD objects are used which grew a + (underlyingly py.io.StdCapture/FD objects are used which grew a readouterr() method as well to return snapshots of captured out/err) -* make assert-reinterpretation work better with comparisons not +* make assert-reinterpretation work better with comparisons not returning bools (reported with numpy from thanks maciej fijalkowski) -* reworked per-test output capturing into the pytest_iocapture.py plugin - and thus removed capturing code from config object +* reworked per-test output capturing into the pytest_iocapture.py plugin + and thus removed capturing code from config object * item.repr_failure(excinfo) instead of item.repr_failure(excinfo, outerr) @@ -402,126 +402,126 @@ Changes between 1.0.0b7 and 1.0.0b8 * pytest_unittest-plugin is now enabled by default -* introduced pytest_keyboardinterrupt hook and - refined pytest_sessionfinish hooked, added tests. +* introduced pytest_keyboardinterrupt hook and + refined pytest_sessionfinish hooked, added tests. * workaround a buggy logging module interaction ("closing already closed - files"). Thanks to Sridhar Ratnakumar for triggering. + files"). Thanks to Sridhar Ratnakumar for triggering. -* if plugins use "py.test.importorskip" for importing - a dependency only a warning will be issued instead - of exiting the testing process. +* if plugins use "py.test.importorskip" for importing + a dependency only a warning will be issued instead + of exiting the testing process. -* many improvements to docs: +* many improvements to docs: - refined funcargs doc , use the term "factory" instead of "provider" - - added a new talk/tutorial doc page + - added a new talk/tutorial doc page - better download page - better plugin docstrings - added new plugins page and automatic doc generation script -* fixed teardown problem related to partially failing funcarg setups - (thanks MrTopf for reporting), "pytest_runtest_teardown" is now - always invoked even if the "pytest_runtest_setup" failed. +* fixed teardown problem related to partially failing funcarg setups + (thanks MrTopf for reporting), "pytest_runtest_teardown" is now + always invoked even if the "pytest_runtest_setup" failed. -* tweaked doctest output for docstrings in py modules, - thanks Radomir. +* tweaked doctest output for docstrings in py modules, + thanks Radomir. Changes between 1.0.0b3 and 1.0.0b7 ============================================= -* renamed py.test.xfail back to py.test.mark.xfail to avoid +* renamed py.test.xfail back to py.test.mark.xfail to avoid two ways to decorate for xfail -* re-added py.test.mark decorator for setting keywords on functions - (it was actually documented so removing it was not nice) +* re-added py.test.mark decorator for setting keywords on functions + (it was actually documented so removing it was not nice) -* remove scope-argument from request.addfinalizer() because - request.cached_setup has the scope arg. TOOWTDI. +* remove scope-argument from request.addfinalizer() because + request.cached_setup has the scope arg. TOOWTDI. * perform setup finalization before reporting failures -* apply modified patches from Andreas Kloeckner to allow - test functions to have no func_code (#22) and to make - "-k" and function keywords work (#20) +* apply modified patches from Andreas Kloeckner to allow + test functions to have no func_code (#22) and to make + "-k" and function keywords work (#20) -* apply patch from Daniel Peolzleithner (issue #23) +* apply patch from Daniel Peolzleithner (issue #23) -* resolve issue #18, multiprocessing.Manager() and - redirection clash +* resolve issue #18, multiprocessing.Manager() and + redirection clash * make __name__ == "__channelexec__" for remote_exec code Changes between 1.0.0b1 and 1.0.0b3 ============================================= -* plugin classes are removed: one now defines - hooks directly in conftest.py or global pytest_*.py - files. +* plugin classes are removed: one now defines + hooks directly in conftest.py or global pytest_*.py + files. -* added new pytest_namespace(config) hook that allows - to inject helpers directly to the py.test.* namespace. +* added new pytest_namespace(config) hook that allows + to inject helpers directly to the py.test.* namespace. -* documented and refined many hooks +* documented and refined many hooks -* added new style of generative tests via - pytest_generate_tests hook that integrates - well with function arguments. - +* added new style of generative tests via + pytest_generate_tests hook that integrates + well with function arguments. + Changes between 0.9.2 and 1.0.0b1 ============================================= -* introduced new "funcarg" setup method, - see doc/test/funcarg.txt +* introduced new "funcarg" setup method, + see doc/test/funcarg.txt -* introduced plugin architecuture and many - new py.test plugins, see +* introduced plugin architecuture and many + new py.test plugins, see doc/test/plugins.txt -* teardown_method is now guaranteed to get - called after a test method has run. - +* teardown_method is now guaranteed to get + called after a test method has run. + * new method: py.test.importorskip(mod,minversion) will either import or call py.test.skip() * completely revised internal py.test architecture -* new py.process.ForkedFunc object allowing to +* new py.process.ForkedFunc object allowing to fork execution of a function to a sub process - and getting a result back. + and getting a result back. XXX lots of things missing here XXX Changes between 0.9.1 and 0.9.2 =============================== -* refined installation and metadata, created new setup.py, - now based on setuptools/ez_setup (thanks to Ralf Schmitt +* refined installation and metadata, created new setup.py, + now based on setuptools/ez_setup (thanks to Ralf Schmitt for his support). -* improved the way of making py.* scripts available in - windows environments, they are now added to the - Scripts directory as ".cmd" files. +* improved the way of making py.* scripts available in + windows environments, they are now added to the + Scripts directory as ".cmd" files. -* py.path.svnwc.status() now is more complete and +* py.path.svnwc.status() now is more complete and uses xml output from the 'svn' command if available (Guido Wesdorp) * fix for py.path.svn* to work with svn 1.5 (Chris Lamb) -* fix path.relto(otherpath) method on windows to +* fix path.relto(otherpath) method on windows to use normcase for checking if a path is relative. -* py.test's traceback is better parseable from editors +* py.test's traceback is better parseable from editors (follows the filenames:LINENO: MSG convention) (thanks to Osmo Salomaa) -* fix to javascript-generation, "py.test --runbrowser" +* fix to javascript-generation, "py.test --runbrowser" should work more reliably now -* removed previously accidentally added - py.test.broken and py.test.notimplemented helpers. +* removed previously accidentally added + py.test.broken and py.test.notimplemented helpers. * there now is a py.__version__ attribute --- a/doc/announce/release-1.1.1.txt +++ b/doc/announce/release-1.1.1.txt @@ -5,19 +5,19 @@ This is a compatibility fixing release o better with previous 1.0.x test code bases. It also contains fixes and changes to work with `execnet>=1.0.0`_ to provide distributed testing and looponfailing testing modes. py-1.1.1 also introduces -a new mechanism for registering plugins via setuptools. +a new mechanism for registering plugins via setuptools. -What is pylib/py.test? +What is pylib/py.test? ----------------------- py.test is an advanced automated testing tool working with Python2, Python3 and Jython versions on all major operating -systems. It has an extensive plugin architecture and can run many +systems. It has an extensive plugin architecture and can run many existing common Python test suites without modification. Moreover, it offers some unique features not found in other testing tools. See http://pytest.org for more info. -The pylib also contains a localpath and svnpath implementation +The pylib also contains a localpath and svnpath implementation and some developer-oriented command line tools. See http://pylib.org for more info. @@ -31,15 +31,15 @@ holger (http://twitter.com/hpk42) Changes between 1.1.1 and 1.1.0 ===================================== -- introduce automatic plugin registration via 'pytest11' +- introduce automatic plugin registration via 'pytest11' entrypoints via setuptools' pkg_resources.iter_entry_points -- fix py.test dist-testing to work with execnet >= 1.0.0b4 +- fix py.test dist-testing to work with execnet >= 1.0.0b4 -- re-introduce py.test.cmdline.main() for better backward compatibility +- re-introduce py.test.cmdline.main() for better backward compatibility - svn paths: fix a bug with path.check(versioned=True) for svn paths, - allow '%' in svn paths, make svnwc.update() default to interactive mode + allow '%' in svn paths, make svnwc.update() default to interactive mode like in 1.0.x and add svnwc.update(interactive=False) to inhibit interaction. - refine distributed tarball to contain test and no pyc files From commits-noreply at bitbucket.org Wed Jul 28 18:01:37 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 28 Jul 2010 16:01:37 +0000 (UTC) Subject: [py-svn] py-trunk commit 2822b3c23af3: fix windows32 terminal coloring Message-ID: <20100728160137.3D91D5D67B@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280331206 -7200 # Node ID 2822b3c23af39c523050a1b6ff5fed27cdcd58ff # Parent ad5a1184cfc919e720d56ac8cacf10da7ea72c3b fix windows32 terminal coloring --- a/py/_io/terminalwriter.py +++ b/py/_io/terminalwriter.py @@ -78,9 +78,11 @@ def ansi_print(text, esc, file=None, new handle = GetStdHandle(STD_ERROR_HANDLE) else: handle = GetStdHandle(STD_OUTPUT_HANDLE) + oldcolors = GetConsoleInfo(handle).wAttributes + attr |= (oldcolors & 0x0f0) SetConsoleTextAttribute(handle, attr) file.write(text) - SetConsoleTextAttribute(handle, FOREGROUND_WHITE) + SetConsoleTextAttribute(handle, oldcolors) else: file.write(text) @@ -183,12 +185,12 @@ class TerminalWriter(object): class Win32ConsoleWriter(TerminalWriter): def write(self, s, **kw): if s: - s = self._getbytestring(s) - if self.hasmarkup: + oldcolors = None + if self.hasmarkup and kw: handle = GetStdHandle(STD_OUTPUT_HANDLE) - - if self.hasmarkup and kw: - attr = 0 + oldcolors = GetConsoleInfo(handle).wAttributes + default_bg = oldcolors & 0x00F0 + attr = default_bg if kw.pop('bold', False): attr |= FOREGROUND_INTENSITY @@ -199,13 +201,13 @@ class Win32ConsoleWriter(TerminalWriter) elif kw.pop('green', False): attr |= FOREGROUND_GREEN else: - attr |= FOREGROUND_WHITE + attr |= FOREGROUND_BLACK # (oldcolors & 0x0007) SetConsoleTextAttribute(handle, attr) self._file.write(s) self._file.flush() - if self.hasmarkup: - SetConsoleTextAttribute(handle, FOREGROUND_WHITE) + if oldcolors: + SetConsoleTextAttribute(handle, oldcolors) def line(self, s="", **kw): self.write(s+"\n", **kw) @@ -232,46 +234,50 @@ if win32_and_ctypes: # ctypes access to the Windows console STD_OUTPUT_HANDLE = -11 STD_ERROR_HANDLE = -12 + FOREGROUND_BLACK = 0x0000 # black text FOREGROUND_BLUE = 0x0001 # text color contains blue. FOREGROUND_GREEN = 0x0002 # text color contains green. FOREGROUND_RED = 0x0004 # text color contains red. FOREGROUND_WHITE = 0x0007 FOREGROUND_INTENSITY = 0x0008 # text color is intensified. + BACKGROUND_BLACK = 0x0000 # background color black BACKGROUND_BLUE = 0x0010 # background color contains blue. BACKGROUND_GREEN = 0x0020 # background color contains green. BACKGROUND_RED = 0x0040 # background color contains red. BACKGROUND_WHITE = 0x0070 BACKGROUND_INTENSITY = 0x0080 # background color is intensified. + SHORT = ctypes.c_short + class COORD(ctypes.Structure): + _fields_ = [('X', SHORT), + ('Y', SHORT)] + class SMALL_RECT(ctypes.Structure): + _fields_ = [('Left', SHORT), + ('Top', SHORT), + ('Right', SHORT), + ('Bottom', SHORT)] + class CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure): + _fields_ = [('dwSize', COORD), + ('dwCursorPosition', COORD), + ('wAttributes', wintypes.WORD), + ('srWindow', SMALL_RECT), + ('dwMaximumWindowSize', COORD)] + def GetStdHandle(kind): return ctypes.windll.kernel32.GetStdHandle(kind) - def SetConsoleTextAttribute(handle, attr): - ctypes.windll.kernel32.SetConsoleTextAttribute( - handle, attr) + SetConsoleTextAttribute = \ + ctypes.windll.kernel32.SetConsoleTextAttribute + + def GetConsoleInfo(handle): + info = CONSOLE_SCREEN_BUFFER_INFO() + ctypes.windll.kernel32.GetConsoleScreenBufferInfo(\ + handle, ctypes.byref(info)) + return info def _getdimensions(): - - SHORT = ctypes.c_short - class COORD(ctypes.Structure): - _fields_ = [('X', SHORT), - ('Y', SHORT)] - class SMALL_RECT(ctypes.Structure): - _fields_ = [('Left', SHORT), - ('Top', SHORT), - ('Right', SHORT), - ('Bottom', SHORT)] - class CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure): - _fields_ = [('dwSize', COORD), - ('dwCursorPosition', COORD), - ('wAttributes', wintypes.WORD), - ('srWindow', SMALL_RECT), - ('dwMaximumWindowSize', COORD)] - STD_OUTPUT_HANDLE = -11 handle = GetStdHandle(STD_OUTPUT_HANDLE) - info = CONSOLE_SCREEN_BUFFER_INFO() - ctypes.windll.kernel32.GetConsoleScreenBufferInfo( - handle, ctypes.byref(info)) + info = GetConsoleInfo(handle) # Substract one from the width, otherwise the cursor wraps # and the ending \n causes an empty line to display. return info.dwSize.Y, info.dwSize.X - 1 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Changes between 1.3.2 and 1.3.3a1 ================================================== +- fix terminal coloring for win32 + (thanks Michael Foord for reporting) - fix weirdness: make terminal width detection work on stdout instead of stdin (thanks Armin Ronacher for reporting) From commits-noreply at bitbucket.org Thu Jul 29 11:23:04 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 29 Jul 2010 09:23:04 +0000 (UTC) Subject: [py-svn] py-trunk commit 3e28f12e7c44: avoid loading conftest files which are exactly the same content as a previously loaded conftest file Message-ID: <20100729092304.73D677EF87@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280395336 -7200 # Node ID 3e28f12e7c443367ed0ed63f605aae68b96b512b # Parent 2822b3c23af39c523050a1b6ff5fed27cdcd58ff avoid loading conftest files which are exactly the same content as a previously loaded conftest file --- a/testing/plugin/test_pytest_terminal.py +++ b/testing/plugin/test_pytest_terminal.py @@ -644,7 +644,7 @@ def pytest_report_header(config): return ["line1", "line2"]""") result = testdir.runpytest("a") result.stdout.fnmatch_lines([ - "*hello: info*", "line1", "line2", + "*hello: info*", ]) --- a/tox.ini +++ b/tox.ini @@ -7,10 +7,9 @@ distshare={toxworkdir}/distshare sdistsrc={distshare}/py-* [testenv] -changedir=testing +changedir=testing commands= - py.test --confcutdir=.. -rfsxX \ - --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] + py.test -rfsxX --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] deps= pexpect [testenv:py27] @@ -21,7 +20,7 @@ deps= {distshare}/py-* {distshare}/pytest-xdist-* commands= - py.test -n3 --confcutdir=.. -rfsxX \ + py.test -n3 -rfsxX \ --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] [testenv:py26] @@ -29,19 +28,18 @@ basepython=python2.6 [testenv:doc] basepython=python changedir={toxinidir} -deps=docutils +deps=docutils pygments {distshare}/py-* {distshare}/pytest-xdist-* - pytest-figleaf + pytest-figleaf pytest-coverage pytest-cov - pytest-capturelog + pytest-capturelog -commands= - {envpython} bin-for-dist/makepluginlist.py - py.test [doc] -rsfxX --confcutdir=. \ - --junitxml={envlogdir}/junit-{envname}s.xml --forcegen +commands= + {envpython} bin-for-dist/makepluginlist.py + py.test [doc] -rsfxX --junitxml={envlogdir}/junit-{envname}s.xml --forcegen [testenv:py25] basepython=python2.5 [testenv:py24] @@ -55,7 +53,7 @@ deps= changedir=testing basepython=jython commands= - {envpython} {envbindir}/py.test-jython --confcutdir=.. \ + {envpython} {envbindir}/py.test-jython \ -rfsxX --junitxml={envlogdir}/junit-{envname}1.xml [io_ code] - {envpython} {envbindir}/py.test-jython --confcutdir=.. \ + {envpython} {envbindir}/py.test-jython \ -rfsxX --junitxml={envlogdir}/junit-{envname}2.xml acceptance_test.py plugin --- a/py/_test/conftesthandle.py +++ b/py/_test/conftesthandle.py @@ -13,6 +13,7 @@ class Conftest(object): self._onimport = onimport self._conftestpath2mod = {} self._confcutdir = confcutdir + self._md5cache = {} def setinitial(self, args): """ try to find a first anchor path for looking up global values @@ -57,17 +58,23 @@ class Conftest(object): if path is None: raise ValueError("missing default confest.") dp = path.dirpath() - if dp == path: - clist = [] - else: + clist = [] + if dp != path: cutdir = self._confcutdir - clist = self.getconftestmodules(dp) if cutdir and path != cutdir and not path.relto(cutdir): pass else: conftestpath = path.join("conftest.py") if conftestpath.check(file=1): - clist.append(self.importconftest(conftestpath)) + key = conftestpath.computehash() + # XXX logging about conftest loading + if key not in self._md5cache: + clist.append(self.importconftest(conftestpath)) + self._md5cache[key] = conftestpath + else: + # use some kind of logging + print ("WARN: not loading %s" % conftestpath) + clist[:0] = self.getconftestmodules(dp) self._path2confmods[path] = clist # be defensive: avoid changes from caller side to # affect us by always returning a copy of the actual list --- a/testing/test_conftesthandle.py +++ b/testing/test_conftesthandle.py @@ -149,6 +149,21 @@ def test_setinitial_confcut(testdir): assert conftest.getconftestmodules(sub) == [] assert conftest.getconftestmodules(conf.dirpath()) == [] +def test_conftest_samecontent_detection(testdir): + conf = testdir.makeconftest("x=3") + p = testdir.mkdir("x") + conf.copy(p.join("conftest.py")) + conftest = Conftest() + conftest.setinitial([p]) + l = conftest.getconftestmodules(p) + assert len(l) == 1 + assert l[0].__file__ == p.join("conftest.py") + p2 = p.mkdir("y") + conf.copy(p2.join("conftest.py")) + l = conftest.getconftestmodules(p2) + assert len(l) == 1 + assert l[0].__file__ == p.join("conftest.py") + @py.test.mark.multi(name='test tests whatever .dotdir'.split()) def test_setinitial_conftest_subdirs(testdir, name): sub = testdir.mkdir(name) --- a/CHANGELOG +++ b/CHANGELOG @@ -1,11 +1,14 @@ Changes between 1.3.2 and 1.3.3a1 ================================================== +- make conftest loading detect that a conftest file with the same + content was already loaded, avoids surprises in nested directory structures + that can be produced e.g. by Hudson. It alleviates the need to use + --confcutdir at all. - fix terminal coloring for win32 (thanks Michael Foord for reporting) - fix weirdness: make terminal width detection work on stdout instead of stdin (thanks Armin Ronacher for reporting) - - remove trailing whitespace in all py/text files Changes between 1.3.1 and 1.3.2 From commits-noreply at bitbucket.org Thu Jul 29 11:32:43 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 29 Jul 2010 09:32:43 +0000 (UTC) Subject: [py-svn] py-trunk commit fa64ba4988bf: fix bug on writing out objects with terminalwriter on windows Message-ID: <20100729093243.BE4927EE7C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280395944 -7200 # Node ID fa64ba4988bfdb0cf57f0332d1ff66cab04b374d # Parent 3e28f12e7c443367ed0ed63f605aae68b96b512b fix bug on writing out objects with terminalwriter on windows --- a/py/_io/terminalwriter.py +++ b/py/_io/terminalwriter.py @@ -204,6 +204,8 @@ class Win32ConsoleWriter(TerminalWriter) attr |= FOREGROUND_BLACK # (oldcolors & 0x0007) SetConsoleTextAttribute(handle, attr) + if not isinstance(self._file, WriteFile): + s = self._getbytestring(s) self._file.write(s) self._file.flush() if oldcolors: From commits-noreply at bitbucket.org Thu Jul 29 12:57:28 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 29 Jul 2010 10:57:28 +0000 (UTC) Subject: [py-svn] py-trunk commit 6fa2ed846f69: fixes issue113 - assertion represenation issue Message-ID: <20100729105728.0FE5E7EE7C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280400939 -7200 # Node ID 6fa2ed846f692ecceb8ef5b5b4292f65ba4bd0e0 # Parent fa64ba4988bfdb0cf57f0332d1ff66cab04b374d fixes issue113 - assertion represenation issue --- a/testing/code/test_source.py +++ b/testing/code/test_source.py @@ -176,6 +176,13 @@ class TestSourceParsingAndCompiling: #x = s.deindent() assert str(s) == ass + def test_getstatementrange_triple_quoted(self): + #print str(self.source) + source = Source("""''' + '''""") + s = source.getstatement(1) + assert eval(str(s)) + def test_getstatementrange_within_constructs(self): source = Source("""\ try: --- a/testing/plugin/test_pytest_assertion.py +++ b/testing/plugin/test_pytest_assertion.py @@ -9,6 +9,17 @@ def test_functional(testdir): result = testdir.runpytest("--no-assert") assert "3 == 4" not in result.stdout.str() +def test_triple_quoted_string_issue113(testdir): + testdir.makepyfile(""" + def test_hello(): + assert "" == ''' + '''""") + result = testdir.runpytest("--fulltrace") + result.stdout.fnmatch_lines([ + "*1 failed*", + ]) + assert 'SyntaxError' not in result.stdout.str() + def test_traceback_failure(testdir): p1 = testdir.makepyfile(""" def g(): --- a/py/_code/source.py +++ b/py/_code/source.py @@ -125,16 +125,13 @@ class Source(object): try: compile_command(trysource) except (SyntaxError, OverflowError, ValueError): - pass - else: - break # got a valid or incomplete statement + continue - # 2. find the end of the statement - for end in range(lineno+1, len(self)+1): - trysource = self[start:end] - if trysource.isparseable(): - break - + # 2. find the end of the statement + for end in range(lineno+1, len(self)+1): + trysource = self[start:end] + if trysource.isparseable(): + return start, end return start, end def getblockend(self, lineno): --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ Changes between 1.3.2 and 1.3.3a1 ================================================== +- fix issue113: assertion representation problem with triple-quoted strings + (and possibly other cases) - make conftest loading detect that a conftest file with the same content was already loaded, avoids surprises in nested directory structures that can be produced e.g. by Hudson. It alleviates the need to use From commits-noreply at bitbucket.org Fri Jul 30 15:11:50 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 30 Jul 2010 13:11:50 +0000 (UTC) Subject: [py-svn] py-trunk commit b185c780c0e9: another whitespace-correction commit Message-ID: <20100730131150.03E835D72C@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280495124 -7200 # Node ID b185c780c0e9e1129fa30a293b8faa6ac765c599 # Parent 6fa2ed846f692ecceb8ef5b5b4292f65ba4bd0e0 another whitespace-correction commit --- a/tox.ini +++ b/tox.ini @@ -10,7 +10,7 @@ sdistsrc={distshare}/py-* changedir=testing commands= py.test -rfsxX --junitxml={envlogdir}/junit-{envname}.xml --tools-on-path [] -deps= +deps= pexpect [testenv:py27] basepython=python2.7 @@ -36,7 +36,7 @@ deps=docutils pytest-coverage pytest-cov pytest-capturelog - + commands= {envpython} bin-for-dist/makepluginlist.py py.test [doc] -rsfxX --junitxml={envlogdir}/junit-{envname}s.xml --forcegen --- a/py/_test/conftesthandle.py +++ b/py/_test/conftesthandle.py @@ -72,7 +72,7 @@ class Conftest(object): clist.append(self.importconftest(conftestpath)) self._md5cache[key] = conftestpath else: - # use some kind of logging + # use some kind of logging print ("WARN: not loading %s" % conftestpath) clist[:0] = self.getconftestmodules(dp) self._path2confmods[path] = clist --- a/CHANGELOG +++ b/CHANGELOG @@ -1,27 +1,27 @@ Changes between 1.3.2 and 1.3.3a1 ================================================== -- fix issue113: assertion representation problem with triple-quoted strings +- fix issue113: assertion representation problem with triple-quoted strings (and possibly other cases) -- make conftest loading detect that a conftest file with the same +- make conftest loading detect that a conftest file with the same content was already loaded, avoids surprises in nested directory structures - that can be produced e.g. by Hudson. It alleviates the need to use - --confcutdir at all. + that can be produced e.g. by Hudson. It alleviates the need to use + --confcutdir at all. - fix terminal coloring for win32 (thanks Michael Foord for reporting) -- fix weirdness: make terminal width detection work on stdout instead of stdin - (thanks Armin Ronacher for reporting) +- fix weirdness: make terminal width detection work on stdout instead of stdin + (thanks Armin Ronacher for reporting) - remove trailing whitespace in all py/text files Changes between 1.3.1 and 1.3.2 ================================================== -New features +New features ++++++++++++++++++ - fix issue103: introduce py.test.raises as context manager, examples:: - with py.test.raises(ZeroDivisionError): + with py.test.raises(ZeroDivisionError): x = 0 1 / x @@ -30,10 +30,10 @@ New features # you may do extra checks on excinfo.value|type|traceback here - (thanks Ronny Pfannschmidt) + (thanks Ronny Pfannschmidt) -- Funcarg factories can now dynamically apply a marker to a - test invocation. This is for example useful if a factory +- Funcarg factories can now dynamically apply a marker to a + test invocation. This is for example useful if a factory provides parameters to a test which are expected-to-fail:: def pytest_funcarg__arg(request): @@ -43,75 +43,75 @@ New features def test_function(arg): ... -- improved error reporting on collection and import errors. This makes +- improved error reporting on collection and import errors. This makes use of a more general mechanism, namely that for custom test item/collect - nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can - override it to return a string error representation of your choice - which is going to be reported as a (red) string. + nodes ``node.repr_failure(excinfo)`` is now uniformly called so that you can + override it to return a string error representation of your choice + which is going to be reported as a (red) string. -- introduce '--junitprefix=STR' option to prepend a prefix - to all reports in the junitxml file. +- introduce '--junitprefix=STR' option to prepend a prefix + to all reports in the junitxml file. Bug fixes / Maintenance ++++++++++++++++++++++++++ -- make tests and the ``pytest_recwarn`` plugin in particular fully compatible - to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that - you can properly check for their existence in a cross-python manner). -- refine --pdb: ignore xfailed tests, unify its TB-reporting and +- make tests and the ``pytest_recwarn`` plugin in particular fully compatible + to Python2.7 (if you use the ``recwarn`` funcarg warnings will be enabled so that + you can properly check for their existence in a cross-python manner). +- refine --pdb: ignore xfailed tests, unify its TB-reporting and don't display failures again at the end. - fix assertion interpretation with the ** operator (thanks Benjamin Peterson) - fix issue105 assignment on the same line as a failing assertion (thanks Benjamin Peterson) - fix issue104 proper escaping for test names in junitxml plugin (thanks anonymous) - fix issue57 -f|--looponfail to work with xpassing tests (thanks Ronny) - fix issue92 collectonly reporter and --pastebin (thanks Benjamin Peterson) -- fix py.code.compile(source) to generate unique filenames -- fix assertion re-interp problems on PyPy, by defering code +- fix py.code.compile(source) to generate unique filenames +- fix assertion re-interp problems on PyPy, by defering code compilation to the (overridable) Frame.eval class. (thanks Amaury Forgeot) - fix py.path.local.pyimport() to work with directories - streamline py.path.local.mkdtemp implementation and usage - don't print empty lines when showing junitxml-filename - add optional boolean ignore_errors parameter to py.path.local.remove -- fix terminal writing on win32/python2.4 -- py.process.cmdexec() now tries harder to return properly encoded unicode objects +- fix terminal writing on win32/python2.4 +- py.process.cmdexec() now tries harder to return properly encoded unicode objects on all python versions - install plain py.test/py.which scripts also for Jython, this helps to get canonical script paths in virtualenv situations -- make path.bestrelpath(path) return ".", note that when calling - X.bestrelpath the assumption is that X is a directory. -- make initial conftest discovery ignore "--" prefixed arguments -- fix resultlog plugin when used in an multicpu/multihost xdist situation - (thanks Jakub Gustak) -- perform distributed testing related reporting in the xdist-plugin - rather than having dist-related code in the generic py.test +- make path.bestrelpath(path) return ".", note that when calling + X.bestrelpath the assumption is that X is a directory. +- make initial conftest discovery ignore "--" prefixed arguments +- fix resultlog plugin when used in an multicpu/multihost xdist situation + (thanks Jakub Gustak) +- perform distributed testing related reporting in the xdist-plugin + rather than having dist-related code in the generic py.test distribution -- fix homedir detection on Windows +- fix homedir detection on Windows - ship distribute_setup.py version 0.6.13 Changes between 1.3.0 and 1.3.1 ================================================== -New features +New features ++++++++++++++++++ -- issue91: introduce new py.test.xfail(reason) helper - to imperatively mark a test as expected to fail. Can +- issue91: introduce new py.test.xfail(reason) helper + to imperatively mark a test as expected to fail. Can be used from within setup and test functions. This is - useful especially for parametrized tests when certain + useful especially for parametrized tests when certain configurations are expected-to-fail. In this case the declarative approach with the @py.test.mark.xfail cannot - be used as it would mark all configurations as xfail. + be used as it would mark all configurations as xfail. - issue102: introduce new --maxfail=NUM option to stop test runs after NUM failures. This is a generalization of the '-x' or '--exitfirst' option which is now equivalent - to '--maxfail=1'. Both '-x' and '--maxfail' will - now also print a line near the end indicating the Interruption. + to '--maxfail=1'. Both '-x' and '--maxfail' will + now also print a line near the end indicating the Interruption. - issue89: allow py.test.mark decorators to be used on classes - (class decorators were introduced with python2.6) and + (class decorators were introduced with python2.6) and also allow to have multiple markers applied at class/module level - by specifying a list. + by specifying a list. - improve and refine letter reporting in the progress bar: . pass @@ -121,19 +121,19 @@ New features X xpassed test (test that was expected to fail but passed) You can use any combination of 'fsxX' with the '-r' extended - reporting option. The xfail/xpass results will show up as - skipped tests in the junitxml output - which also fixes + reporting option. The xfail/xpass results will show up as + skipped tests in the junitxml output - which also fixes issue99. -- make py.test.cmdline.main() return the exitstatus instead of raising +- make py.test.cmdline.main() return the exitstatus instead of raising SystemExit and also allow it to be called multiple times. This of - course requires that your application and tests are properly teared - down and don't have global state. + course requires that your application and tests are properly teared + down and don't have global state. -Fixes / Maintenance +Fixes / Maintenance ++++++++++++++++++++++ -- improved traceback presentation: +- improved traceback presentation: - improved and unified reporting for "--tb=short" option - Errors during test module imports are much shorter, (using --tb=short style) - raises shows shorter more relevant tracebacks @@ -141,20 +141,20 @@ Fixes / Maintenance - improve support for raises and other dynamically compiled code by manipulating python's linecache.cache instead of the previous - rather hacky way of creating custom code objects. This makes + rather hacky way of creating custom code objects. This makes it seemlessly work on Jython and PyPy where it previously didn't. -- fix issue96: make capturing more resilient against Control-C +- fix issue96: make capturing more resilient against Control-C interruptions (involved somewhat substantial refactoring - to the underlying capturing functionality to avoid race + to the underlying capturing functionality to avoid race conditions). -- fix chaining of conditional skipif/xfail decorators - so it works now +- fix chaining of conditional skipif/xfail decorators - so it works now as expected to use multiple @py.test.mark.skipif(condition) decorators, - including specific reporting which of the conditions lead to skipping. + including specific reporting which of the conditions lead to skipping. -- fix issue95: late-import zlib so that it's not required - for general py.test startup. +- fix issue95: late-import zlib so that it's not required + for general py.test startup. - fix issue94: make reporting more robust against bogus source code (and internally be more careful when presenting unexpected byte sequences) @@ -166,40 +166,40 @@ Changes between 1.2.1 and 1.3.0 - deprecate --report option in favour of a new shorter and easier to remember -r option: it takes a string argument consisting of any combination of 'xfsX' characters. They relate to the single chars - you see during the dotted progress printing and will print an extra line + you see during the dotted progress printing and will print an extra line per test at the end of the test run. This extra line indicates the exact position or test ID that you directly paste to the py.test cmdline in order - to re-run a particular test. + to re-run a particular test. -- allow external plugins to register new hooks via the new +- allow external plugins to register new hooks via the new pytest_addhooks(pluginmanager) hook. The new release of - the pytest-xdist plugin for distributed and looponfailing - testing requires this feature. + the pytest-xdist plugin for distributed and looponfailing + testing requires this feature. - add a new pytest_ignore_collect(path, config) hook to allow projects and - plugins to define exclusion behaviour for their directory structure - + plugins to define exclusion behaviour for their directory structure - for example you may define in a conftest.py this method:: def pytest_ignore_collect(path): return path.check(link=1) - to prevent even a collection try of any tests in symlinked dirs. + to prevent even a collection try of any tests in symlinked dirs. - new pytest_pycollect_makemodule(path, parent) hook for - allowing customization of the Module collection object for a - matching test module. + allowing customization of the Module collection object for a + matching test module. -- extend and refine xfail mechanism: +- extend and refine xfail mechanism: ``@py.test.mark.xfail(run=False)`` do not run the decorated test ``@py.test.mark.xfail(reason="...")`` prints the reason string in xfail summaries specifiying ``--runxfail`` on command line virtually ignores xfail markers -- expose (previously internal) commonly useful methods: +- expose (previously internal) commonly useful methods: py.io.get_terminal_with() -> return terminal width py.io.ansi_print(...) -> print colored/bold text on linux/win32 py.io.saferepr(obj) -> return limited representation string -- expose test outcome related exceptions as py.test.skip.Exception, +- expose test outcome related exceptions as py.test.skip.Exception, py.test.raises.Exception etc., useful mostly for plugins doing special outcome interpretation/tweaking @@ -207,22 +207,22 @@ Changes between 1.2.1 and 1.3.0 - fix/refine python3 compatibility (thanks Benjamin Peterson) -- fixes for making the jython/win32 combination work, note however: +- fixes for making the jython/win32 combination work, note however: jython2.5.1/win32 does not provide a command line launcher, see http://bugs.jython.org/issue1491 . See pylib install documentation - for how to work around. + for how to work around. - fixes for handling of unicode exception values and unprintable objects -- (issue87) fix unboundlocal error in assertionold code +- (issue87) fix unboundlocal error in assertionold code - (issue86) improve documentation for looponfailing - refine IO capturing: stdin-redirect pseudo-file now has a NOP close() method -- ship distribute_setup.py version 0.6.10 +- ship distribute_setup.py version 0.6.10 -- added links to the new capturelog and coverage plugins +- added links to the new capturelog and coverage plugins Changes between 1.2.1 and 1.2.0 @@ -233,79 +233,79 @@ Changes between 1.2.1 and 1.2.0 py.cleanup # remove "*.pyc" and "*$py.class" (jython) files py.cleanup -e .swp -e .cache # also remove files with these extensions py.cleanup -s # remove "build" and "dist" directory next to setup.py files - py.cleanup -d # also remove empty directories + py.cleanup -d # also remove empty directories py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'" py.cleanup -n # dry run, only show what would be removed -- add a new option "py.test --funcargs" which shows available funcargs - and their help strings (docstrings on their respective factory function) +- add a new option "py.test --funcargs" which shows available funcargs + and their help strings (docstrings on their respective factory function) for a given test path -- display a short and concise traceback if a funcarg lookup fails +- display a short and concise traceback if a funcarg lookup fails -- early-load "conftest.py" files in non-dot first-level sub directories. - allows to conveniently keep and access test-related options in a ``test`` - subdir and still add command line options. +- early-load "conftest.py" files in non-dot first-level sub directories. + allows to conveniently keep and access test-related options in a ``test`` + subdir and still add command line options. - fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value - fix issue78: always call python-level teardown functions even if the - according setup failed. This includes refinements for calling setup_module/class functions + according setup failed. This includes refinements for calling setup_module/class functions which will now only be called once instead of the previous behaviour where they'd be called multiple times if they raise an exception (including a Skipped exception). Any exception will be re-corded and associated with all tests in the according module/class scope. - fix issue63: assume <40 columns to be a bogus terminal width, default to 80 -- fix pdb debugging to be in the correct frame on raises-related errors +- fix pdb debugging to be in the correct frame on raises-related errors - update apipkg.py to fix an issue where recursive imports might - unnecessarily break importing + unnecessarily break importing -- fix plugin links +- fix plugin links Changes between 1.2 and 1.1.1 ===================================== -- moved dist/looponfailing from py.test core into a new +- moved dist/looponfailing from py.test core into a new separately released pytest-xdist plugin. - new junitxml plugin: --junitxml=path will generate a junit style xml file - which is processable e.g. by the Hudson CI system. + which is processable e.g. by the Hudson CI system. - new option: --genscript=path will generate a standalone py.test script - which will not need any libraries installed. thanks to Ralf Schmitt. + which will not need any libraries installed. thanks to Ralf Schmitt. -- new option: --ignore will prevent specified path from collection. - Can be specified multiple times. +- new option: --ignore will prevent specified path from collection. + Can be specified multiple times. -- new option: --confcutdir=dir will make py.test only consider conftest - files that are relative to the specified dir. +- new option: --confcutdir=dir will make py.test only consider conftest + files that are relative to the specified dir. - new funcarg: "pytestconfig" is the pytest config object for access - to command line args and can now be easily used in a test. + to command line args and can now be easily used in a test. - install 'py.test' and `py.which` with a ``-$VERSION`` suffix to - disambiguate between Python3, python2.X, Jython and PyPy installed versions. + disambiguate between Python3, python2.X, Jython and PyPy installed versions. - new "pytestconfig" funcarg allows access to test config object -- new "pytest_report_header" hook can return additional lines - to be displayed at the header of a test run. +- new "pytest_report_header" hook can return additional lines + to be displayed at the header of a test run. - (experimental) allow "py.test path::name1::name2::..." for pointing to a test within a test collection directly. This might eventually - evolve as a full substitute to "-k" specifications. + evolve as a full substitute to "-k" specifications. - streamlined plugin loading: order is now as documented in - customize.html: setuptools, ENV, commandline, conftest. + customize.html: setuptools, ENV, commandline, conftest. also setuptools entry point names are turned to canonical namees ("pytest_*") -- automatically skip tests that need 'capfd' but have no os.dup +- automatically skip tests that need 'capfd' but have no os.dup -- allow pytest_generate_tests to be defined in classes as well +- allow pytest_generate_tests to be defined in classes as well -- deprecate usage of 'disabled' attribute in favour of pytestmark +- deprecate usage of 'disabled' attribute in favour of pytestmark - deprecate definition of Directory, Module, Class and Function nodes in conftest.py files. Use pytest collect hooks instead. @@ -320,28 +320,28 @@ Changes between 1.2 and 1.1.1 change its long command line options to be a bit shorter (see py.test -h). - change: pytest doctest plugin is now enabled by default and has a - new option --doctest-glob to set a pattern for file matches. + new option --doctest-glob to set a pattern for file matches. -- change: remove internal py._* helper vars, only keep py._pydir +- change: remove internal py._* helper vars, only keep py._pydir -- robustify capturing to survive if custom pytest_runtest_setup - code failed and prevented the capturing setup code from running. +- robustify capturing to survive if custom pytest_runtest_setup + code failed and prevented the capturing setup code from running. - make py.test.* helpers provided by default plugins visible early - works transparently both for pydoc and for interactive sessions - which will regularly see e.g. py.test.mark and py.test.importorskip. + which will regularly see e.g. py.test.mark and py.test.importorskip. -- simplify internal plugin manager machinery +- simplify internal plugin manager machinery - simplify internal collection tree by introducing a RootCollector node - fix assert reinterpreation that sees a call containing "keyword=..." -- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish - hooks on slaves during dist-testing, report module/session teardown +- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish + hooks on slaves during dist-testing, report module/session teardown hooks correctly. -- fix issue65: properly handle dist-testing if no - execnet/py lib installed remotely. +- fix issue65: properly handle dist-testing if no + execnet/py lib installed remotely. - skip some install-tests if no execnet is available @@ -351,15 +351,15 @@ Changes between 1.2 and 1.1.1 Changes between 1.1.1 and 1.1.0 ===================================== -- introduce automatic plugin registration via 'pytest11' +- introduce automatic plugin registration via 'pytest11' entrypoints via setuptools' pkg_resources.iter_entry_points -- fix py.test dist-testing to work with execnet >= 1.0.0b4 +- fix py.test dist-testing to work with execnet >= 1.0.0b4 -- re-introduce py.test.cmdline.main() for better backward compatibility +- re-introduce py.test.cmdline.main() for better backward compatibility - svn paths: fix a bug with path.check(versioned=True) for svn paths, - allow '%' in svn paths, make svnwc.update() default to interactive mode + allow '%' in svn paths, make svnwc.update() default to interactive mode like in 1.0.x and add svnwc.update(interactive=False) to inhibit interaction. - refine distributed tarball to contain test and no pyc files @@ -374,16 +374,16 @@ Changes between 1.1.0 and 1.0.2 * remove py.rest tool and internal namespace - it was never really advertised and can still be used with - the old release if needed. If there is interest + the old release if needed. If there is interest it could be revived into its own tool i guess. * fix issue48 and issue59: raise an Error if the module - from an imported test file does not seem to come from + from an imported test file does not seem to come from the filepath - avoids "same-name" confusion that has been reported repeatedly * merged Ronny's nose-compatibility hacks: now - nose-style setup_module() and setup() functions are + nose-style setup_module() and setup() functions are supported * introduce generalized py.test.mark function marking @@ -392,112 +392,112 @@ Changes between 1.1.0 and 1.0.2 * deprecate parser.addgroup in favour of getgroup which creates option group -* add --report command line option that allows to control showing of skipped/xfailed sections +* add --report command line option that allows to control showing of skipped/xfailed sections -* generalized skipping: a new way to mark python functions with skipif or xfail - at function, class and modules level based on platform or sys-module attributes. +* generalized skipping: a new way to mark python functions with skipif or xfail + at function, class and modules level based on platform or sys-module attributes. * extend py.test.mark decorator to allow for positional args -* introduce and test "py.cleanup -d" to remove empty directories +* introduce and test "py.cleanup -d" to remove empty directories * fix issue #59 - robustify unittest test collection -* make bpython/help interaction work by adding an __all__ attribute +* make bpython/help interaction work by adding an __all__ attribute to ApiModule, cleanup initpkg * use MIT license for pylib, add some contributors * remove py.execnet code and substitute all usages with 'execnet' proper -* fix issue50 - cached_setup now caches more to expectations - for test functions with multiple arguments. +* fix issue50 - cached_setup now caches more to expectations + for test functions with multiple arguments. * merge Jarko's fixes, issue #45 and #46 * add the ability to specify a path for py.lookup to search in -* fix a funcarg cached_setup bug probably only occuring - in distributed testing and "module" scope with teardown. +* fix a funcarg cached_setup bug probably only occuring + in distributed testing and "module" scope with teardown. * many fixes and changes for making the code base python3 compatible, - many thanks to Benjamin Peterson for helping with this. + many thanks to Benjamin Peterson for helping with this. -* consolidate builtins implementation to be compatible with >=2.3, +* consolidate builtins implementation to be compatible with >=2.3, add helpers to ease keeping 2 and 3k compatible code * deprecate py.compat.doctest|subprocess|textwrap|optparse -* deprecate py.magic.autopath, remove py/magic directory +* deprecate py.magic.autopath, remove py/magic directory * move pytest assertion handling to py/code and a pytest_assertion - plugin, add "--no-assert" option, deprecate py.magic namespaces - in favour of (less) py.code ones. + plugin, add "--no-assert" option, deprecate py.magic namespaces + in favour of (less) py.code ones. -* consolidate and cleanup py/code classes and files +* consolidate and cleanup py/code classes and files -* cleanup py/misc, move tests to bin-for-dist +* cleanup py/misc, move tests to bin-for-dist -* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg +* introduce delattr/delitem/delenv methods to py.test's monkeypatch funcarg -* consolidate py.log implementation, remove old approach. +* consolidate py.log implementation, remove old approach. * introduce py.io.TextIO and py.io.BytesIO for distinguishing between - text/unicode and byte-streams (uses underlying standard lib io.* - if available) + text/unicode and byte-streams (uses underlying standard lib io.* + if available) -* make py.unittest_convert helper script available which converts "unittest.py" +* make py.unittest_convert helper script available which converts "unittest.py" style files into the simpler assert/direct-test-classes py.test/nosetests - style. The script was written by Laura Creighton. - -* simplified internal localpath implementation + style. The script was written by Laura Creighton. + +* simplified internal localpath implementation Changes between 1.0.1 and 1.0.2 ===================================== -* fixing packaging issues, triggered by fedora redhat packaging, - also added doc, examples and contrib dirs to the tarball. +* fixing packaging issues, triggered by fedora redhat packaging, + also added doc, examples and contrib dirs to the tarball. -* added a documentation link to the new django plugin. +* added a documentation link to the new django plugin. Changes between 1.0.0 and 1.0.1 ===================================== -* added a 'pytest_nose' plugin which handles nose.SkipTest, - nose-style function/method/generator setup/teardown and - tries to report functions correctly. +* added a 'pytest_nose' plugin which handles nose.SkipTest, + nose-style function/method/generator setup/teardown and + tries to report functions correctly. -* capturing of unicode writes or encoded strings to sys.stdout/err - work better, also terminalwriting was adapted and somewhat - unified between windows and linux. +* capturing of unicode writes or encoded strings to sys.stdout/err + work better, also terminalwriting was adapted and somewhat + unified between windows and linux. * improved documentation layout and content a lot * added a "--help-config" option to show conftest.py / ENV-var names for - all longopt cmdline options, and some special conftest.py variables. - renamed 'conf_capture' conftest setting to 'option_capture' accordingly. + all longopt cmdline options, and some special conftest.py variables. + renamed 'conf_capture' conftest setting to 'option_capture' accordingly. -* fix issue #27: better reporting on non-collectable items given on commandline +* fix issue #27: better reporting on non-collectable items given on commandline (e.g. pyc files) -* fix issue #33: added --version flag (thanks Benjamin Peterson) +* fix issue #33: added --version flag (thanks Benjamin Peterson) * fix issue #32: adding support for "incomplete" paths to wcpath.status() -* "Test" prefixed classes are *not* collected by default anymore if they - have an __init__ method +* "Test" prefixed classes are *not* collected by default anymore if they + have an __init__ method * monkeypatch setenv() now accepts a "prepend" parameter * improved reporting of collection error tracebacks -* simplified multicall mechanism and plugin architecture, - renamed some internal methods and argnames +* simplified multicall mechanism and plugin architecture, + renamed some internal methods and argnames Changes between 1.0.0b9 and 1.0.0 ===================================== -* more terse reporting try to show filesystem path relatively to current dir +* more terse reporting try to show filesystem path relatively to current dir * improve xfail output a bit Changes between 1.0.0b8 and 1.0.0b9 @@ -510,26 +510,26 @@ Changes between 1.0.0b8 and 1.0.0b9 * setup/teardown or collection problems now show as ERRORs or with big "E"'s in the progress lines. they are reported - and counted separately. - -* dist-testing: properly handle test items that get locally - collected but cannot be collected on the remote side - often + and counted separately. + +* dist-testing: properly handle test items that get locally + collected but cannot be collected on the remote side - often due to platform/dependency reasons * simplified py.test.mark API - see keyword plugin documentation * integrate better with logging: capturing now by default captures - test functions and their immediate setup/teardown in a single stream + test functions and their immediate setup/teardown in a single stream * capsys and capfd funcargs now have a readouterr() and a close() method - (underlyingly py.io.StdCapture/FD objects are used which grew a + (underlyingly py.io.StdCapture/FD objects are used which grew a readouterr() method as well to return snapshots of captured out/err) -* make assert-reinterpretation work better with comparisons not +* make assert-reinterpretation work better with comparisons not returning bools (reported with numpy from thanks maciej fijalkowski) -* reworked per-test output capturing into the pytest_iocapture.py plugin - and thus removed capturing code from config object +* reworked per-test output capturing into the pytest_iocapture.py plugin + and thus removed capturing code from config object * item.repr_failure(excinfo) instead of item.repr_failure(excinfo, outerr) @@ -539,126 +539,126 @@ Changes between 1.0.0b7 and 1.0.0b8 * pytest_unittest-plugin is now enabled by default -* introduced pytest_keyboardinterrupt hook and - refined pytest_sessionfinish hooked, added tests. +* introduced pytest_keyboardinterrupt hook and + refined pytest_sessionfinish hooked, added tests. * workaround a buggy logging module interaction ("closing already closed - files"). Thanks to Sridhar Ratnakumar for triggering. + files"). Thanks to Sridhar Ratnakumar for triggering. -* if plugins use "py.test.importorskip" for importing - a dependency only a warning will be issued instead - of exiting the testing process. +* if plugins use "py.test.importorskip" for importing + a dependency only a warning will be issued instead + of exiting the testing process. -* many improvements to docs: +* many improvements to docs: - refined funcargs doc , use the term "factory" instead of "provider" - - added a new talk/tutorial doc page + - added a new talk/tutorial doc page - better download page - better plugin docstrings - added new plugins page and automatic doc generation script -* fixed teardown problem related to partially failing funcarg setups - (thanks MrTopf for reporting), "pytest_runtest_teardown" is now - always invoked even if the "pytest_runtest_setup" failed. +* fixed teardown problem related to partially failing funcarg setups + (thanks MrTopf for reporting), "pytest_runtest_teardown" is now + always invoked even if the "pytest_runtest_setup" failed. -* tweaked doctest output for docstrings in py modules, - thanks Radomir. +* tweaked doctest output for docstrings in py modules, + thanks Radomir. Changes between 1.0.0b3 and 1.0.0b7 ============================================= -* renamed py.test.xfail back to py.test.mark.xfail to avoid +* renamed py.test.xfail back to py.test.mark.xfail to avoid two ways to decorate for xfail -* re-added py.test.mark decorator for setting keywords on functions - (it was actually documented so removing it was not nice) +* re-added py.test.mark decorator for setting keywords on functions + (it was actually documented so removing it was not nice) -* remove scope-argument from request.addfinalizer() because - request.cached_setup has the scope arg. TOOWTDI. +* remove scope-argument from request.addfinalizer() because + request.cached_setup has the scope arg. TOOWTDI. * perform setup finalization before reporting failures -* apply modified patches from Andreas Kloeckner to allow - test functions to have no func_code (#22) and to make - "-k" and function keywords work (#20) +* apply modified patches from Andreas Kloeckner to allow + test functions to have no func_code (#22) and to make + "-k" and function keywords work (#20) -* apply patch from Daniel Peolzleithner (issue #23) +* apply patch from Daniel Peolzleithner (issue #23) -* resolve issue #18, multiprocessing.Manager() and - redirection clash +* resolve issue #18, multiprocessing.Manager() and + redirection clash * make __name__ == "__channelexec__" for remote_exec code Changes between 1.0.0b1 and 1.0.0b3 ============================================= -* plugin classes are removed: one now defines - hooks directly in conftest.py or global pytest_*.py - files. +* plugin classes are removed: one now defines + hooks directly in conftest.py or global pytest_*.py + files. -* added new pytest_namespace(config) hook that allows - to inject helpers directly to the py.test.* namespace. +* added new pytest_namespace(config) hook that allows + to inject helpers directly to the py.test.* namespace. -* documented and refined many hooks +* documented and refined many hooks -* added new style of generative tests via - pytest_generate_tests hook that integrates - well with function arguments. - +* added new style of generative tests via + pytest_generate_tests hook that integrates + well with function arguments. + Changes between 0.9.2 and 1.0.0b1 ============================================= -* introduced new "funcarg" setup method, - see doc/test/funcarg.txt +* introduced new "funcarg" setup method, + see doc/test/funcarg.txt -* introduced plugin architecuture and many - new py.test plugins, see +* introduced plugin architecuture and many + new py.test plugins, see doc/test/plugins.txt -* teardown_method is now guaranteed to get - called after a test method has run. - +* teardown_method is now guaranteed to get + called after a test method has run. + * new method: py.test.importorskip(mod,minversion) will either import or call py.test.skip() * completely revised internal py.test architecture -* new py.process.ForkedFunc object allowing to +* new py.process.ForkedFunc object allowing to fork execution of a function to a sub process - and getting a result back. + and getting a result back. XXX lots of things missing here XXX Changes between 0.9.1 and 0.9.2 =============================== -* refined installation and metadata, created new setup.py, - now based on setuptools/ez_setup (thanks to Ralf Schmitt +* refined installation and metadata, created new setup.py, + now based on setuptools/ez_setup (thanks to Ralf Schmitt for his support). -* improved the way of making py.* scripts available in - windows environments, they are now added to the - Scripts directory as ".cmd" files. +* improved the way of making py.* scripts available in + windows environments, they are now added to the + Scripts directory as ".cmd" files. -* py.path.svnwc.status() now is more complete and +* py.path.svnwc.status() now is more complete and uses xml output from the 'svn' command if available (Guido Wesdorp) * fix for py.path.svn* to work with svn 1.5 (Chris Lamb) -* fix path.relto(otherpath) method on windows to +* fix path.relto(otherpath) method on windows to use normcase for checking if a path is relative. -* py.test's traceback is better parseable from editors +* py.test's traceback is better parseable from editors (follows the filenames:LINENO: MSG convention) (thanks to Osmo Salomaa) -* fix to javascript-generation, "py.test --runbrowser" +* fix to javascript-generation, "py.test --runbrowser" should work more reliably now -* removed previously accidentally added - py.test.broken and py.test.notimplemented helpers. +* removed previously accidentally added + py.test.broken and py.test.notimplemented helpers. * there now is a py.__version__ attribute From commits-noreply at bitbucket.org Fri Jul 30 15:11:50 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 30 Jul 2010 13:11:50 +0000 (UTC) Subject: [py-svn] py-trunk commit c59d3fa8681a: bump version, prepare 1.3.3 Message-ID: <20100730131150.248375D757@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280495210 -7200 # Node ID c59d3fa8681a5b5966b8375b16fccd64a3a8dbeb # Parent b185c780c0e9e1129fa30a293b8faa6ac765c599 bump version, prepare 1.3.3 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def main(): name='py', description='py.test and pylib: rapid testing and development utils.', long_description = long_description, - version= '1.3.3a1', + version= '1.3.3', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ dictionary or an import path. (c) Holger Krekel and others, 2004-2010 """ -__version__ = version = "1.3.3a1" +__version__ = version = "1.3.3" import py.apipkg --- a/CHANGELOG +++ b/CHANGELOG @@ -1,17 +1,17 @@ -Changes between 1.3.2 and 1.3.3a1 +Changes between 1.3.2 and 1.3.3 ================================================== - fix issue113: assertion representation problem with triple-quoted strings (and possibly other cases) - make conftest loading detect that a conftest file with the same content was already loaded, avoids surprises in nested directory structures - that can be produced e.g. by Hudson. It alleviates the need to use - --confcutdir at all. + which can be produced e.g. by Hudson. It probably removes the need to use + --confcutdir in most cases. - fix terminal coloring for win32 (thanks Michael Foord for reporting) - fix weirdness: make terminal width detection work on stdout instead of stdin (thanks Armin Ronacher for reporting) -- remove trailing whitespace in all py/text files +- remove trailing whitespace in all py/text distribution files Changes between 1.3.1 and 1.3.2 ================================================== From commits-noreply at bitbucket.org Sat Jul 31 01:08:06 2010 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 30 Jul 2010 23:08:06 +0000 (UTC) Subject: [py-svn] py-trunk commit cfc1fd2ebd16: Added tag 1.3.3 for changeset c59d3fa8681a Message-ID: <20100730230806.3E14D47842@bitbucket.org> # HG changeset patch -- Bitbucket.org # Project py-trunk # URL http://bitbucket.org/hpk42/py-trunk/overview # User holger krekel # Date 1280531232 -7200 # Node ID cfc1fd2ebd1679e3aca6c8bc1054f5d3a8cbacc7 # Parent c59d3fa8681a5b5966b8375b16fccd64a3a8dbeb Added tag 1.3.3 for changeset c59d3fa8681a --- a/.hgtags +++ b/.hgtags @@ -27,3 +27,4 @@ d5eacf390af74553227122b85e20345d47b2f9e6 d5eacf390af74553227122b85e20345d47b2f9e6 1.3.1 8b8e7c25a13cf863f01b2dd955978285ae9daf6a 1.3.1 3bff44b188a7ec1af328d977b9d39b6757bb38df 1.3.2 +c59d3fa8681a5b5966b8375b16fccd64a3a8dbeb 1.3.3