From commits-noreply at bitbucket.org Tue May 1 02:31:24 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 01 May 2012 00:31:24 -0000 Subject: [py-svn] commit/pytest-xdist: hpk42: add a note where to find the issue tracker Message-ID: <20120501003124.13179.42627@bitbucket12.managed.contegix.com> 1 new commit in pytest-xdist: https://bitbucket.org/hpk42/pytest-xdist/changeset/d8af4f85360a/ changeset: d8af4f85360a user: hpk42 date: 2012-05-01 02:31:13 summary: add a note where to find the issue tracker affected #: 1 file diff -r aaaecf0fade3fe063b75c2b577053a5d9e84bb2d -r d8af4f85360aae594450fab79d59a2d9e09c4dc8 README.txt --- a/README.txt +++ b/README.txt @@ -168,3 +168,9 @@ .. _`pytest-xdist repository`: http://bitbucket.org/hpk42/pytest-xdist .. _`pytest`: http://pytest.org +Issue and Bug Tracker +------------------------ + +Please use the pytest issue tracker for bugs in this plugin, see https://bitbucket.org/hpk42/pytest/issues . + + Repository URL: https://bitbucket.org/hpk42/pytest-xdist/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 3 19:49:38 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 03 May 2012 17:49:38 -0000 Subject: [py-svn] commit/pytest: gutworth: escape the % operator in string formatting Message-ID: <20120503174938.5621.80175@bitbucket15.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/7d6e61e16b40/ changeset: 7d6e61e16b40 user: gutworth date: 2012-05-03 19:49:30 summary: escape the % operator in string formatting affected #: 3 files diff -r cb46ab12f7948bc1087ede40c3144a37407a3878 -r 7d6e61e16b40e169ce8781bbecbc0da201dcb85e CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Changese between 2.2.3 and ... ----------------------------------- +- fix error message for rewritten assertions involving the % operator - fix issue 126: correctly match all invalid xml characters for junitxml binary escape - fix issue with unittest: now @unittest.expectedFailure markers should diff -r cb46ab12f7948bc1087ede40c3144a37407a3878 -r 7d6e61e16b40e169ce8781bbecbc0da201dcb85e _pytest/assertion/rewrite.py --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -297,7 +297,7 @@ ast.Mult : "*", ast.Div : "/", ast.FloorDiv : "//", - ast.Mod : "%", + ast.Mod : "%%", # escaped for string formatting ast.Eq : "==", ast.NotEq : "!=", ast.Lt : "<", diff -r cb46ab12f7948bc1087ede40c3144a37407a3878 -r 7d6e61e16b40e169ce8781bbecbc0da201dcb85e testing/test_assertrewrite.py --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -195,6 +195,10 @@ y = -1 assert x + y assert getmsg(f) == "assert (1 + -1)" + def f(): + x = range(10) + assert not 5 % 4 + assert getmsg(f) == "assert not (5 % 4)" def test_call(self): def g(a=42, *args, **kwargs): Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Sat May 5 23:31:13 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 05 May 2012 21:31:13 -0000 Subject: [py-svn] commit/pytest: gutworth: prepend the assertion rewriting hook, so as not to break when builtin import is explicitly on sys.meta_path Message-ID: <20120505213113.11360.47465@bitbucket02.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/1ab662c89077/ changeset: 1ab662c89077 user: gutworth date: 2012-05-05 23:31:05 summary: prepend the assertion rewriting hook, so as not to break when builtin import is explicitly on sys.meta_path affected #: 1 file diff -r 7d6e61e16b40e169ce8781bbecbc0da201dcb85e -r 1ab662c89077009ac5f7a66622e77e85b87c6e0c _pytest/assertion/__init__.py --- a/_pytest/assertion/__init__.py +++ b/_pytest/assertion/__init__.py @@ -50,7 +50,7 @@ hook = None if mode == "rewrite": hook = rewrite.AssertionRewritingHook() - sys.meta_path.append(hook) + sys.meta_path.insert(0, hook) warn_about_missing_assertion(mode) config._assertstate = AssertionState(config, mode) config._assertstate.hook = hook Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Sun May 6 23:04:43 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sun, 06 May 2012 21:04:43 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: strip bound wrappers of class setup/tardown, fixes #140 Message-ID: <20120506210443.22217.98863@bitbucket13.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/e39c5ab74536/ changeset: e39c5ab74536 user: RonnyPfannschmidt date: 2012-05-06 23:03:16 summary: strip bound wrappers of class setup/tardown, fixes #140 on python3 im_func is replaced by __func__ affected #: 2 files diff -r 1ab662c89077009ac5f7a66622e77e85b87c6e0c -r e39c5ab74536172b6698b32594779d39e0c162b9 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -311,12 +311,14 @@ setup_class = getattr(self.obj, 'setup_class', None) if setup_class is not None: setup_class = getattr(setup_class, 'im_func', setup_class) + setup_class = getattr(setup_class, '__func__', setup_class) setup_class(self.obj) def teardown(self): teardown_class = getattr(self.obj, 'teardown_class', None) if teardown_class is not None: teardown_class = getattr(teardown_class, 'im_func', teardown_class) + teardown_class = getattr(teardown_class, '__func__', teardown_class) teardown_class(self.obj) class Instance(PyCollectorMixin, pytest.Collector): diff -r 1ab662c89077009ac5f7a66622e77e85b87c6e0c -r e39c5ab74536172b6698b32594779d39e0c162b9 testing/test_python.py --- a/testing/test_python.py +++ b/testing/test_python.py @@ -56,6 +56,24 @@ "*collected 0*", ]) + def test_setup_teardown_class_as_classmethod(self, testdir): + testdir.makepyfile(""" + class TestClassMethod: + @classmethod + def setup_class(cls): + pass + def test_1(self): + pass + @classmethod + def teardown_class(cls): + pass + """) + result = testdir.runpytest() + result.stdout.fnmatch_lines([ + "*1 passed*", + ]) + + class TestGenerator: def test_generative_functions(self, testdir): modcol = testdir.getmodulecol(""" Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 8 14:15:38 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 08 May 2012 12:15:38 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: add the fix for issue 140 to CHANGELOG Message-ID: <20120508121538.13852.67755@bitbucket16.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/9e42c1ad39bf/ changeset: 9e42c1ad39bf user: RonnyPfannschmidt date: 2012-05-08 14:15:23 summary: add the fix for issue 140 to CHANGELOG affected #: 1 file diff -r e39c5ab74536172b6698b32594779d39e0c162b9 -r 9e42c1ad39bf5cc7d1d2f85ca9714a17a9442bce CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,8 @@ - fix issue with unittest: now @unittest.expectedFailure markers should be processed correctly (you can also use @pytest.mark markers) - document integration with the extended distribute/setuptools test commands +- fix issue 140: propperly get the real functions + of bound classmethods for setup/teardown_class Changes between 2.2.2 and 2.2.3 Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 8 16:13:35 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 08 May 2012 14:13:35 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: switch pastebin to bpaste.net, fixes #141 Message-ID: <20120508141335.21257.68289@bitbucket13.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/4ede49c9ffdc/ changeset: 4ede49c9ffdc user: RonnyPfannschmidt date: 2012-05-08 16:13:25 summary: switch pastebin to bpaste.net, fixes #141 affected #: 2 files diff -r 9e42c1ad39bf5cc7d1d2f85ca9714a17a9442bce -r 4ede49c9ffdcc8c9d55e69508da433a463e6fd40 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -9,7 +9,7 @@ - document integration with the extended distribute/setuptools test commands - fix issue 140: propperly get the real functions of bound classmethods for setup/teardown_class - +- fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net Changes between 2.2.2 and 2.2.3 ---------------------------------------- diff -r 9e42c1ad39bf5cc7d1d2f85ca9714a17a9442bce -r 4ede49c9ffdcc8c9d55e69508da433a463e6fd40 _pytest/pastebin.py --- a/_pytest/pastebin.py +++ b/_pytest/pastebin.py @@ -2,7 +2,7 @@ import py, sys class url: - base = "http://paste.pocoo.org" + base = "http://bpaste.net" xmlrpc = base + "/xmlrpc/" show = base + "/show/" Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 10 00:34:56 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 09 May 2012 22:34:56 -0000 Subject: [py-svn] commit/pytest: hpk42: bump version Message-ID: <20120509223456.10471.10618@bitbucket05.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/01529407b209/ changeset: 01529407b209 user: hpk42 date: 2012-05-10 00:34:47 summary: bump version affected #: 2 files diff -r 4ede49c9ffdcc8c9d55e69508da433a463e6fd40 -r 01529407b20986e9e7fa5c57f553853995959b57 _pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.4.dev2' +__version__ = '2.2.4.dev3' diff -r 4ede49c9ffdcc8c9d55e69508da433a463e6fd40 -r 01529407b20986e9e7fa5c57f553853995959b57 setup.py --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.2.4.dev2', + version='2.2.4.dev3', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 10 00:36:13 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 09 May 2012 22:36:13 -0000 Subject: [py-svn] commit/py: hpk42: bump version Message-ID: <20120509223613.2878.36896@bitbucket03.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/d19d606a79c0/ changeset: d19d606a79c0 user: hpk42 date: 2012-05-10 00:36:06 summary: bump version affected #: 2 files diff -r 8ea021239dde14ddbc2db02771a86e0035edfbe2 -r d19d606a79c08c732b39d1225fceeb49078c919a py/__init__.py --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.7' +__version__ = '1.4.7.dev1' from py import _apipkg diff -r 8ea021239dde14ddbc2db02771a86e0035edfbe2 -r d19d606a79c08c732b39d1225fceeb49078c919a setup.py --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.7', + version='1.4.7.dev1', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 10 01:38:25 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 09 May 2012 23:38:25 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: hande the trial todo class by using repr Message-ID: <20120509233825.10471.12450@bitbucket05.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/7b1c3413c066/ changeset: 7b1c3413c066 user: RonnyPfannschmidt date: 2012-05-10 01:38:13 summary: hande the trial todo class by using repr affected #: 1 file diff -r 01529407b20986e9e7fa5c57f553853995959b57 -r 7b1c3413c066c6bb728fc060bdb4e7a3cbb23efd _pytest/skipping.py --- a/_pytest/skipping.py +++ b/_pytest/skipping.py @@ -137,7 +137,7 @@ rep = __multicall__.execute() if rep.when == "call": # we need to translate into how py.test encodes xpass - rep.keywords['xfail'] = "reason: " + item._unexpectedsuccess + rep.keywords['xfail'] = "reason: " + repr(item._unexpectedsuccess) rep.outcome = "failed" return rep if not (call.excinfo and Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 10 02:06:14 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 10 May 2012 00:06:14 -0000 Subject: [py-svn] commit/py: hpk42: bump version correctly Message-ID: <20120510000614.16136.10031@bitbucket12.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/4e5b244a612b/ changeset: 4e5b244a612b user: hpk42 date: 2012-05-10 02:06:06 summary: bump version correctly affected #: 2 files diff -r d19d606a79c08c732b39d1225fceeb49078c919a -r 4e5b244a612b7d60604120b632461428f7bc24f7 py/__init__.py --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.7.dev1' +__version__ = '1.4.8.dev2' from py import _apipkg diff -r d19d606a79c08c732b39d1225fceeb49078c919a -r 4e5b244a612b7d60604120b632461428f7bc24f7 setup.py --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.7.dev1', + version='1.4.8.dev2', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Mon May 14 17:17:15 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 14 May 2012 15:17:15 -0000 Subject: [py-svn] commit/py: hpk42: fix windows failure by striking windows terminalwriter "line" override Message-ID: <20120514151715.16216.36343@bitbucket13.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/e8f6ab426857/ changeset: e8f6ab426857 user: hpk42 date: 2012-05-14 17:16:44 summary: fix windows failure by striking windows terminalwriter "line" override affected #: 4 files diff -r 4e5b244a612b7d60604120b632461428f7bc24f7 -r e8f6ab426857877c569f917b6cb111636dc5a74a CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ - fix issue 13 - correct handling of the tag name object in xmlgen - fix issue 14 - support raw attribute values in xmlgen +- fix windows terminalwriter printing/re-line problem Changes between 1.4.6 and 1.4.7 ================================================== diff -r 4e5b244a612b7d60604120b632461428f7bc24f7 -r e8f6ab426857877c569f917b6cb111636dc5a74a py/__init__.py --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.8.dev2' +__version__ = '1.4.8.dev3' from py import _apipkg diff -r 4e5b244a612b7d60604120b632461428f7bc24f7 -r e8f6ab426857877c569f917b6cb111636dc5a74a py/_io/terminalwriter.py --- a/py/_io/terminalwriter.py +++ b/py/_io/terminalwriter.py @@ -239,10 +239,6 @@ if oldcolors: SetConsoleTextAttribute(handle, oldcolors) - def line(self, s="", **kw): - self.write(s, **kw) # works better for resetting colors - self.write("\n") - class WriteFile(object): def __init__(self, writemethod, encoding=None): self.encoding = encoding diff -r 4e5b244a612b7d60604120b632461428f7bc24f7 -r e8f6ab426857877c569f917b6cb111636dc5a74a setup.py --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.8.dev2', + version='1.4.8.dev3', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 17 08:45:20 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 May 2012 06:45:20 -0000 Subject: [py-svn] commit/py: hpk42: bump py version to next release Message-ID: <20120517064520.778.81056@bitbucket03.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/2b8ef0fd01f6/ changeset: 2b8ef0fd01f6 user: hpk42 date: 2012-05-17 08:45:03 summary: bump py version to next release affected #: 2 files diff -r e8f6ab426857877c569f917b6cb111636dc5a74a -r 2b8ef0fd01f6e61e33ca2673b7acf70c9db89361 py/__init__.py --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.8.dev3' +__version__ = '1.4.8' from py import _apipkg diff -r e8f6ab426857877c569f917b6cb111636dc5a74a -r 2b8ef0fd01f6e61e33ca2673b7acf70c9db89361 setup.py --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.8.dev3', + version='1.4.8', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 17 08:46:56 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 May 2012 06:46:56 -0000 Subject: [py-svn] commit/pytest: hpk42: bump version to next release Message-ID: <20120517064656.31537.63383@bitbucket01.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/d40c98b610fb/ changeset: d40c98b610fb user: hpk42 date: 2012-05-17 08:46:49 summary: bump version to next release affected #: 3 files diff -r 7b1c3413c066c6bb728fc060bdb4e7a3cbb23efd -r d40c98b610fb5a7e8060fb514ac4b2717ba2211c CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -Changese between 2.2.3 and ... +Changese between 2.2.3 and 2.2.4 ----------------------------------- - fix error message for rewritten assertions involving the % operator diff -r 7b1c3413c066c6bb728fc060bdb4e7a3cbb23efd -r d40c98b610fb5a7e8060fb514ac4b2717ba2211c _pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.4.dev3' +__version__ = '2.4.4' diff -r 7b1c3413c066c6bb728fc060bdb4e7a3cbb23efd -r d40c98b610fb5a7e8060fb514ac4b2717ba2211c setup.py --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.2.4.dev3', + version='2.4.4', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 17 08:50:32 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 May 2012 06:50:32 -0000 Subject: [py-svn] commit/pytest: hpk42: require py-1.4.8 Message-ID: <20120517065032.21630.61000@bitbucket13.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/4e6ec59e2cf9/ changeset: 4e6ec59e2cf9 user: hpk42 date: 2012-05-17 08:47:50 summary: require py-1.4.8 affected #: 1 file diff -r d40c98b610fb5a7e8060fb514ac4b2717ba2211c -r 4e6ec59e2cf9ad0d818d04b39a2452925e393ec3 setup.py --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ author_email='holger at merlinux.eu', entry_points= make_entry_points(), # the following should be enabled for release - install_requires=['py>=1.4.7.dev2'], + install_requires=['py>=1.4.8'], classifiers=['Development Status :: 6 - Mature', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', @@ -70,4 +70,4 @@ return {'console_scripts': l} if __name__ == '__main__': - main() \ No newline at end of file + main() Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 17 15:26:07 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 May 2012 13:26:07 -0000 Subject: [py-svn] commit/pytest: hpk42: add release announcement Message-ID: <20120517132607.20752.1798@bitbucket16.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/15160b4dd07b/ changeset: 15160b4dd07b user: hpk42 date: 2012-05-17 15:25:58 summary: add release announcement affected #: 2 files diff -r 4e6ec59e2cf9ad0d818d04b39a2452925e393ec3 -r 15160b4dd07bfebe2d5b367b8053c5fb45a52974 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -Changese between 2.2.3 and 2.2.4 +Changes between 2.2.3 and 2.2.4 ----------------------------------- - fix error message for rewritten assertions involving the % operator diff -r 4e6ec59e2cf9ad0d818d04b39a2452925e393ec3 -r 15160b4dd07bfebe2d5b367b8053c5fb45a52974 doc/announce/release-2.2.4.txt --- /dev/null +++ b/doc/announce/release-2.2.4.txt @@ -0,0 +1,34 @@ +pytest-2.2.4: bug fixes, better junitxml/unittest/python3 compat +=========================================================================== + +pytest-2.2.4 is a minor backward-compatible release of the versatile +py.test testing tool. It contains bug fixes and a few refinements +to junitxml reporting, better unittest- and python3 compatibility. + +For general information see here: + + http://pytest.org/ + +To install or upgrade pytest: + + pip install -U pytest # or + easy_install -U pytest + +Special thanks for helping on this release to Ronny Pfannschmidt +and Benjamin Peterson and the contributors of issues. + +best, +holger krekel + +Changes between 2.2.3 and 2.2.4 +----------------------------------- + +- fix error message for rewritten assertions involving the % operator +- fix issue 126: correctly match all invalid xml characters for junitxml + binary escape +- fix issue with unittest: now @unittest.expectedFailure markers should + be processed correctly (you can also use @pytest.mark markers) +- document integration with the extended distribute/setuptools test commands +- fix issue 140: propperly get the real functions + of bound classmethods for setup/teardown_class +- fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 17 15:44:24 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 May 2012 13:44:24 -0000 Subject: [py-svn] commit/pytest: hpk42: fix wrong release version Message-ID: <20120517134424.29696.54948@bitbucket02.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/51389afee0d3/ changeset: 51389afee0d3 user: hpk42 date: 2012-05-17 15:44:18 summary: fix wrong release version affected #: 2 files diff -r 15160b4dd07bfebe2d5b367b8053c5fb45a52974 -r 51389afee0d3d06792426377e93fee3941f0f490 _pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.4.4' +__version__ = '2.2.4' diff -r 15160b4dd07bfebe2d5b367b8053c5fb45a52974 -r 51389afee0d3d06792426377e93fee3941f0f490 setup.py --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.4.4', + version='2.2.4', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -70,4 +70,4 @@ return {'console_scripts': l} if __name__ == '__main__': - main() + main() \ No newline at end of file Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 17 23:11:36 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 May 2012 21:11:36 -0000 Subject: [py-svn] commit/pytest: hpk42: fix issue143 - call unconfigure/sessionfinish always when Message-ID: <20120517211136.21627.97832@bitbucket13.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/a2574a0a06da/ changeset: a2574a0a06da user: hpk42 date: 2012-05-17 23:11:23 summary: fix issue143 - call unconfigure/sessionfinish always when configure/sessionstart where called use exitcode 4 (instead of 3 which signaled an internal error) when an initial directory/file was not found affected #: 6 files diff -r 51389afee0d3d06792426377e93fee3941f0f490 -r a2574a0a06daf37c23a82b9a667b4d4798b67159 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,8 @@ - fix issue 140: propperly get the real functions of bound classmethods for setup/teardown_class - fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net +- fix issue #143: call unconfigure/sessionfinish always when + configure/sessionstart where called Changes between 2.2.2 and 2.2.3 ---------------------------------------- diff -r 51389afee0d3d06792426377e93fee3941f0f490 -r a2574a0a06daf37c23a82b9a667b4d4798b67159 _pytest/core.py --- a/_pytest/core.py +++ b/_pytest/core.py @@ -465,13 +465,8 @@ """ returned exit code integer, after an in-process testing run with the given command line arguments, preloading an optional list of passed in plugin objects. """ - try: - config = _prepareconfig(args, plugins) - exitstatus = config.hook.pytest_cmdline_main(config=config) - except UsageError: - e = sys.exc_info()[1] - sys.stderr.write("ERROR: %s\n" %(e.args[0],)) - exitstatus = 3 + config = _prepareconfig(args, plugins) + exitstatus = config.hook.pytest_cmdline_main(config=config) return exitstatus class UsageError(Exception): diff -r 51389afee0d3d06792426377e93fee3941f0f490 -r a2574a0a06daf37c23a82b9a667b4d4798b67159 _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -10,6 +10,7 @@ EXIT_TESTSFAILED = 1 EXIT_INTERRUPTED = 2 EXIT_INTERNALERROR = 3 +EXIT_USAGEERROR = 4 name_re = py.std.re.compile("^[a-zA-Z_]\w*$") @@ -65,30 +66,34 @@ session.exitstatus = EXIT_OK initstate = 0 try: - config.pluginmanager.do_configure(config) - initstate = 1 - config.hook.pytest_sessionstart(session=session) - initstate = 2 - doit(config, session) - except pytest.UsageError: - raise - except KeyboardInterrupt: - excinfo = py.code.ExceptionInfo() - config.hook.pytest_keyboard_interrupt(excinfo=excinfo) - session.exitstatus = EXIT_INTERRUPTED - except: - excinfo = py.code.ExceptionInfo() - config.pluginmanager.notify_exception(excinfo, config.option) - session.exitstatus = EXIT_INTERNALERROR - if excinfo.errisinstance(SystemExit): - sys.stderr.write("mainloop: caught Spurious SystemExit!\n") - if initstate >= 2: - config.hook.pytest_sessionfinish(session=session, - exitstatus=session.exitstatus or (session._testsfailed and 1)) - if not session.exitstatus and session._testsfailed: - session.exitstatus = EXIT_TESTSFAILED - if initstate >= 1: - config.pluginmanager.do_unconfigure(config) + try: + config.pluginmanager.do_configure(config) + initstate = 1 + config.hook.pytest_sessionstart(session=session) + initstate = 2 + doit(config, session) + except pytest.UsageError: + msg = sys.exc_info()[1].args[0] + sys.stderr.write("ERROR: %s\n" %(msg,)) + session.exitstatus = EXIT_USAGEERROR + except KeyboardInterrupt: + excinfo = py.code.ExceptionInfo() + config.hook.pytest_keyboard_interrupt(excinfo=excinfo) + session.exitstatus = EXIT_INTERRUPTED + except: + excinfo = py.code.ExceptionInfo() + config.pluginmanager.notify_exception(excinfo, config.option) + session.exitstatus = EXIT_INTERNALERROR + if excinfo.errisinstance(SystemExit): + sys.stderr.write("mainloop: caught Spurious SystemExit!\n") + finally: + if initstate >= 2: + config.hook.pytest_sessionfinish(session=session, + exitstatus=session.exitstatus or (session._testsfailed and 1)) + if not session.exitstatus and session._testsfailed: + session.exitstatus = EXIT_TESTSFAILED + if initstate >= 1: + config.pluginmanager.do_unconfigure(config) return session.exitstatus def pytest_cmdline_main(config): diff -r 51389afee0d3d06792426377e93fee3941f0f490 -r a2574a0a06daf37c23a82b9a667b4d4798b67159 doc/announce/release-2.2.4.txt --- a/doc/announce/release-2.2.4.txt +++ b/doc/announce/release-2.2.4.txt @@ -32,3 +32,6 @@ - fix issue 140: propperly get the real functions of bound classmethods for setup/teardown_class - fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net +- fix issue #143: call unconfigure/sessionfinish always when + configure/sessionstart where called + diff -r 51389afee0d3d06792426377e93fee3941f0f490 -r a2574a0a06daf37c23a82b9a667b4d4798b67159 testing/acceptance_test.py --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -57,6 +57,22 @@ assert result.ret != 0 result.stderr.fnmatch_lines(["ERROR: file not found*asd"]) + def test_file_not_found_unconfigure_issue143(self, testdir): + testdir.makeconftest(""" + def pytest_configure(): + print("---configure") + def pytest_unconfigure(): + print("---unconfigure") + """) + result = testdir.runpytest("-s", "asd") + assert result.ret == 4 # EXIT_USAGEERROR + result.stderr.fnmatch_lines(["ERROR: file not found*asd"]) + s = result.stdout.fnmatch_lines([ + "*---configure", + "*---unconfigure", + ]) + + def test_config_preparse_plugin_option(self, testdir): testdir.makepyfile(pytest_xyz=""" def pytest_addoption(parser): diff -r 51389afee0d3d06792426377e93fee3941f0f490 -r a2574a0a06daf37c23a82b9a667b4d4798b67159 testing/test_terminal.py --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -262,7 +262,7 @@ not to have the items attribute """ result = testdir.runpytest("--collectonly", "uhm_missing_path") - assert result.ret == 3 + assert result.ret == 4 result.stderr.fnmatch_lines([ '*ERROR: file not found*', ]) Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Fri May 18 13:56:59 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 18 May 2012 11:56:59 -0000 Subject: [py-svn] commit/pytest: hpk42: use higher difference on timing Message-ID: <20120518115659.14316.49@bitbucket03.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/d880c718ba98/ changeset: d880c718ba98 user: hpk42 date: 2012-05-18 13:56:49 summary: use higher difference on timing affected #: 1 file diff -r a2574a0a06daf37c23a82b9a667b4d4798b67159 -r d880c718ba987e9cb20aa7b21204a2786a18962c testing/acceptance_test.py --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -491,11 +491,11 @@ import time frag = 0.02 def test_2(): - time.sleep(frag*2) + time.sleep(frag*5) def test_1(): time.sleep(frag) def test_3(): - time.sleep(frag*3) + time.sleep(frag*10) """ def test_calls(self, testdir): Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Sat May 19 10:54:23 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 19 May 2012 08:54:23 -0000 Subject: [py-svn] commit/pytest: hpk42: fix help string for --paste Message-ID: <20120519085423.9459.75736@bitbucket03.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/e91d173fa1d8/ changeset: e91d173fa1d8 user: hpk42 date: 2012-05-19 10:54:12 summary: fix help string for --paste affected #: 1 file diff -r d880c718ba987e9cb20aa7b21204a2786a18962c -r e91d173fa1d84511923fb20b58cbe945d86a96e8 _pytest/pastebin.py --- a/_pytest/pastebin.py +++ b/_pytest/pastebin.py @@ -11,7 +11,7 @@ group._addoption('--pastebin', metavar="mode", action='store', dest="pastebin", default=None, type="choice", choices=['failed', 'all'], - help="send failed|all info to Pocoo pastebin service.") + help="send failed|all info to bpaste.net pastebin service.") def pytest_configure(__multicall__, config): import tempfile Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Mon May 21 15:38:21 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 21 May 2012 13:38:21 -0000 Subject: [py-svn] commit/py: RonnyPfannschmidt: fix doc typo s/py.test.local/py.path.local/ - thanks DanielHolth Message-ID: <20120521133821.19278.18758@bitbucket16.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/333aee3e9e9e/ changeset: 333aee3e9e9e user: RonnyPfannschmidt date: 2012-05-21 15:38:11 summary: fix doc typo s/py.test.local/py.path.local/ - thanks DanielHolth affected #: 1 file diff -r 2b8ef0fd01f6e61e33ca2673b7acf70c9db89361 -r 333aee3e9e9e9ce29e7c1d1b4b13bddf78d06092 doc/path.txt --- a/doc/path.txt +++ b/doc/path.txt @@ -8,7 +8,7 @@ files/directories, examining the types and structure, etc.), and out-of-the-box provides a number of implementations of this API. -py.test.local - local file system path +py.path.local - local file system path =============================================== .. _`local`: Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 22 14:08:19 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 22 May 2012 12:08:19 -0000 Subject: [py-svn] commit/pytest: peircej: minor fix to docs/usage Message-ID: <20120522120819.30992.43655@bitbucket15.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/46c23fd6b785/ changeset: 46c23fd6b785 user: peircej date: 2012-05-22 13:24:53 summary: minor fix to docs/usage affected #: 1 file diff -r e91d173fa1d84511923fb20b58cbe945d86a96e8 -r 46c23fd6b785629030446a30e83e09c56ff0a8cd doc/usage.txt --- a/doc/usage.txt +++ b/doc/usage.txt @@ -36,7 +36,7 @@ To stop the testing process after the first (N) failures:: py.test -x # stop after first failure - py.test -maxfail=2 # stop after two failures + py.test --maxfail=2 # stop after two failures Specifying tests / selecting tests --------------------------------------------------- Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 22 16:21:08 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 22 May 2012 14:21:08 -0000 Subject: [py-svn] commit/pytest: RonnyPfannschmidt: skip test for pyo on pypy since pypy doesnt do pyo Message-ID: <20120522142108.22390.21591@bitbucket12.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/3109649e4009/ changeset: 3109649e4009 user: RonnyPfannschmidt date: 2012-05-22 16:20:58 summary: skip test for pyo on pypy since pypy doesnt do pyo affected #: 1 file diff -r 46c23fd6b785629030446a30e83e09c56ff0a8cd -r 3109649e400927e2b89ad41127ad39c282680126 testing/test_assertrewrite.py --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -350,6 +350,7 @@ monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", "1") assert testdir.runpytest().ret == 0 + @pytest.mark.skipif('"__pypy__" in sys.modules') def test_pyc_vs_pyo(self, testdir, monkeypatch): testdir.makepyfile(""" import pytest Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 22 17:18:33 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 22 May 2012 15:18:33 -0000 Subject: [py-svn] commit/pytest: hpk42: fix issue 144 - wrong classname in junitxml Message-ID: <20120522151833.26391.59489@bitbucket05.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/a233e29b1941/ changeset: a233e29b1941 user: hpk42 date: 2012-05-22 17:18:04 summary: fix issue 144 - wrong classname in junitxml affected #: 4 files diff -r 3109649e400927e2b89ad41127ad39c282680126 -r a233e29b19411b9906980dc963c374fa180c3875 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -12,6 +12,7 @@ - fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net - fix issue #143: call unconfigure/sessionfinish always when configure/sessionstart where called +- fix issue #144: better mangle test ids to junitxml classnames Changes between 2.2.2 and 2.2.3 ---------------------------------------- diff -r 3109649e400927e2b89ad41127ad39c282680126 -r a233e29b19411b9906980dc963c374fa180c3875 _pytest/junitxml.py --- a/_pytest/junitxml.py +++ b/_pytest/junitxml.py @@ -81,6 +81,11 @@ config.pluginmanager.unregister(xml) +def mangle_testnames(names): + names = [x.replace(".py", "") for x in names if x != '()'] + names[0] = names[0].replace("/", '.') + return names + class LogXML(object): def __init__(self, logfile, prefix): logfile = os.path.expanduser(os.path.expandvars(logfile)) @@ -91,9 +96,7 @@ self.failed = self.errors = 0 def _opentestcase(self, report): - names = report.nodeid.split("::") - names[0] = names[0].replace("/", '.') - names = [x.replace(".py", "") for x in names if x != "()"] + names = mangle_testnames(report.nodeid.split("::")) classnames = names[:-1] if self.prefix: classnames.insert(0, self.prefix) diff -r 3109649e400927e2b89ad41127ad39c282680126 -r a233e29b19411b9906980dc963c374fa180c3875 doc/announce/release-2.2.4.txt --- a/doc/announce/release-2.2.4.txt +++ b/doc/announce/release-2.2.4.txt @@ -34,4 +34,5 @@ - fix issue #141: switch from the deceased paste.pocoo.org to bpaste.net - fix issue #143: call unconfigure/sessionfinish always when configure/sessionstart where called +- fix issue #144: better mangle test ids to junitxml classnames diff -r 3109649e400927e2b89ad41127ad39c282680126 -r a233e29b19411b9906980dc963c374fa180c3875 testing/test_junitxml.py --- a/testing/test_junitxml.py +++ b/testing/test_junitxml.py @@ -279,6 +279,13 @@ if not sys.platform.startswith("java"): assert "hx" in fnode.toxml() +def test_mangle_testnames(): + from _pytest.junitxml import mangle_testnames + names = ["a/pything.py", "Class", "()", "method"] + newnames = mangle_testnames(names) + assert newnames == ["a.pything", "Class", "method"] + + class TestNonPython: def test_summing_simple(self, testdir): testdir.makeconftest(""" Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 22 17:25:00 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 22 May 2012 15:25:00 -0000 Subject: [py-svn] commit/pytest: hpk42: upgrade inlined distribute_setup.py Message-ID: <20120522152500.22853.98697@bitbucket02.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/ad9fe504a371/ changeset: ad9fe504a371 user: hpk42 date: 2012-05-22 17:24:43 summary: upgrade inlined distribute_setup.py affected #: 3 files diff -r a233e29b19411b9906980dc963c374fa180c3875 -r ad9fe504a371ad8eb613052d58f229aa66f53527 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -13,6 +13,7 @@ - fix issue #143: call unconfigure/sessionfinish always when configure/sessionstart where called - fix issue #144: better mangle test ids to junitxml classnames +- upgrade distribute_setup.py to 0.6.27 Changes between 2.2.2 and 2.2.3 ---------------------------------------- diff -r a233e29b19411b9906980dc963c374fa180c3875 -r ad9fe504a371ad8eb613052d58f229aa66f53527 distribute_setup.py --- a/distribute_setup.py +++ b/distribute_setup.py @@ -46,7 +46,7 @@ args = [quote(arg) for arg in args] return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 -DEFAULT_VERSION = "0.6.24" +DEFAULT_VERSION = "0.6.27" DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" SETUPTOOLS_FAKED_VERSION = "0.6c11" @@ -63,7 +63,7 @@ """ % SETUPTOOLS_FAKED_VERSION -def _install(tarball): +def _install(tarball, install_args=()): # extracting the tarball tmpdir = tempfile.mkdtemp() log.warn('Extracting in %s', tmpdir) @@ -81,7 +81,7 @@ # installing log.warn('Installing Distribute') - if not _python_cmd('setup.py', 'install'): + if not _python_cmd('setup.py', 'install', *install_args): log.warn('Something went wrong during the installation.') log.warn('See the error message above.') finally: @@ -306,6 +306,9 @@ log.warn('%s already exists', pkg_info) return + if not os.access(pkg_info, os.W_OK): + log.warn("Don't have permissions to write %s, skipping", pkg_info) + log.warn('Creating %s', pkg_info) f = open(pkg_info, 'w') try: @@ -474,11 +477,20 @@ else: self._dbg(1, "tarfile: %s" % e) +def _build_install_args(argv): + install_args = [] + user_install = '--user' in argv + if user_install and sys.version_info < (2,6): + log.warn("--user requires Python 2.6 or later") + raise SystemExit(1) + if user_install: + install_args.append('--user') + return install_args def main(argv, version=DEFAULT_VERSION): """Install or upgrade setuptools and EasyInstall""" tarball = download_setuptools() - _install(tarball) + _install(tarball, _build_install_args(argv)) if __name__ == '__main__': diff -r a233e29b19411b9906980dc963c374fa180c3875 -r ad9fe504a371ad8eb613052d58f229aa66f53527 doc/announce/release-2.2.4.txt --- a/doc/announce/release-2.2.4.txt +++ b/doc/announce/release-2.2.4.txt @@ -35,4 +35,5 @@ - fix issue #143: call unconfigure/sessionfinish always when configure/sessionstart where called - fix issue #144: better mangle test ids to junitxml classnames +- upgrade distribute_setup.py to 0.6.27 Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 22 17:27:22 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 22 May 2012 15:27:22 -0000 Subject: [py-svn] commit/py: hpk42: update distribute_setup.py Message-ID: <20120522152722.17650.40261@bitbucket13.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/6be37b7cb55c/ changeset: 6be37b7cb55c user: hpk42 date: 2012-05-22 17:22:38 summary: update distribute_setup.py affected #: 2 files diff -r 333aee3e9e9e9ce29e7c1d1b4b13bddf78d06092 -r 6be37b7cb55c6ac1da9e9afa4dbbae6c1f499fd2 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ - fix issue 13 - correct handling of the tag name object in xmlgen - fix issue 14 - support raw attribute values in xmlgen - fix windows terminalwriter printing/re-line problem +- update distribute_setup.py to 0.6.27 Changes between 1.4.6 and 1.4.7 ================================================== diff -r 333aee3e9e9e9ce29e7c1d1b4b13bddf78d06092 -r 6be37b7cb55c6ac1da9e9afa4dbbae6c1f499fd2 distribute_setup.py --- a/distribute_setup.py +++ b/distribute_setup.py @@ -46,7 +46,7 @@ args = [quote(arg) for arg in args] return os.spawnl(os.P_WAIT, sys.executable, *args) == 0 -DEFAULT_VERSION = "0.6.19" +DEFAULT_VERSION = "0.6.27" DEFAULT_URL = "http://pypi.python.org/packages/source/d/distribute/" SETUPTOOLS_FAKED_VERSION = "0.6c11" @@ -63,7 +63,7 @@ """ % SETUPTOOLS_FAKED_VERSION -def _install(tarball): +def _install(tarball, install_args=()): # extracting the tarball tmpdir = tempfile.mkdtemp() log.warn('Extracting in %s', tmpdir) @@ -81,7 +81,7 @@ # installing log.warn('Installing Distribute') - if not _python_cmd('setup.py', 'install'): + if not _python_cmd('setup.py', 'install', *install_args): log.warn('Something went wrong during the installation.') log.warn('See the error message above.') finally: @@ -306,6 +306,9 @@ log.warn('%s already exists', pkg_info) return + if not os.access(pkg_info, os.W_OK): + log.warn("Don't have permissions to write %s, skipping", pkg_info) + log.warn('Creating %s', pkg_info) f = open(pkg_info, 'w') try: @@ -474,11 +477,20 @@ else: self._dbg(1, "tarfile: %s" % e) +def _build_install_args(argv): + install_args = [] + user_install = '--user' in argv + if user_install and sys.version_info < (2,6): + log.warn("--user requires Python 2.6 or later") + raise SystemExit(1) + if user_install: + install_args.append('--user') + return install_args def main(argv, version=DEFAULT_VERSION): """Install or upgrade setuptools and EasyInstall""" tarball = download_setuptools() - _install(tarball) + _install(tarball, _build_install_args(argv)) if __name__ == '__main__': Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Tue May 22 18:31:27 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 22 May 2012 16:31:27 -0000 Subject: [py-svn] commit/pytest: 2 new changesets Message-ID: <20120522163127.17650.37036@bitbucket13.managed.contegix.com> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/changeset/b86c6abdff3f/ changeset: b86c6abdff3f user: hpk42 date: 2012-05-22 18:27:49 summary: Added tag 2.2.4 for changeset ad9fe504a371 affected #: 1 file diff -r ad9fe504a371ad8eb613052d58f229aa66f53527 -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e .hgtags --- a/.hgtags +++ b/.hgtags @@ -48,3 +48,4 @@ 3da8cec6c5326ed27c144c9b6d7a64a648370005 2.2.1 92b916483c1e65a80dc80e3f7816b39e84b36a4d 2.2.2 3c11c5c9776f3c678719161e96cc0a08169c1cb8 2.2.3 +ad9fe504a371ad8eb613052d58f229aa66f53527 2.2.4 https://bitbucket.org/hpk42/pytest/changeset/1433a6971560/ changeset: 1433a6971560 user: hpk42 date: 2012-05-22 18:30:34 summary: update examples with 2.2.4 version, ReST fixes affected #: 18 files diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/announce/index.txt --- a/doc/announce/index.txt +++ b/doc/announce/index.txt @@ -5,6 +5,7 @@ .. toctree:: :maxdepth: 2 + release-2.2.4 release-2.2.2 release-2.2.1 release-2.2.0 diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/assert.txt --- a/doc/assert.txt +++ b/doc/assert.txt @@ -23,7 +23,7 @@ $ py.test test_assert1.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_assert1.py F @@ -37,7 +37,7 @@ E + where 3 = f() test_assert1.py:5: AssertionError - ========================= 1 failed in 0.02 seconds ========================= + ========================= 1 failed in 0.01 seconds ========================= py.test has support for showing the values of the most common subexpressions including calls, attributes, comparisons, and binary and unary @@ -105,7 +105,7 @@ $ py.test test_assert2.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_assert2.py F @@ -124,7 +124,7 @@ E '5' test_assert2.py:5: AssertionError - ========================= 1 failed in 0.03 seconds ========================= + ========================= 1 failed in 0.01 seconds ========================= Special comparisons are done for a number of cases: @@ -181,7 +181,7 @@ E vals: 1 != 2 test_foocompare.py:8: AssertionError - 1 failed in 0.02 seconds + 1 failed in 0.01 seconds .. _assert-details: .. _`assert introspection`: diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/builtin.txt --- a/doc/builtin.txt +++ b/doc/builtin.txt @@ -28,7 +28,7 @@ $ py.test --funcargs =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collected 0 items pytestconfig the pytest config object with access to command line opts. @@ -76,7 +76,5 @@ See http://docs.python.org/library/warnings.html for information on warning categories. - cov - A pytest funcarg that provides access to the underlying coverage object. - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/capture.txt --- a/doc/capture.txt +++ b/doc/capture.txt @@ -64,7 +64,7 @@ $ py.test =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items test_module.py .F @@ -78,8 +78,8 @@ test_module.py:9: AssertionError ----------------------------- Captured stdout ------------------------------ - setting up - ==================== 1 failed, 1 passed in 0.03 seconds ==================== + setting up + ==================== 1 failed, 1 passed in 0.01 seconds ==================== Accessing captured output from a test function --------------------------------------------------- diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/doctest.txt --- a/doc/doctest.txt +++ b/doc/doctest.txt @@ -44,10 +44,9 @@ $ py.test =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items mymodule.py . - ========================= 1 passed in 0.51 seconds ========================= - [?1034h \ No newline at end of file + ========================= 1 passed in 0.02 seconds ========================= diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/markers.txt --- a/doc/example/markers.txt +++ b/doc/example/markers.txt @@ -26,25 +26,25 @@ $ py.test -v -m webtest =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 -- /Users/hpk/venv/0/bin/python + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 -- /home/hpk/venv/0/bin/python collecting ... collected 2 items test_server.py:3: test_send_http PASSED =================== 1 tests deselected by "-m 'webtest'" =================== - ================== 1 passed, 1 deselected in 0.01 seconds ================== + ================== 1 passed, 1 deselected in 0.00 seconds ================== Or the inverse, running all tests except the webtest ones:: $ py.test -v -m "not webtest" =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 -- /Users/hpk/venv/0/bin/python + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 -- /home/hpk/venv/0/bin/python collecting ... collected 2 items test_server.py:6: test_something_quick PASSED ================= 1 tests deselected by "-m 'not webtest'" ================= - ================== 1 passed, 1 deselected in 0.02 seconds ================== + ================== 1 passed, 1 deselected in 0.00 seconds ================== Registering markers ------------------------------------- @@ -143,38 +143,38 @@ $ py.test -k send_http # running with the above defined examples =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 4 items test_server.py . =================== 3 tests deselected by '-ksend_http' ==================== - ================== 1 passed, 3 deselected in 0.02 seconds ================== + ================== 1 passed, 3 deselected in 0.01 seconds ================== And you can also run all tests except the ones that match the keyword:: $ py.test -k-send_http =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 4 items test_mark_classlevel.py .. test_server.py . =================== 1 tests deselected by '-k-send_http' =================== - ================== 3 passed, 1 deselected in 0.03 seconds ================== + ================== 3 passed, 1 deselected in 0.01 seconds ================== Or to only select the class:: $ py.test -kTestClass =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 4 items test_mark_classlevel.py .. =================== 2 tests deselected by '-kTestClass' ==================== - ================== 2 passed, 2 deselected in 0.03 seconds ================== + ================== 2 passed, 2 deselected in 0.01 seconds ================== .. _`adding a custom marker from a plugin`: @@ -223,23 +223,23 @@ $ py.test -E stage2 =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_someenv.py s - ======================== 1 skipped in 0.02 seconds ========================= + ======================== 1 skipped in 0.00 seconds ========================= and here is one that specifies exactly the environment needed:: $ py.test -E stage1 =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_someenv.py . - ========================= 1 passed in 0.02 seconds ========================= + ========================= 1 passed in 0.00 seconds ========================= The ``--markers`` option always gives you a list of available markers:: @@ -291,7 +291,7 @@ $ py.test -q -s collecting ... collected 2 items .. - 2 passed in 0.02 seconds + 2 passed in 0.01 seconds glob args=('function',) kwargs={'x': 3} glob args=('class',) kwargs={'x': 2} glob args=('module',) kwargs={'x': 1} diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/mysetup.txt --- a/doc/example/mysetup.txt +++ b/doc/example/mysetup.txt @@ -49,7 +49,7 @@ $ py.test test_sample.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_sample.py F @@ -57,7 +57,7 @@ ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - mysetup = + mysetup = def test_answer(mysetup): app = mysetup.myapp() @@ -66,7 +66,7 @@ E assert 54 == 42 test_sample.py:4: AssertionError - ========================= 1 failed in 0.72 seconds ========================= + ========================= 1 failed in 0.01 seconds ========================= This means that our ``mysetup`` object was successfully instantiated and ``mysetup.app()`` returned an initialized ``MyApp`` instance. @@ -122,14 +122,14 @@ $ py.test test_ssh.py -rs =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_ssh.py s ========================= short test summary info ========================== - SKIP [1] /Users/hpk/tmp/doc-exec-153/conftest.py:22: specify ssh host with --ssh + SKIP [1] /tmp/doc-exec-220/conftest.py:22: specify ssh host with --ssh - ======================== 1 skipped in 0.02 seconds ========================= + ======================== 1 skipped in 0.01 seconds ========================= If you specify a command line option like ``py.test --ssh=python.org`` the test will execute as expected. diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/nonpython.txt --- a/doc/example/nonpython.txt +++ b/doc/example/nonpython.txt @@ -27,7 +27,7 @@ nonpython $ py.test test_simple.yml =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items test_simple.yml .F @@ -37,7 +37,7 @@ usecase execution failed spec failed: 'some': 'other' no further details known at this point. - ==================== 1 failed, 1 passed in 0.48 seconds ==================== + ==================== 1 failed, 1 passed in 0.06 seconds ==================== You get one dot for the passing ``sub1: sub1`` check and one failure. Obviously in the above ``conftest.py`` you'll want to implement a more @@ -56,7 +56,7 @@ nonpython $ py.test -v =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 -- /Users/hpk/venv/0/bin/python + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 -- /home/hpk/venv/0/bin/python collecting ... collected 2 items test_simple.yml:1: usecase: ok PASSED @@ -67,17 +67,17 @@ usecase execution failed spec failed: 'some': 'other' no further details known at this point. - ==================== 1 failed, 1 passed in 0.10 seconds ==================== + ==================== 1 failed, 1 passed in 0.06 seconds ==================== While developing your custom test collection and execution it's also interesting to just look at the collection tree:: nonpython $ py.test --collectonly =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items - ============================= in 0.18 seconds ============================= + ============================= in 0.07 seconds ============================= diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/parametrize.txt --- a/doc/example/parametrize.txt +++ b/doc/example/parametrize.txt @@ -54,7 +54,7 @@ E + where 54 = eval('6*9') test_expectation.py:8: AssertionError - 1 failed, 2 passed in 0.03 seconds + 1 failed, 2 passed in 0.01 seconds As expected only one pair of input/output values fails the simple test function. @@ -96,7 +96,7 @@ $ py.test -q test_compute.py collecting ... collected 2 items .. - 2 passed in 0.03 seconds + 2 passed in 0.01 seconds We run only two computations, so we see two dots. let's run the full monty:: @@ -114,7 +114,7 @@ E assert 4 < 4 test_compute.py:3: AssertionError - 1 failed, 4 passed in 0.05 seconds + 1 failed, 4 passed in 0.02 seconds As expected when running the full range of ``param1`` values we'll get an error on the last one. @@ -154,19 +154,19 @@ $ py.test test_scenarios.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items test_scenarios.py .. - ========================= 2 passed in 0.02 seconds ========================= + ========================= 2 passed in 0.01 seconds ========================= If you just collect tests you'll also nicely see 'advanced' and 'basic' as variants for the test function:: $ py.test --collectonly test_scenarios.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items @@ -174,7 +174,7 @@ - ============================= in 0.05 seconds ============================= + ============================= in 0.00 seconds ============================= Deferring the setup of parametrized resources --------------------------------------------------- @@ -222,13 +222,13 @@ $ py.test test_backends.py --collectonly =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= And then when we run the test:: @@ -238,7 +238,7 @@ ================================= FAILURES ================================= _________________________ test_db_initialized[d2] __________________________ - db = + db = def test_db_initialized(db): # a dummy test @@ -247,7 +247,7 @@ E Failed: deliberately failing for demo purposes test_backends.py:6: Failed - 1 failed, 1 passed in 0.03 seconds + 1 failed, 1 passed in 0.01 seconds The first invocation with ``db == "DB1"`` passed while the second with ``db == "DB2"`` failed. Our ``pytest_funcarg__db`` factory has instantiated each of the DB values during the setup phase while the ``pytest_generate_tests`` generated two according calls to the ``test_db_initialized`` during the collection phase. @@ -295,14 +295,14 @@ ================================= FAILURES ================================= ________________________ TestClass.test_equals[1-2] ________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 def test_equals(self, a, b): > assert a == b E assert 1 == 2 test_parametrize.py:18: AssertionError - 1 failed, 2 passed in 0.03 seconds + 1 failed, 2 passed in 0.01 seconds Indirect parametrization with multiple resources -------------------------------------------------------------- @@ -322,8 +322,7 @@ . $ py.test -rs -q multipython.py collecting ... collected 75 items - ssssssssssssssssss.........ssssss.........ssssss.........ssssssssssssssssss + ............sss............sss............sss............ssssssssssssssssss ========================= short test summary info ========================== - SKIP [24] /Users/hpk/p/pytest/doc/example/multipython.py:36: 'python2.8' not found - SKIP [24] /Users/hpk/p/pytest/doc/example/multipython.py:36: 'python2.4' not found - 27 passed, 48 skipped in 7.76 seconds + SKIP [27] /home/hpk/p/pytest/doc/example/multipython.py:36: 'python2.8' not found + 48 passed, 27 skipped in 1.71 seconds diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/pythoncollection.txt --- a/doc/example/pythoncollection.txt +++ b/doc/example/pythoncollection.txt @@ -43,7 +43,7 @@ $ py.test --collectonly =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items @@ -51,7 +51,7 @@ - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= Interpreting cmdline arguments as Python packages ----------------------------------------------------- @@ -82,7 +82,7 @@ . $ py.test --collectonly pythoncollection.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 3 items @@ -91,4 +91,4 @@ - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/reportingdemo.txt --- a/doc/example/reportingdemo.txt +++ b/doc/example/reportingdemo.txt @@ -13,7 +13,7 @@ assertion $ py.test failure_demo.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 39 items failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF @@ -30,7 +30,7 @@ failure_demo.py:15: AssertionError _________________________ TestFailing.test_simple __________________________ - self = + self = def test_simple(self): def f(): @@ -40,13 +40,13 @@ > assert f() == g() E assert 42 == 43 - E + where 42 = () - E + and 43 = () + E + where 42 = () + E + and 43 = () failure_demo.py:28: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ - self = + self = def test_simple_multiline(self): otherfunc_multi( @@ -66,19 +66,19 @@ failure_demo.py:11: AssertionError ___________________________ TestFailing.test_not ___________________________ - self = + self = def test_not(self): def f(): return 42 > assert not f() E assert not 42 - E + where 42 = () + E + where 42 = () failure_demo.py:38: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ - self = + self = def test_eq_text(self): > assert 'spam' == 'eggs' @@ -89,7 +89,7 @@ failure_demo.py:42: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ - self = + self = def test_eq_similar_text(self): > assert 'foo 1 bar' == 'foo 2 bar' @@ -102,7 +102,7 @@ failure_demo.py:45: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ - self = + self = def test_eq_multiline_text(self): > assert 'foo\nspam\nbar' == 'foo\neggs\nbar' @@ -115,7 +115,7 @@ failure_demo.py:48: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ - self = + self = def test_eq_long_text(self): a = '1'*100 + 'a' + '2'*100 @@ -132,7 +132,7 @@ failure_demo.py:53: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ - self = + self = def test_eq_long_text_multiline(self): a = '1\n'*100 + 'a' + '2\n'*100 @@ -156,7 +156,7 @@ failure_demo.py:58: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ - self = + self = def test_eq_list(self): > assert [0, 1, 2] == [0, 1, 3] @@ -166,7 +166,7 @@ failure_demo.py:61: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ - self = + self = def test_eq_list_long(self): a = [0]*100 + [1] + [3]*100 @@ -178,7 +178,7 @@ failure_demo.py:66: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ - self = + self = def test_eq_dict(self): > assert {'a': 0, 'b': 1} == {'a': 0, 'b': 2} @@ -191,7 +191,7 @@ failure_demo.py:69: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ - self = + self = def test_eq_set(self): > assert set([0, 10, 11, 12]) == set([0, 20, 21]) @@ -207,7 +207,7 @@ failure_demo.py:72: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ - self = + self = def test_eq_longer_list(self): > assert [1,2] == [1,2,3] @@ -217,7 +217,7 @@ failure_demo.py:75: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ - self = + self = def test_in_list(self): > assert 1 in [0, 2, 3, 4, 5] @@ -226,7 +226,7 @@ failure_demo.py:78: AssertionError __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ - self = + self = def test_not_in_text_multiline(self): text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail' @@ -244,7 +244,7 @@ failure_demo.py:82: AssertionError ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ - self = + self = def test_not_in_text_single(self): text = 'single foo line' @@ -257,7 +257,7 @@ failure_demo.py:86: AssertionError _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ - self = + self = def test_not_in_text_single_long(self): text = 'head ' * 50 + 'foo ' + 'tail ' * 20 @@ -270,7 +270,7 @@ failure_demo.py:90: AssertionError ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ - self = + self = def test_not_in_text_single_long_term(self): text = 'head ' * 50 + 'f'*70 + 'tail ' * 20 @@ -289,7 +289,7 @@ i = Foo() > assert i.b == 2 E assert 1 == 2 - E + where 1 = .b + E + where 1 = .b failure_demo.py:101: AssertionError _________________________ test_attribute_instance __________________________ @@ -299,8 +299,8 @@ b = 1 > assert Foo().b == 2 E assert 1 == 2 - E + where 1 = .b - E + where = () + E + where 1 = .b + E + where = () failure_demo.py:107: AssertionError __________________________ test_attribute_failure __________________________ @@ -316,7 +316,7 @@ failure_demo.py:116: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - self = + self = def _get_b(self): > raise Exception('Failed to get attrib') @@ -332,15 +332,15 @@ b = 2 > assert Foo().b == Bar().b E assert 1 == 2 - E + where 1 = .b - E + where = () - E + and 2 = .b - E + where = () + E + where 1 = .b + E + where = () + E + and 2 = .b + E + where = () failure_demo.py:124: AssertionError __________________________ TestRaises.test_raises __________________________ - self = + self = def test_raises(self): s = 'qwe' @@ -352,10 +352,10 @@ > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - <0-codegen /Users/hpk/p/pytest/_pytest/python.py:976>:1: ValueError + <0-codegen /home/hpk/p/pytest/_pytest/python.py:978>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ - self = + self = def test_raises_doesnt(self): > raises(IOError, "int('3')") @@ -364,7 +364,7 @@ failure_demo.py:136: Failed __________________________ TestRaises.test_raise ___________________________ - self = + self = def test_raise(self): > raise ValueError("demo error") @@ -373,7 +373,7 @@ failure_demo.py:139: ValueError ________________________ TestRaises.test_tupleerror ________________________ - self = + self = def test_tupleerror(self): > a,b = [1] @@ -382,7 +382,7 @@ failure_demo.py:142: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ - self = + self = def test_reinterpret_fails_with_print_for_the_fun_of_it(self): l = [1,2,3] @@ -395,7 +395,7 @@ l is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ - self = + self = def test_some_error(self): > if namenotexi: @@ -420,10 +420,10 @@ > assert 1 == 0 E assert 1 == 0 - <2-codegen 'abc-123' /Users/hpk/p/pytest/doc/example/assertion/failure_demo.py:162>:2: AssertionError + <2-codegen 'abc-123' /home/hpk/p/pytest/doc/example/assertion/failure_demo.py:162>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ - self = + self = def test_complex_error(self): def f(): @@ -452,7 +452,7 @@ failure_demo.py:5: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ - self = + self = def test_z1_unpack_error(self): l = [] @@ -462,7 +462,7 @@ failure_demo.py:179: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ - self = + self = def test_z2_type_error(self): l = 3 @@ -472,19 +472,19 @@ failure_demo.py:183: TypeError ______________________ TestMoreErrors.test_startswith ______________________ - self = + self = def test_startswith(self): s = "123" g = "456" > assert s.startswith(g) - E assert ('456') - E + where = '123'.startswith + E assert ('456') + E + where = '123'.startswith failure_demo.py:188: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ - self = + self = def test_startswith_nested(self): def f(): @@ -492,15 +492,15 @@ def g(): return "456" > assert f().startswith(g()) - E assert ('456') - E + where = '123'.startswith - E + where '123' = () - E + and '456' = () + E assert ('456') + E + where = '123'.startswith + E + where '123' = () + E + and '456' = () failure_demo.py:195: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ - self = + self = def test_global_func(self): > assert isinstance(globf(42), float) @@ -510,18 +510,18 @@ failure_demo.py:198: AssertionError _______________________ TestMoreErrors.test_instance _______________________ - self = + self = def test_instance(self): self.x = 6*7 > assert self.x != 42 E assert 42 != 42 - E + where 42 = .x + E + where 42 = .x failure_demo.py:202: AssertionError _______________________ TestMoreErrors.test_compare ________________________ - self = + self = def test_compare(self): > assert globf(10) < 5 @@ -531,7 +531,7 @@ failure_demo.py:205: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ - self = + self = def test_try_finally(self): x = 1 @@ -540,4 +540,4 @@ E assert 1 == 0 failure_demo.py:210: AssertionError - ======================== 39 failed in 1.05 seconds ========================= + ======================== 39 failed in 0.17 seconds ========================= diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/example/simple.txt --- a/doc/example/simple.txt +++ b/doc/example/simple.txt @@ -53,7 +53,7 @@ test_sample.py:6: AssertionError ----------------------------- Captured stdout ------------------------------ first - 1 failed in 0.50 seconds + 1 failed in 0.01 seconds And now with supplying a command line option:: @@ -76,7 +76,7 @@ test_sample.py:6: AssertionError ----------------------------- Captured stdout ------------------------------ second - 1 failed in 0.02 seconds + 1 failed in 0.01 seconds Ok, this completes the basic pattern. However, one often rather wants to process command line options outside of the test and @@ -109,13 +109,13 @@ $ py.test =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 - gw0 I - gw0 [0] + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 + gw0 I / gw1 I / gw2 I / gw3 I + gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0] scheduling tests via LoadScheduling - ============================= in 5.12 seconds ============================= + ============================= in 0.52 seconds ============================= .. _`excontrolskip`: @@ -156,25 +156,25 @@ $ py.test -rs # "-rs" means report details on the little 's' =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items test_module.py .s ========================= short test summary info ========================== - SKIP [1] /Users/hpk/tmp/doc-exec-158/conftest.py:9: need --runslow option to run + SKIP [1] /tmp/doc-exec-225/conftest.py:9: need --runslow option to run - =================== 1 passed, 1 skipped in 0.09 seconds ==================== + =================== 1 passed, 1 skipped in 0.01 seconds ==================== Or run it including the ``slow`` marked test:: $ py.test --runslow =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items test_module.py .. - ========================= 2 passed in 0.02 seconds ========================= + ========================= 2 passed in 0.01 seconds ========================= Writing well integrated assertion helpers -------------------------------------------------- @@ -213,7 +213,7 @@ E Failed: not configured: 42 test_checkconfig.py:8: Failed - 1 failed in 0.07 seconds + 1 failed in 0.01 seconds Detect if running from within a py.test run -------------------------------------------------------------- @@ -261,11 +261,11 @@ $ py.test =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 project deps: mylib-1.1 collecting ... collected 0 items - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= .. regendoc:wipe @@ -284,21 +284,21 @@ $ py.test -v =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 -- /Users/hpk/venv/0/bin/python + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 -- /home/hpk/venv/0/bin/python info1: did you know that ... did you? collecting ... collected 0 items - ============================= in 0.03 seconds ============================= + ============================= in 0.00 seconds ============================= and nothing when run plainly:: $ py.test =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 0 items - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= profiling test duration -------------------------- @@ -327,7 +327,7 @@ $ py.test --durations=3 =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 3 items test_some_are_slow.py ... @@ -335,5 +335,5 @@ ========================= slowest 3 test durations ========================= 0.20s call test_some_are_slow.py::test_funcslow2 0.10s call test_some_are_slow.py::test_funcslow1 - 0.00s call test_some_are_slow.py::test_funcfast - ========================= 3 passed in 0.33 seconds ========================= + 0.00s setup test_some_are_slow.py::test_funcslow2 + ========================= 3 passed in 0.31 seconds ========================= diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/funcargs.txt --- a/doc/funcargs.txt +++ b/doc/funcargs.txt @@ -62,7 +62,7 @@ $ py.test test_simplefactory.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_simplefactory.py F @@ -77,7 +77,7 @@ E assert 42 == 17 test_simplefactory.py:5: AssertionError - ========================= 1 failed in 0.03 seconds ========================= + ========================= 1 failed in 0.01 seconds ========================= This means that indeed the test function was called with a ``myfuncarg`` argument value of ``42`` and the assert fails. Here is how py.test @@ -167,7 +167,7 @@ $ py.test test_example.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 10 items test_example.py .........F @@ -182,7 +182,7 @@ E assert 9 < 9 test_example.py:6: AssertionError - ==================== 1 failed, 9 passed in 0.07 seconds ==================== + ==================== 1 failed, 9 passed in 0.02 seconds ==================== Obviously, only when ``numiter`` has the value of ``9`` does the test fail. Note that the ``pytest_generate_tests(metafunc)`` hook is called during the test collection phase which is separate from the actual test running. @@ -190,7 +190,7 @@ $ py.test --collectonly test_example.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 10 items @@ -204,13 +204,13 @@ - ============================= in 0.01 seconds ============================= + ============================= in 0.00 seconds ============================= If you want to select only the run with the value ``7`` you could do:: $ py.test -v -k 7 test_example.py # or -k test_func[7] =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 -- /Users/hpk/venv/0/bin/python + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 -- /home/hpk/venv/0/bin/python collecting ... collected 10 items test_example.py:5: test_func[7] PASSED diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/getting-started.txt --- a/doc/getting-started.txt +++ b/doc/getting-started.txt @@ -22,10 +22,9 @@ To check your installation has installed the correct version:: $ py.test --version - This is py.test version 2.2.2, imported from /Users/hpk/p/pytest/pytest.pyc + This is py.test version 2.2.4, imported from /home/hpk/p/pytest/pytest.py setuptools registered plugins: - pytest-xdist-1.8 at /Users/hpk/p/pytest-xdist/xdist/plugin.pyc - pytest-cov-1.4 at /Users/hpk/venv/0/lib/python2.7/site-packages/pytest_cov.pyc + pytest-xdist-1.8 at /home/hpk/p/pytest-xdist/xdist/plugin.pyc If you get an error checkout :ref:`installation issues`. @@ -47,7 +46,7 @@ $ py.test =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_sample.py F @@ -61,7 +60,7 @@ E + where 4 = func(3) test_sample.py:5: AssertionError - ========================= 1 failed in 0.02 seconds ========================= + ========================= 1 failed in 0.01 seconds ========================= py.test found the ``test_answer`` function by following :ref:`standard test discovery rules `, basically detecting the ``test_`` prefixes. We got a failure report because our little ``func(3)`` call did not return ``5``. @@ -96,7 +95,7 @@ $ py.test -q test_sysexit.py collecting ... collected 1 items . - 1 passed in 0.01 seconds + 1 passed in 0.00 seconds .. todo:: For further ways to assert exceptions see the `raises` @@ -127,7 +126,7 @@ ================================= FAILURES ================================= ____________________________ TestClass.test_two ____________________________ - self = + self = def test_two(self): x = "hello" @@ -135,7 +134,7 @@ E assert hasattr('hello', 'check') test_class.py:8: AssertionError - 1 failed, 1 passed in 0.03 seconds + 1 failed, 1 passed in 0.01 seconds The first test passed, the second failed. Again we can easily see the intermediate values used in the assertion, helping us to @@ -164,7 +163,7 @@ ================================= FAILURES ================================= _____________________________ test_needsfiles ______________________________ - tmpdir = local('/Users/hpk/tmp/pytest-20/test_needsfiles0') + tmpdir = local('/tmp/pytest-22/test_needsfiles0') def test_needsfiles(tmpdir): print tmpdir @@ -173,8 +172,8 @@ test_tmpdir.py:3: AssertionError ----------------------------- Captured stdout ------------------------------ - /Users/hpk/tmp/pytest-20/test_needsfiles0 - 1 failed in 0.11 seconds + /tmp/pytest-22/test_needsfiles0 + 1 failed in 0.01 seconds Before the test runs, a unique-per-test-invocation temporary directory was created. More info at :ref:`tmpdir handling`. diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/skipping.txt --- a/doc/skipping.txt +++ b/doc/skipping.txt @@ -130,7 +130,7 @@ example $ py.test -rx xfail_demo.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 6 items xfail_demo.py xxxxxx @@ -147,7 +147,7 @@ XFAIL xfail_demo.py::test_hello6 reason: reason - ======================== 6 xfailed in 0.16 seconds ========================= + ======================== 6 xfailed in 0.03 seconds ========================= .. _`evaluation of skipif/xfail conditions`: diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/tmpdir.txt --- a/doc/tmpdir.txt +++ b/doc/tmpdir.txt @@ -28,7 +28,7 @@ $ py.test test_tmpdir.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_tmpdir.py F @@ -36,7 +36,7 @@ ================================= FAILURES ================================= _____________________________ test_create_file _____________________________ - tmpdir = local('/Users/hpk/tmp/pytest-21/test_create_file0') + tmpdir = local('/tmp/pytest-23/test_create_file0') def test_create_file(tmpdir): p = tmpdir.mkdir("sub").join("hello.txt") @@ -47,7 +47,7 @@ E assert 0 test_tmpdir.py:7: AssertionError - ========================= 1 failed in 0.07 seconds ========================= + ========================= 1 failed in 0.02 seconds ========================= .. _`base temporary directory`: diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/unittest.txt --- a/doc/unittest.txt +++ b/doc/unittest.txt @@ -24,7 +24,7 @@ $ py.test test_unittest.py =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.2 + platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 1 items test_unittest.py F @@ -42,7 +42,7 @@ test_unittest.py:8: AssertionError ----------------------------- Captured stdout ------------------------------ hello - ========================= 1 failed in 0.15 seconds ========================= + ========================= 1 failed in 0.01 seconds ========================= .. _`unittest.py style`: http://docs.python.org/library/unittest.html diff -r b86c6abdff3fc0d0b9e791b5d20c3786e6ef130e -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa doc/usage.txt --- a/doc/usage.txt +++ b/doc/usage.txt @@ -174,14 +174,18 @@ # content of myinvoke.py import pytest class MyPlugin: - def pytest_addoption(self, parser): - raise pytest.UsageError("hi from our plugin") + def pytest_sessionfinish(self): + print("*** test run reporting finishing") - pytest.main(plugins=[MyPlugin()]) + pytest.main("-qq", plugins=[MyPlugin()]) -Running it will exit quickly:: +Running it will show that ``MyPlugin`` was added and its +hook was invoked:: $ python myinvoke.py - ERROR: hi from our plugin + collecting ... collected 0 items + + in 0.00 seconds + *** test run reporting finishing .. include:: links.inc Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Wed May 23 23:40:51 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 23 May 2012 21:40:51 -0000 Subject: [py-svn] commit/pytest: hpk42: draft example for skipping py2 and py3 only tests on Message-ID: <20120523214051.2207.5077@bitbucket03.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/79a5b776a6f3/ changeset: 79a5b776a6f3 user: hpk42 date: 2012-05-23 23:40:41 summary: draft example for skipping py2 and py3 only tests on a per-module level. affected #: 4 files diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/conftest.py --- /dev/null +++ b/doc/example/py2py3/conftest.py @@ -0,0 +1,16 @@ +import sys +import pytest + +py3 = sys.version_info[0] >= 3 + +class DummyCollector(pytest.collect.File): + def collect(self): + return [] + +def pytest_pycollect_makemodule(path, parent): + bn = path.basename + if "py3" in bn and not py3 or ("py2" in bn and py3): + return DummyCollector(path, parent=parent) + + + diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/test_py2.py --- /dev/null +++ b/doc/example/py2py3/test_py2.py @@ -0,0 +1,7 @@ + +def test_exception_syntax(): + try: + 0/0 + except ZeroDivisionError, e: + assert 0, e + diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/test_py2.pyc Binary file doc/example/py2py3/test_py2.pyc has changed diff -r 1433a6971560ecce6d9ae0bebbb13d66ba6eacfa -r 79a5b776a6f3f34f8699e130cfe5440b1ff67336 doc/example/py2py3/test_py3.py --- /dev/null +++ b/doc/example/py2py3/test_py3.py @@ -0,0 +1,7 @@ + +def test_exception_syntax(): + try: + 0/0 + except ZeroDivisionError as e: + assert 0, e + Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 31 10:15:08 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 31 May 2012 08:15:08 -0000 Subject: [py-svn] commit/pytest-codecheckers: RonnyPfannschmidt: make hgdistver a dependency Message-ID: <20120531081508.15513.86932@bitbucket02.managed.contegix.com> 1 new commit in pytest-codecheckers: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/fa040790a4ab/ changeset: fa040790a4ab user: RonnyPfannschmidt date: 2012-05-31 10:14:56 summary: make hgdistver a dependency affected #: 2 files diff -r 0cfda7d80702cc34b623709a5384de56461e7783 -r fa040790a4ab2931937cdfc0efe82b664f648007 hgdistver.py --- a/hgdistver.py +++ /dev/null @@ -1,138 +0,0 @@ -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) diff -r 0cfda7d80702cc34b623709a5384de56461e7783 -r fa040790a4ab2931937cdfc0efe82b664f648007 setup.py --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ name='pytest-codecheckers', description='pytest plugin to add source code sanity checks (pep8 and friends)', long_description=__doc__, - version=get_version(), + get_version_from_scm=True, author='Ronny Pfannschmidt', author_email='Ronny.Pfannschmidt at gmx.de', url='http://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/', @@ -40,4 +40,5 @@ 'pyflakes>=0.4', 'pep8', ], + setup_requires=['hgdistver'], ) Repository URL: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 31 12:53:20 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 31 May 2012 10:53:20 -0000 Subject: [py-svn] commit/pytest-codecheckers: 2 new changesets Message-ID: <20120531105320.2846.59445@bitbucket13.managed.contegix.com> 2 new commits in pytest-codecheckers: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/bcc7f2f21c26/ changeset: bcc7f2f21c26 user: RonnyPfannschmidt date: 2012-05-31 10:24:28 summary: complete output and short filenames affected #: 3 files diff -r fa040790a4ab2931937cdfc0efe82b664f648007 -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 codecheckers/flakes.py --- a/codecheckers/flakes.py +++ b/codecheckers/flakes.py @@ -9,6 +9,6 @@ Assignment.__init__ = assignment_monkeypatched_init -def check_file(path): - return pyflakes_check(path.read(), str(path)) +def check_file(path, filename, io): + return pyflakes_check(path.read(), filename, io) diff -r fa040790a4ab2931937cdfc0efe82b664f648007 -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 codecheckers/pep.py --- a/codecheckers/pep.py +++ b/codecheckers/pep.py @@ -1,3 +1,4 @@ +import sys import pep8 class PyTestChecker(pep8.Checker): @@ -8,17 +9,21 @@ self.ignored_errors += 1 pep8.Checker.report_error(self, line_number, offset, text, check) -def check_file(path): - - pep8.process_options(['pep8', - # ignore list taken from moin - '--ignore=E202,E221,E222,E241,E301,E302,E401,E501,E701,W391,W601,W602', - '--show-source', - '--repeat', - 'dummy file', - ]) - checker = PyTestChecker(str(path)) - #XXX: bails out on death - error_count = checker.check_all() - ignored = checker.ignored_errors - return max(error_count - ignored, 0) +def check_file(path, filename, io): + oldio = sys.stdout, sys.stderr + try: + sys.stdout = sys.stderr = io + pep8.process_options(['pep8', + # ignore list taken from moin + '--ignore=E202,E221,E222,E241,E301,E302,E401,E501,E701,W391,W601,W602', + '--show-source', + '--repeat', + 'dummy file', + ]) + checker = PyTestChecker(filename, path.readlines()) + #XXX: bails out on death + error_count = checker.check_all() + ignored = checker.ignored_errors + return max(error_count - ignored, 0) + finally: + sys.stdout , sys.stderr = oldio diff -r fa040790a4ab2931937cdfc0efe82b664f648007 -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 codecheckers/plugin.py --- a/codecheckers/plugin.py +++ b/codecheckers/plugin.py @@ -9,11 +9,13 @@ self._ep = ep def runtest(self): - c = py.io.StdCapture() + io = py.io.BytesIO() mod = self._ep.load() try: - found_errors, out, err = c.call(mod.check_file, self.fspath) - self.out, self.err = out, err + main = py.path.local() + filename = main.bestrelpath(self.fspath) + found_errors = mod.check_file(self.fspath, filename, io) + self.out = io.getvalue() except: found_errors = True self.info = py.code.ExceptionInfo() https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/0f710db69530/ changeset: 0f710db69530 user: RonnyPfannschmidt date: 2012-05-31 12:53:12 summary: add filename display affected #: 1 file diff -r bcc7f2f21c26ff899d6ddf180ad7786acee3cea4 -r 0f710db6953096237ee94e4d0213a158c243b99d codecheckers/plugin.py --- a/codecheckers/plugin.py +++ b/codecheckers/plugin.py @@ -6,15 +6,16 @@ class PyCodeCheckItem(py.test.collect.Item): def __init__(self, ep, parent): py.test.collect.Item.__init__(self, ep.name, parent) + main = py.path.local() + self.filename = main.bestrelpath(self.fspath) self._ep = ep def runtest(self): + mod = self._ep.load() io = py.io.BytesIO() - mod = self._ep.load() + try: - main = py.path.local() - filename = main.bestrelpath(self.fspath) - found_errors = mod.check_file(self.fspath, filename, io) + found_errors = mod.check_file(self.fspath, self.filename, io) self.out = io.getvalue() except: found_errors = True @@ -26,10 +27,13 @@ return self.out except AttributeError: #XXX: internal error ?! - return super(PyCodeCheckItem, self).repr_failure(self.info) + self.info = py.code.ExceptionInfo() + info = getattr(self, 'info', exc_info) + return super(PyCodeCheckItem, self).repr_failure(info) def reportinfo(self): - return (self.fspath, -1, "codecheck %s" % self._ep.name) + return (self.fspath, -1, "codecheck %s %s" % ( + self._ep.name, self.filename)) class PyCheckerCollector(py.test.collect.File): Repository URL: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu May 31 12:56:06 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 31 May 2012 10:56:06 -0000 Subject: [py-svn] commit/pytest-codecheckers: RonnyPfannschmidt: add a dummy readme Message-ID: <20120531105606.15510.25691@bitbucket02.managed.contegix.com> 1 new commit in pytest-codecheckers: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/da2f2f4b7d93/ changeset: da2f2f4b7d93 user: RonnyPfannschmidt date: 2012-05-31 12:56:00 summary: add a dummy readme affected #: 1 file diff -r 0f710db6953096237ee94e4d0213a158c243b99d -r da2f2f4b7d93205727b2dda050a02e15a9834e0b README --- /dev/null +++ b/README @@ -0,0 +1,10 @@ +pytest-codecheckers +==================== + +about +----- + +;;; + +Changelog +----------- Repository URL: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.