From issues-reply at bitbucket.org Fri Nov 1 19:11:45 2013 From: issues-reply at bitbucket.org (Laurens Van Houtven) Date: Fri, 01 Nov 2013 18:11:45 -0000 Subject: [Pytest-commit] Issue #134: Ability to specify the return code for success (hpk42/tox) Message-ID: <20131101181145.1477.32543@app13.ash-private.bitbucket.org> New issue 134: Ability to specify the return code for success https://bitbucket.org/hpk42/tox/issue/134/ability-to-specify-the-return-code-for Laurens Van Houtven: Right now, tox assumes that a return code of 0 means "success". That's almost always true, but I've ran into a case where it isn't. While, arguably, that's a bug in the thing that I'm running, it would be nice if there was a way to specify the expected return code, so I don't have to do crude hacks like: ``` sh -c "pyroma . || (( $? == 10 ))" ``` From commits-noreply at bitbucket.org Sat Nov 2 07:02:31 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 02 Nov 2013 06:02:31 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131102060231.19827.24216@app10.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/d98f7495d1c7/ Changeset: d98f7495d1c7 Branch: multi-marks User: jameslan Date: 2013-11-02 05:10:13 Summary: Support multiple marks for individual parametrized argument set Affected #: 2 files diff -r 8e65b5b17d12942193881ddcb9a244bc470a6fff -r d98f7495d1c7354f1582f82dd1c56d38475c56fe _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -693,16 +693,17 @@ to set a dynamic scope using test context or configuration. """ - # individual parametrized argument sets can be wrapped in a - # marker in which case we unwrap the values and apply the mark + # individual parametrized argument sets can be wrapped in a series + # of markers in which case we unwrap the values and apply the mark # at Function init newkeywords = {} unwrapped_argvalues = [] for i, argval in enumerate(argvalues): - if isinstance(argval, MarkDecorator): + while isinstance(argval, MarkDecorator): newmark = MarkDecorator(argval.markname, argval.args[:-1], argval.kwargs) - newkeywords[i] = {newmark.markname: newmark} + newmarks = newkeywords.setdefault(i, {}) + newmarks[newmark.markname] = newmark argval = argval.args[-1] unwrapped_argvalues.append(argval) argvalues = unwrapped_argvalues diff -r 8e65b5b17d12942193881ddcb9a244bc470a6fff -r d98f7495d1c7354f1582f82dd1c56d38475c56fe testing/python/collect.py --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -355,6 +355,21 @@ rec = testdir.inline_run() rec.assertoutcome(passed=2) + def test_parametrize_with_mark(selfself, testdir): + items = testdir.getitems(""" + import pytest + @pytest.mark.foo + @pytest.mark.parametrize('arg', [ + 1, + pytest.mark.bar(pytest.mark.baz(2)) + ]) + def test_function(arg): + pass + """) + keywords = [item.keywords for item in items] + assert 'foo' in keywords[0] and 'bar' not in keywords[0] and 'baz' not in keywords[0] + assert 'foo' in keywords[1] and 'bar' in keywords[1] and 'baz' in keywords[1] + def test_function_equality_with_callspec(self, testdir, tmpdir): items = testdir.getitems(""" import pytest https://bitbucket.org/hpk42/pytest/commits/ef5799b1bfe5/ Changeset: ef5799b1bfe5 User: hpk42 Date: 2013-11-02 07:02:28 Summary: Merged in jameslan/pytest/multi-marks (pull request #79) Support multiple marks for individual parametrized argument set Affected #: 2 files diff -r 8e65b5b17d12942193881ddcb9a244bc470a6fff -r ef5799b1bfe5f7d15224e7471a0ab02a92c8c351 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -693,16 +693,17 @@ to set a dynamic scope using test context or configuration. """ - # individual parametrized argument sets can be wrapped in a - # marker in which case we unwrap the values and apply the mark + # individual parametrized argument sets can be wrapped in a series + # of markers in which case we unwrap the values and apply the mark # at Function init newkeywords = {} unwrapped_argvalues = [] for i, argval in enumerate(argvalues): - if isinstance(argval, MarkDecorator): + while isinstance(argval, MarkDecorator): newmark = MarkDecorator(argval.markname, argval.args[:-1], argval.kwargs) - newkeywords[i] = {newmark.markname: newmark} + newmarks = newkeywords.setdefault(i, {}) + newmarks[newmark.markname] = newmark argval = argval.args[-1] unwrapped_argvalues.append(argval) argvalues = unwrapped_argvalues diff -r 8e65b5b17d12942193881ddcb9a244bc470a6fff -r ef5799b1bfe5f7d15224e7471a0ab02a92c8c351 testing/python/collect.py --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -355,6 +355,21 @@ rec = testdir.inline_run() rec.assertoutcome(passed=2) + def test_parametrize_with_mark(selfself, testdir): + items = testdir.getitems(""" + import pytest + @pytest.mark.foo + @pytest.mark.parametrize('arg', [ + 1, + pytest.mark.bar(pytest.mark.baz(2)) + ]) + def test_function(arg): + pass + """) + keywords = [item.keywords for item in items] + assert 'foo' in keywords[0] and 'bar' not in keywords[0] and 'baz' not in keywords[0] + assert 'foo' in keywords[1] and 'bar' in keywords[1] and 'baz' in keywords[1] + def test_function_equality_with_callspec(self, testdir, tmpdir): items = testdir.getitems(""" 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 Sat Nov 2 07:04:39 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Sat, 02 Nov 2013 06:04:39 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131102060439.10493.9115@app05.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/9909daf848ee/ Changeset: 9909daf848ee User: hpk42 Date: 2013-10-25 16:50:05 Summary: add german pytest talk (pyconde2013) Affected #: 1 file diff -r 8e65b5b17d12942193881ddcb9a244bc470a6fff -r 9909daf848eef27f575020ecc92e4250c3061f54 doc/en/talks.txt --- a/doc/en/talks.txt +++ b/doc/en/talks.txt @@ -10,7 +10,10 @@ .. _`tutorial1 repository`: http://bitbucket.org/hpk42/pytest-tutorial1/ .. _`pycon 2010 tutorial PDF`: http://bitbucket.org/hpk42/pytest-tutorial1/raw/tip/pytest-basic.pdf -Basic usage and funcargs: +Basic usage and fixtures: + +- `pytest feature and release highlights (GERMAN, October 2013) + `_ - `pytest introduction from Brian Okken (January 2013) `_ https://bitbucket.org/hpk42/pytest/commits/257206079bab/ Changeset: 257206079bab User: hpk42 Date: 2013-11-02 07:04:26 Summary: merge, add changelog entry Affected #: 3 files diff -r 9909daf848eef27f575020ecc92e4250c3061f54 -r 257206079babf818a2819a44f5cf30c64d572287 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ -Changes between 2.4.2 and 2.4.3 +Unreleased ----------------------------------- +- allow nested parametrize-value markers, thanks James Lan for the PR. + - fix unicode handling with new monkeypatch.setattr(import_path, value) API. Thanks Rob Dennis. Fixes issue371. @@ -30,6 +32,7 @@ arg is an lambda and thus the example will work. Thanks Alex Gaynor for bringing it up. + Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r 9909daf848eef27f575020ecc92e4250c3061f54 -r 257206079babf818a2819a44f5cf30c64d572287 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -693,16 +693,17 @@ to set a dynamic scope using test context or configuration. """ - # individual parametrized argument sets can be wrapped in a - # marker in which case we unwrap the values and apply the mark + # individual parametrized argument sets can be wrapped in a series + # of markers in which case we unwrap the values and apply the mark # at Function init newkeywords = {} unwrapped_argvalues = [] for i, argval in enumerate(argvalues): - if isinstance(argval, MarkDecorator): + while isinstance(argval, MarkDecorator): newmark = MarkDecorator(argval.markname, argval.args[:-1], argval.kwargs) - newkeywords[i] = {newmark.markname: newmark} + newmarks = newkeywords.setdefault(i, {}) + newmarks[newmark.markname] = newmark argval = argval.args[-1] unwrapped_argvalues.append(argval) argvalues = unwrapped_argvalues diff -r 9909daf848eef27f575020ecc92e4250c3061f54 -r 257206079babf818a2819a44f5cf30c64d572287 testing/python/collect.py --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -355,6 +355,21 @@ rec = testdir.inline_run() rec.assertoutcome(passed=2) + def test_parametrize_with_mark(selfself, testdir): + items = testdir.getitems(""" + import pytest + @pytest.mark.foo + @pytest.mark.parametrize('arg', [ + 1, + pytest.mark.bar(pytest.mark.baz(2)) + ]) + def test_function(arg): + pass + """) + keywords = [item.keywords for item in items] + assert 'foo' in keywords[0] and 'bar' not in keywords[0] and 'baz' not in keywords[0] + assert 'foo' in keywords[1] and 'bar' in keywords[1] and 'baz' in keywords[1] + def test_function_equality_with_callspec(self, testdir, tmpdir): items = testdir.getitems(""" 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 issues-reply at bitbucket.org Sat Nov 9 06:06:31 2013 From: issues-reply at bitbucket.org (Lex Hider) Date: Sat, 09 Nov 2013 05:06:31 -0000 Subject: [Pytest-commit] Issue #135: detox doesn't support skipdist config option (hpk42/tox) Message-ID: <20131109050631.2122.28743@app06.ash-private.bitbucket.org> New issue 135: detox doesn't support skipdist config option https://bitbucket.org/hpk42/tox/issue/135/detox-doesnt-support-skipdist-config Lex Hider: detox doesn't support skipdist option. It complains that setup.py is missing. So running test with tox works fine, but running detox fails due to missing setup.oy From issues-reply at bitbucket.org Mon Nov 11 12:50:10 2013 From: issues-reply at bitbucket.org (Matthias Bach) Date: Mon, 11 Nov 2013 11:50:10 -0000 Subject: [Pytest-commit] Issue #136: Documentation refers to [tox:hudson] instead of [tox:jenkins] (hpk42/tox) Message-ID: <20131111115010.8590.98557@app13.ash-private.bitbucket.org> New issue 136: Documentation refers to [tox:hudson] instead of [tox:jenkins] https://bitbucket.org/hpk42/tox/issue/136/documentation-refers-to-tox-hudson-instead Matthias Bach: At version 1.6.1, the [configuration documentation](http://testrun.org/tox/latest/config.htm) still refers to the section `[tox:hudson]` to specify Jenkins specific configuration data. However, as it can be seen in the [changelog](http://testrun.org/tox/latest/changelog.html), this section has been renamed to `[tox:jenkins]` in version 1.0. Thus, using `[tox:hudson]` doesn't work. From commits-noreply at bitbucket.org Tue Nov 12 10:27:47 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 12 Nov 2013 09:27:47 -0000 Subject: [Pytest-commit] commit/tox: hpk42: fix issue132: removing zip_safe setting (so it defaults to false) Message-ID: <20131112092747.25050.13441@app13.ash-private.bitbucket.org> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/72ba41dbebee/ Changeset: 72ba41dbebee User: hpk42 Date: 2013-11-12 10:27:42 Summary: fix issue132: removing zip_safe setting (so it defaults to false) to allow installation of tox via easy_install/eggs. Thanks Jenisys. Affected #: 2 files diff -r 7a16cd37007c630dff269878a542c16bbaf6cf68 -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ 1.6.2.dev --------- +- fix issue132: removing zip_safe setting (so it defaults to false) + to allow installation of tox + via easy_install/eggs. Thanks Jenisys. + - fix issue126: depend on virtualenv>=1.10.1 so that we can rely (hopefully) on a pip version which supports --pre. (tox by default uses to --pre). Note that tox also vendors an older virtualenv diff -r 7a16cd37007c630dff269878a542c16bbaf6cf68 -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 setup.py --- a/setup.py +++ b/setup.py @@ -40,7 +40,6 @@ tests_require=['tox'], cmdclass={"test": Tox}, install_requires=install_requires, - zip_safe=True, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', Repository URL: https://bitbucket.org/hpk42/tox/ -- 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 Nov 13 07:43:38 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 13 Nov 2013 06:43:38 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131113064338.3276.69756@app10.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/8349ef6ba227/ Changeset: 8349ef6ba227 Branch: python32-test-fix User: bubenkoff Date: 2013-11-12 13:48:17 Summary: support python32 Affected #: 1 file diff -r 257206079babf818a2819a44f5cf30c64d572287 -r 8349ef6ba227d9e478bc5e11a1467198d17efa32 testing/test_monkeypatch.py --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -46,10 +46,10 @@ assert _pytest.config.Config == 42 def test_unicode_string(self, monkeypatch): - monkeypatch.setattr(u"_pytest.config.Config", 42) + monkeypatch.setattr("_pytest.config.Config", 42) import _pytest assert _pytest.config.Config == 42 - monkeypatch.delattr(u"_pytest.config.Config") + monkeypatch.delattr("_pytest.config.Config") def test_wrong_target(self, monkeypatch): pytest.raises(TypeError, lambda: monkeypatch.setattr(None, None)) https://bitbucket.org/hpk42/pytest/commits/8a2c31cbe904/ Changeset: 8a2c31cbe904 User: hpk42 Date: 2013-11-13 07:43:35 Summary: Merged in paylogic/pytest/python32-test-fix (pull request #82) support python32 fix Affected #: 1 file diff -r 257206079babf818a2819a44f5cf30c64d572287 -r 8a2c31cbe904a3ca26dce8653dbae2e0962c2e9c testing/test_monkeypatch.py --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -46,10 +46,10 @@ assert _pytest.config.Config == 42 def test_unicode_string(self, monkeypatch): - monkeypatch.setattr(u"_pytest.config.Config", 42) + monkeypatch.setattr("_pytest.config.Config", 42) import _pytest assert _pytest.config.Config == 42 - monkeypatch.delattr(u"_pytest.config.Config") + monkeypatch.delattr("_pytest.config.Config") def test_wrong_target(self, monkeypatch): pytest.raises(TypeError, lambda: monkeypatch.setattr(None, None)) 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 Nov 13 07:44:02 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 13 Nov 2013 06:44:02 -0000 Subject: [Pytest-commit] commit/pytest: 3 new changesets Message-ID: <20131113064402.23764.12045@app13.ash-private.bitbucket.org> 3 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/ff8010f92f73/ Changeset: ff8010f92f73 Branch: multi-level-fixture-deps-override User: bubenkoff Date: 2013-11-12 13:35:32 Summary: initial Affected #: 0 files https://bitbucket.org/hpk42/pytest/commits/809280e02a02/ Changeset: 809280e02a02 Branch: multi-level-fixture-deps-override User: bubenkoff Date: 2013-11-12 13:45:36 Summary: use deepest fixturedef for fixture closure Affected #: 2 files diff -r ff8010f92f73eb96ae8de39928c5ea228591981f -r 809280e02a0237f3710bc5560ecddec4033ef4f1 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1556,8 +1556,7 @@ fixturedefs = self.getfixturedefs(argname, parentid) arg2fixturedefs[argname] = fixturedefs if fixturedefs is not None: - for fixturedef in fixturedefs: - merge(fixturedef.argnames) + merge(fixturedefs[-1].argnames) return fixturenames_closure, arg2fixturedefs def pytest_generate_tests(self, metafunc): diff -r ff8010f92f73eb96ae8de39928c5ea228591981f -r 809280e02a0237f3710bc5560ecddec4033ef4f1 testing/test_conftest.py --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -215,3 +215,40 @@ conftest = Conftest() monkeypatch.setattr(conftest, 'importconftest', impct) assert conftest.getconftestmodules(sub) == [ct1, ct2] + + +def test_fixture_dependency(testdir, monkeypatch): + ct1 = testdir.makeconftest("") + ct1 = testdir.makepyfile("__init__.py") + ct1.write("") + sub = testdir.mkdir("sub") + sub.join("__init__.py").write("") + sub.join("conftest.py").write(py.std.textwrap.dedent(""" + import pytest + + @pytest.fixture + def not_needed(): + assert False, "Should not be called!" + + @pytest.fixture + def foo(): + assert False, "Should not be called!" + + @pytest.fixture + def bar(foo): + return 'bar' + """)) + subsub = sub.mkdir("subsub") + subsub.join("__init__.py").write("") + subsub.join("test_bar.py").write(py.std.textwrap.dedent(""" + import pytest + + @pytest.fixture + def bar(): + return 'sub bar' + + def test_event_fixture(bar): + assert bar == 'sub bar' + """)) + result = testdir.runpytest("sub") + result.stdout.fnmatch_lines(["*1 passed*"]) https://bitbucket.org/hpk42/pytest/commits/157241084b31/ Changeset: 157241084b31 User: hpk42 Date: 2013-11-13 07:43:59 Summary: Merged in paylogic/pytest/multi-level-fixture-deps-override (pull request #83) When overridden, fixture's dependencies are called from all levels of folder structure Affected #: 2 files diff -r 8a2c31cbe904a3ca26dce8653dbae2e0962c2e9c -r 157241084b314d9b1f69b92e0d51ca4b67d1cf0a _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1556,8 +1556,7 @@ fixturedefs = self.getfixturedefs(argname, parentid) arg2fixturedefs[argname] = fixturedefs if fixturedefs is not None: - for fixturedef in fixturedefs: - merge(fixturedef.argnames) + merge(fixturedefs[-1].argnames) return fixturenames_closure, arg2fixturedefs def pytest_generate_tests(self, metafunc): diff -r 8a2c31cbe904a3ca26dce8653dbae2e0962c2e9c -r 157241084b314d9b1f69b92e0d51ca4b67d1cf0a testing/test_conftest.py --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -215,3 +215,40 @@ conftest = Conftest() monkeypatch.setattr(conftest, 'importconftest', impct) assert conftest.getconftestmodules(sub) == [ct1, ct2] + + +def test_fixture_dependency(testdir, monkeypatch): + ct1 = testdir.makeconftest("") + ct1 = testdir.makepyfile("__init__.py") + ct1.write("") + sub = testdir.mkdir("sub") + sub.join("__init__.py").write("") + sub.join("conftest.py").write(py.std.textwrap.dedent(""" + import pytest + + @pytest.fixture + def not_needed(): + assert False, "Should not be called!" + + @pytest.fixture + def foo(): + assert False, "Should not be called!" + + @pytest.fixture + def bar(foo): + return 'bar' + """)) + subsub = sub.mkdir("subsub") + subsub.join("__init__.py").write("") + subsub.join("test_bar.py").write(py.std.textwrap.dedent(""" + import pytest + + @pytest.fixture + def bar(): + return 'sub bar' + + def test_event_fixture(bar): + assert bar == 'sub bar' + """)) + result = testdir.runpytest("sub") + result.stdout.fnmatch_lines(["*1 passed*"]) 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 Nov 13 07:44:26 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 13 Nov 2013 06:44:26 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131113064426.7117.73850@app05.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/f6c8dfaf05d6/ Changeset: f6c8dfaf05d6 Branch: ignore-autocomplete-on-darwin User: bubenkoff Date: 2013-11-12 13:52:16 Summary: ignore argcomplete on darwin Affected #: 1 file diff -r 257206079babf818a2819a44f5cf30c64d572287 -r f6c8dfaf05d655f4cd2948fdedcc86753d8e144a testing/test_argcomplete.py --- a/testing/test_argcomplete.py +++ b/testing/test_argcomplete.py @@ -72,7 +72,7 @@ # the following barfs with a syntax error on py2.5 # @pytest.mark.skipif("sys.version_info < (2,6)") class TestArgComplete: - @pytest.mark.skipif("sys.platform == 'win32'") + @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") @pytest.mark.skipif("sys.version_info < (2,6)") def test_compare_with_compgen(self): from _pytest._argcomplete import FastFilesCompleter @@ -81,7 +81,7 @@ for x in '/ /d /data qqq'.split(): assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout) - @pytest.mark.skipif("sys.platform == 'win32'") + @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") @pytest.mark.skipif("sys.version_info < (2,6)") def test_remove_dir_prefix(self): """this is not compatible with compgen but it is with bash itself: https://bitbucket.org/hpk42/pytest/commits/8ebe029cde4d/ Changeset: 8ebe029cde4d User: hpk42 Date: 2013-11-13 07:44:24 Summary: Merged in paylogic/pytest/ignore-autocomplete-on-darwin (pull request #84) ignore argcomplete on darwin Affected #: 1 file diff -r 157241084b314d9b1f69b92e0d51ca4b67d1cf0a -r 8ebe029cde4d67b822bbb8b4ffe1f896498e29e2 testing/test_argcomplete.py --- a/testing/test_argcomplete.py +++ b/testing/test_argcomplete.py @@ -72,7 +72,7 @@ # the following barfs with a syntax error on py2.5 # @pytest.mark.skipif("sys.version_info < (2,6)") class TestArgComplete: - @pytest.mark.skipif("sys.platform == 'win32'") + @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") @pytest.mark.skipif("sys.version_info < (2,6)") def test_compare_with_compgen(self): from _pytest._argcomplete import FastFilesCompleter @@ -81,7 +81,7 @@ for x in '/ /d /data qqq'.split(): assert equal_with_bash(x, ffc, fc, out=py.std.sys.stdout) - @pytest.mark.skipif("sys.platform == 'win32'") + @pytest.mark.skipif("sys.platform in ('win32', 'darwin')") @pytest.mark.skipif("sys.version_info < (2,6)") def test_remove_dir_prefix(self): """this is not compatible with compgen but it is with bash itself: 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 Nov 13 07:45:42 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 13 Nov 2013 06:45:42 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131113064542.16370.27314@app13.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/06d4c2c45cb1/ Changeset: 06d4c2c45cb1 Branch: plugins-index-status-images User: nicoddemus Date: 2013-11-13 02:54:13 Summary: Adding status images in plugins_index Affected #: 3 files diff -r 257206079babf818a2819a44f5cf30c64d572287 -r 06d4c2c45cb1950f71e9808332c45da467ace817 doc/en/plugins_index/plugins_index.py --- a/doc/en/plugins_index/plugins_index.py +++ b/doc/en/plugins_index/plugins_index.py @@ -13,6 +13,7 @@ import sys import xmlrpclib +import pytest #=================================================================================================== # iter_plugins @@ -58,18 +59,23 @@ ''' rows = [] ColumnData = namedtuple('ColumnData', 'text link') - headers = ['Name', 'Author', 'Downloads', 'Summary'] - + headers = ['Name', 'Author', 'Downloads', 'Python 2.7', 'Python 3.3', 'Summary'] + pytest_version = pytest.__version__ plugins = list(plugins) for index, (package_name, version) in enumerate(plugins): print package_name, version, '...', release_data = client.release_data(package_name, version) download_count = release_data['downloads']['last_month'] + image_url = '.. image:: http://pytest-plugs.herokuapp.com/status/{name}-{version}'.format(name=package_name, + version=version) + image_url += '?py={py}&pytest={pytest}' row = ( ColumnData(package_name + '-' + version, release_data['release_url']), ColumnData(release_data['author'], release_data['author_email']), ColumnData(str(download_count), None), + ColumnData(image_url.format(py='py27', pytest=pytest_version), None), + ColumnData(image_url.format(py='py33', pytest=pytest_version), None), ColumnData(release_data['summary'], None), ) assert len(row) == len(headers) diff -r 257206079babf818a2819a44f5cf30c64d572287 -r 06d4c2c45cb1950f71e9808332c45da467ace817 doc/en/plugins_index/plugins_index.txt --- a/doc/en/plugins_index/plugins_index.txt +++ b/doc/en/plugins_index/plugins_index.txt @@ -3,61 +3,62 @@ List of Third-Party Plugins =========================== -========================================================================================== ==================================================================================== ========= ============================================================================================================================================= - Name Author Downloads Summary -========================================================================================== ==================================================================================== ========= ============================================================================================================================================= - `pytest-bdd-0.6.1 `_ `Oleg Pidsadnyi `_ 1377 BDD for pytest - `pytest-bdd-splinter-0.5.2 `_ `Oleg Pidsadnyi `_ 1262 Splinter subplugin for Pytest BDD plugin - `pytest-bench-0.1.0 `_ `Concordus Applications `_ 115 Benchmark utility that plugs into pytest. - `pytest-blockage-0.1 `_ `UNKNOWN `_ 115 Disable network requests during a test run. - `pytest-browsermob-proxy-0.1 `_ `Dave Hunt `_ 61 BrowserMob proxy plugin for py.test. - `pytest-bugzilla-0.2 `_ `Noufal Ibrahim `_ 102 py.test bugzilla integration plugin - `pytest-cache-1.0 `_ `Holger Krekel `_ 3684 pytest plugin with mechanisms for caching across test runs - `pytest-capturelog-0.7 `_ `Meme Dough `_ 1349 py.test plugin to capture log messages - `pytest-codecheckers-0.2 `_ `Ronny Pfannschmidt `_ 212 pytest plugin to add source code sanity checks (pep8 and friends) - `pytest-contextfixture-0.1.1 `_ `Andreas Pelme `_ 105 Define pytest fixtures as context managers. - `pytest-couchdbkit-0.5.1 `_ `RonnyPfannschmidt `_ 276 py.test extension for per-test couchdb databases using couchdbkit - `pytest-cov-1.6 `_ `Meme Dough `_ 18720 py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing - `pytest-dbfixtures-0.3.8.3 `_ `Clearcode - The A Room `_ 3699 dbfixtures plugin for py.test. - `pytest-django-2.3.1 `_ `Andreas Pelme `_ 3934 A Django plugin for py.test. - `pytest-django-lite-0.1.0 `_ `David Cramer `_ 705 The bare minimum to integrate py.test with Django. - `pytest-figleaf-1.0 `_ `holger krekel `_ 59 py.test figleaf coverage plugin - `pytest-flakes-0.2 `_ `Florian Schulze, Holger Krekel and Ronny Pfannschmidt `_ 465 pytest plugin to check source code with pyflakes - `pytest-greendots-0.2 `_ `UNKNOWN `_ 367 Green progress dots - `pytest-growl-0.1 `_ `Anthony Long `_ 68 Growl notifications for pytest results. - `pytest-incremental-0.3.0 `_ `Eduardo Naufel Schettino `_ 240 an incremental test runner (pytest plugin) - `pytest-instafail-0.1.0 `_ `Janne Vanhala `_ 186 py.test plugin to show failures instantly - `pytest-ipdb-0.1-prerelease `_ `Matthew de Verteuil `_ 90 A py.test plug-in to enable drop to ipdb debugger on test failure. - `pytest-konira-0.2 `_ `Alfredo Deza `_ 103 Run Konira DSL tests with py.test - `pytest-localserver-0.3 `_ `Sebastian Rahlf `_ 361 py.test plugin to test server connections locally. - `pytest-marker-bugzilla-0.06 `_ `Eric Sammons `_ 229 py.test bugzilla integration plugin, using markers - `pytest-markfiltration-0.8 `_ `adam goucher `_ 308 UNKNOWN - `pytest-marks-0.4 `_ `adam goucher `_ 240 UNKNOWN - `pytest-monkeyplus-1.1.0 `_ `Virgil Dupras `_ 109 pytest's monkeypatch subclass with extra functionalities - `pytest-mozwebqa-1.1.1 `_ `Dave Hunt `_ 907 Mozilla WebQA plugin for py.test. - `pytest-oerp-0.2.0 `_ `Leonardo Santagada `_ 183 pytest plugin to test OpenERP modules - `pytest-osxnotify-0.1.4 `_ `Daniel Bader `_ 281 OS X notifications for py.test results. - `pytest-paste-config-0.1 `_ `UNKNOWN `_ 391 Allow setting the path to a paste config file - `pytest-pep8-1.0.5 `_ `Holger Krekel and Ronny Pfannschmidt `_ 4195 pytest plugin to check PEP8 requirements - `pytest-poo-0.2 `_ `Andreas Pelme `_ 121 Visualize your crappy tests - `pytest-pydev-0.1 `_ `Sebastian Rahlf `_ 72 py.test plugin to connect to a remote debug server with PyDev or PyCharm. - `pytest-qt-1.0.2 `_ `Bruno Oliveira `_ 198 pytest plugin that adds fixtures for testing Qt (PyQt and PySide) applications. - `pytest-quickcheck-0.7 `_ `Tetsuya Morimoto `_ 188 pytest plugin to generate random data inspired by QuickCheck - `pytest-rage-0.1 `_ `Leonardo Santagada `_ 52 pytest plugin to implement PEP712 - `pytest-random-0.02 `_ `Leah Klearman `_ 117 py.test plugin to randomize tests - `pytest-rerunfailures-0.03 `_ `Leah Klearman `_ 62 py.test plugin to re-run tests to eliminate flakey failures - `pytest-runfailed-0.3 `_ `Dimitri Merejkowsky `_ 102 implement a --failed option for pytest - `pytest-runner-2.0 `_ `Jason R. Coombs `_ 7313 UNKNOWN - `pytest-sugar-0.2.2 `_ `Teemu, Janne Vanhala `_ 532 py.test plugin that adds instafail, ETA and neat graphics - `pytest-timeout-0.3 `_ `Floris Bruynooghe `_ 5309 pytest plugin to abort tests after a timeout - `pytest-twisted-1.4 `_ `Ralf Schmitt `_ 516 A twisted plugin for py.test. - `pytest-xdist-1.9 `_ `holger krekel and contributors `_ 8289 py.test xdist plugin for distributed testing and loop-on-failing modes - `pytest-xprocess-0.8 `_ `Holger Krekel `_ 212 pytest plugin to manage external processes across test runs - `pytest-yamlwsgi-0.6 `_ `Ali Afshar `_ 271 Run tests against wsgi apps defined in yaml - `pytest-zap-0.1 `_ `Dave Hunt `_ 57 OWASP ZAP plugin for py.test. +========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= + Name Author Downloads Python 2.7 Python 3.3 Summary +========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= + `pytest-bdd-0.6.4 `_ `Oleg Pidsadnyi `_ 1156 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.4?py=py33&pytest=2.4.2 BDD for pytest + `pytest-bdd-splinter-0.5.2 `_ `Oleg Pidsadnyi `_ 540 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.2?py=py33&pytest=2.4.2 Splinter subplugin for Pytest BDD plugin + `pytest-bench-0.2.5 `_ `Concordus Applications `_ 826 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py33&pytest=2.4.2 Benchmark utility that plugs into pytest. + `pytest-blockage-0.1 `_ `UNKNOWN `_ 121 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py33&pytest=2.4.2 Disable network requests during a test run. + `pytest-browsermob-proxy-0.1 `_ `Dave Hunt `_ 72 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py33&pytest=2.4.2 BrowserMob proxy plugin for py.test. + `pytest-bugzilla-0.2 `_ `Noufal Ibrahim `_ 115 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py33&pytest=2.4.2 py.test bugzilla integration plugin + `pytest-cache-1.0 `_ `Holger Krekel `_ 5191 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py33&pytest=2.4.2 pytest plugin with mechanisms for caching across test runs + `pytest-capturelog-0.7 `_ `Meme Dough `_ 1788 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py33&pytest=2.4.2 py.test plugin to capture log messages + `pytest-codecheckers-0.2 `_ `Ronny Pfannschmidt `_ 235 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py33&pytest=2.4.2 pytest plugin to add source code sanity checks (pep8 and friends) + `pytest-contextfixture-0.1.1 `_ `Andreas Pelme `_ 106 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py33&pytest=2.4.2 Define pytest fixtures as context managers. + `pytest-couchdbkit-0.5.1 `_ `RonnyPfannschmidt `_ 187 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py33&pytest=2.4.2 py.test extension for per-test couchdb databases using couchdbkit + `pytest-cov-1.6 `_ `Meme Dough `_ 21817 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py33&pytest=2.4.2 py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing + `pytest-dbfixtures-0.3.8.8 `_ `Clearcode - The A Room `_ 2090 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.3.8.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.3.8.8?py=py33&pytest=2.4.2 dbfixtures plugin for py.test. + `pytest-django-2.4 `_ `Andreas Pelme `_ 4461 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py33&pytest=2.4.2 A Django plugin for py.test. + `pytest-django-lite-0.1.0 `_ `David Cramer `_ 820 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py33&pytest=2.4.2 The bare minimum to integrate py.test with Django. + `pytest-figleaf-1.0 `_ `holger krekel `_ 69 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py33&pytest=2.4.2 py.test figleaf coverage plugin + `pytest-flakes-0.2 `_ `Florian Schulze, Holger Krekel and Ronny Pfannschmidt `_ 1002 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py33&pytest=2.4.2 pytest plugin to check source code with pyflakes + `pytest-greendots-0.2 `_ `UNKNOWN `_ 163 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py33&pytest=2.4.2 Green progress dots + `pytest-growl-0.1 `_ `Anthony Long `_ 87 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py33&pytest=2.4.2 Growl notifications for pytest results. + `pytest-incremental-0.3.0 `_ `Eduardo Naufel Schettino `_ 219 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py33&pytest=2.4.2 an incremental test runner (pytest plugin) + `pytest-instafail-0.1.1 `_ `Janne Vanhala `_ 313 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py33&pytest=2.4.2 py.test plugin to show failures instantly + `pytest-ipdb-0.1-prerelease `_ `Matthew de Verteuil `_ 72 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py33&pytest=2.4.2 A py.test plug-in to enable drop to ipdb debugger on test failure. + `pytest-jira-0.01 `_ `James Laska `_ 269 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py33&pytest=2.4.2 py.test JIRA integration plugin, using markers + `pytest-konira-0.2 `_ `Alfredo Deza `_ 95 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py33&pytest=2.4.2 Run Konira DSL tests with py.test + `pytest-localserver-0.3.2 `_ `Sebastian Rahlf `_ 625 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py33&pytest=2.4.2 py.test plugin to test server connections locally. + `pytest-marker-bugzilla-0.06 `_ `Eric Sammons `_ 166 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py33&pytest=2.4.2 py.test bugzilla integration plugin, using markers + `pytest-markfiltration-0.8 `_ `adam goucher `_ 222 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py33&pytest=2.4.2 UNKNOWN + `pytest-marks-0.4 `_ `adam goucher `_ 201 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py33&pytest=2.4.2 UNKNOWN + `pytest-monkeyplus-1.1.0 `_ `Virgil Dupras `_ 110 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py33&pytest=2.4.2 pytest's monkeypatch subclass with extra functionalities + `pytest-mozwebqa-1.1.1 `_ `Dave Hunt `_ 621 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py33&pytest=2.4.2 Mozilla WebQA plugin for py.test. + `pytest-oerp-0.2.0 `_ `Leonardo Santagada `_ 147 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py33&pytest=2.4.2 pytest plugin to test OpenERP modules + `pytest-osxnotify-0.1.4 `_ `Daniel Bader `_ 202 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py33&pytest=2.4.2 OS X notifications for py.test results. + `pytest-paste-config-0.1 `_ `UNKNOWN `_ 123 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py33&pytest=2.4.2 Allow setting the path to a paste config file + `pytest-pep8-1.0.5 `_ `Holger Krekel and Ronny Pfannschmidt `_ 5096 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py33&pytest=2.4.2 pytest plugin to check PEP8 requirements + `pytest-poo-0.2 `_ `Andreas Pelme `_ 93 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py33&pytest=2.4.2 Visualize your crappy tests + `pytest-pydev-0.1 `_ `Sebastian Rahlf `_ 96 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py33&pytest=2.4.2 py.test plugin to connect to a remote debug server with PyDev or PyCharm. + `pytest-qt-1.0.2 `_ `Bruno Oliveira `_ 152 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py33&pytest=2.4.2 pytest plugin that adds fixtures for testing Qt (PyQt and PySide) applications. + `pytest-quickcheck-0.7 `_ `Tetsuya Morimoto `_ 182 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.7?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.7?py=py33&pytest=2.4.2 pytest plugin to generate random data inspired by QuickCheck + `pytest-rage-0.1 `_ `Leonardo Santagada `_ 67 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py33&pytest=2.4.2 pytest plugin to implement PEP712 + `pytest-random-0.02 `_ `Leah Klearman `_ 111 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py33&pytest=2.4.2 py.test plugin to randomize tests + `pytest-rerunfailures-0.03 `_ `Leah Klearman `_ 79 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py33&pytest=2.4.2 py.test plugin to re-run tests to eliminate flakey failures + `pytest-runfailed-0.3 `_ `Dimitri Merejkowsky `_ 95 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py33&pytest=2.4.2 implement a --failed option for pytest + `pytest-runner-2.0 `_ `Jason R. Coombs `_ 7458 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py33&pytest=2.4.2 UNKNOWN + `pytest-sugar-0.2.2 `_ `Teemu, Janne Vanhala `_ 323 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py33&pytest=2.4.2 py.test plugin that adds instafail, ETA and neat graphics + `pytest-timeout-0.3 `_ `Floris Bruynooghe `_ 3689 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py33&pytest=2.4.2 pytest plugin to abort tests after a timeout + `pytest-twisted-1.4 `_ `Ralf Schmitt `_ 504 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py33&pytest=2.4.2 A twisted plugin for py.test. + `pytest-xdist-1.9 `_ `holger krekel and contributors `_ 7287 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py33&pytest=2.4.2 py.test xdist plugin for distributed testing and loop-on-failing modes + `pytest-xprocess-0.8 `_ `Holger Krekel `_ 118 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py33&pytest=2.4.2 pytest plugin to manage external processes across test runs + `pytest-yamlwsgi-0.6 `_ `Ali Afshar `_ 187 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py33&pytest=2.4.2 Run tests against wsgi apps defined in yaml + `pytest-zap-0.1 `_ `Dave Hunt `_ 71 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py33&pytest=2.4.2 OWASP ZAP plugin for py.test. -========================================================================================== ==================================================================================== ========= ============================================================================================================================================= +========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= *(Downloads are given from last month only)* -*(Updated on 2013-10-14)* +*(Updated on 2013-11-12)* diff -r 257206079babf818a2819a44f5cf30c64d572287 -r 06d4c2c45cb1950f71e9808332c45da467ace817 doc/en/plugins_index/test_plugins_index.py --- a/doc/en/plugins_index/test_plugins_index.py +++ b/doc/en/plugins_index/test_plugins_index.py @@ -80,13 +80,13 @@ List of Third-Party Plugins =========================== -============================================ ============================= ========= =================== - Name Author Downloads Summary -============================================ ============================= ========= =================== - `pytest-plugin1-1.0 `_ `someone `_ 4 some plugin - `pytest-plugin2-1.2 `_ `other `_ 40 some other plugin +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + Name Author Downloads Python 2.7 Python 3.3 Summary +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + `pytest-plugin1-1.0 `_ `someone `_ 4 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py33&pytest=2.4.2 some plugin + `pytest-plugin2-1.2 `_ `other `_ 40 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py33&pytest=2.4.2 some other plugin -============================================ ============================= ========= =================== +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== *(Downloads are given from last month only)* @@ -98,4 +98,4 @@ # main #=================================================================================================== if __name__ == '__main__': - pytest.main() \ No newline at end of file + pytest.main() https://bitbucket.org/hpk42/pytest/commits/5d9ad221c1be/ Changeset: 5d9ad221c1be User: hpk42 Date: 2013-11-13 07:45:40 Summary: Merged in nicoddemus/pytest/plugins-index-status-images (pull request #85) Adding status images in plugins_index Affected #: 3 files diff -r 8ebe029cde4d67b822bbb8b4ffe1f896498e29e2 -r 5d9ad221c1bef740a566bc9bc34055347a60b9dc doc/en/plugins_index/plugins_index.py --- a/doc/en/plugins_index/plugins_index.py +++ b/doc/en/plugins_index/plugins_index.py @@ -13,6 +13,7 @@ import sys import xmlrpclib +import pytest #=================================================================================================== # iter_plugins @@ -58,18 +59,23 @@ ''' rows = [] ColumnData = namedtuple('ColumnData', 'text link') - headers = ['Name', 'Author', 'Downloads', 'Summary'] - + headers = ['Name', 'Author', 'Downloads', 'Python 2.7', 'Python 3.3', 'Summary'] + pytest_version = pytest.__version__ plugins = list(plugins) for index, (package_name, version) in enumerate(plugins): print package_name, version, '...', release_data = client.release_data(package_name, version) download_count = release_data['downloads']['last_month'] + image_url = '.. image:: http://pytest-plugs.herokuapp.com/status/{name}-{version}'.format(name=package_name, + version=version) + image_url += '?py={py}&pytest={pytest}' row = ( ColumnData(package_name + '-' + version, release_data['release_url']), ColumnData(release_data['author'], release_data['author_email']), ColumnData(str(download_count), None), + ColumnData(image_url.format(py='py27', pytest=pytest_version), None), + ColumnData(image_url.format(py='py33', pytest=pytest_version), None), ColumnData(release_data['summary'], None), ) assert len(row) == len(headers) diff -r 8ebe029cde4d67b822bbb8b4ffe1f896498e29e2 -r 5d9ad221c1bef740a566bc9bc34055347a60b9dc doc/en/plugins_index/plugins_index.txt --- a/doc/en/plugins_index/plugins_index.txt +++ b/doc/en/plugins_index/plugins_index.txt @@ -3,61 +3,62 @@ List of Third-Party Plugins =========================== -========================================================================================== ==================================================================================== ========= ============================================================================================================================================= - Name Author Downloads Summary -========================================================================================== ==================================================================================== ========= ============================================================================================================================================= - `pytest-bdd-0.6.1 `_ `Oleg Pidsadnyi `_ 1377 BDD for pytest - `pytest-bdd-splinter-0.5.2 `_ `Oleg Pidsadnyi `_ 1262 Splinter subplugin for Pytest BDD plugin - `pytest-bench-0.1.0 `_ `Concordus Applications `_ 115 Benchmark utility that plugs into pytest. - `pytest-blockage-0.1 `_ `UNKNOWN `_ 115 Disable network requests during a test run. - `pytest-browsermob-proxy-0.1 `_ `Dave Hunt `_ 61 BrowserMob proxy plugin for py.test. - `pytest-bugzilla-0.2 `_ `Noufal Ibrahim `_ 102 py.test bugzilla integration plugin - `pytest-cache-1.0 `_ `Holger Krekel `_ 3684 pytest plugin with mechanisms for caching across test runs - `pytest-capturelog-0.7 `_ `Meme Dough `_ 1349 py.test plugin to capture log messages - `pytest-codecheckers-0.2 `_ `Ronny Pfannschmidt `_ 212 pytest plugin to add source code sanity checks (pep8 and friends) - `pytest-contextfixture-0.1.1 `_ `Andreas Pelme `_ 105 Define pytest fixtures as context managers. - `pytest-couchdbkit-0.5.1 `_ `RonnyPfannschmidt `_ 276 py.test extension for per-test couchdb databases using couchdbkit - `pytest-cov-1.6 `_ `Meme Dough `_ 18720 py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing - `pytest-dbfixtures-0.3.8.3 `_ `Clearcode - The A Room `_ 3699 dbfixtures plugin for py.test. - `pytest-django-2.3.1 `_ `Andreas Pelme `_ 3934 A Django plugin for py.test. - `pytest-django-lite-0.1.0 `_ `David Cramer `_ 705 The bare minimum to integrate py.test with Django. - `pytest-figleaf-1.0 `_ `holger krekel `_ 59 py.test figleaf coverage plugin - `pytest-flakes-0.2 `_ `Florian Schulze, Holger Krekel and Ronny Pfannschmidt `_ 465 pytest plugin to check source code with pyflakes - `pytest-greendots-0.2 `_ `UNKNOWN `_ 367 Green progress dots - `pytest-growl-0.1 `_ `Anthony Long `_ 68 Growl notifications for pytest results. - `pytest-incremental-0.3.0 `_ `Eduardo Naufel Schettino `_ 240 an incremental test runner (pytest plugin) - `pytest-instafail-0.1.0 `_ `Janne Vanhala `_ 186 py.test plugin to show failures instantly - `pytest-ipdb-0.1-prerelease `_ `Matthew de Verteuil `_ 90 A py.test plug-in to enable drop to ipdb debugger on test failure. - `pytest-konira-0.2 `_ `Alfredo Deza `_ 103 Run Konira DSL tests with py.test - `pytest-localserver-0.3 `_ `Sebastian Rahlf `_ 361 py.test plugin to test server connections locally. - `pytest-marker-bugzilla-0.06 `_ `Eric Sammons `_ 229 py.test bugzilla integration plugin, using markers - `pytest-markfiltration-0.8 `_ `adam goucher `_ 308 UNKNOWN - `pytest-marks-0.4 `_ `adam goucher `_ 240 UNKNOWN - `pytest-monkeyplus-1.1.0 `_ `Virgil Dupras `_ 109 pytest's monkeypatch subclass with extra functionalities - `pytest-mozwebqa-1.1.1 `_ `Dave Hunt `_ 907 Mozilla WebQA plugin for py.test. - `pytest-oerp-0.2.0 `_ `Leonardo Santagada `_ 183 pytest plugin to test OpenERP modules - `pytest-osxnotify-0.1.4 `_ `Daniel Bader `_ 281 OS X notifications for py.test results. - `pytest-paste-config-0.1 `_ `UNKNOWN `_ 391 Allow setting the path to a paste config file - `pytest-pep8-1.0.5 `_ `Holger Krekel and Ronny Pfannschmidt `_ 4195 pytest plugin to check PEP8 requirements - `pytest-poo-0.2 `_ `Andreas Pelme `_ 121 Visualize your crappy tests - `pytest-pydev-0.1 `_ `Sebastian Rahlf `_ 72 py.test plugin to connect to a remote debug server with PyDev or PyCharm. - `pytest-qt-1.0.2 `_ `Bruno Oliveira `_ 198 pytest plugin that adds fixtures for testing Qt (PyQt and PySide) applications. - `pytest-quickcheck-0.7 `_ `Tetsuya Morimoto `_ 188 pytest plugin to generate random data inspired by QuickCheck - `pytest-rage-0.1 `_ `Leonardo Santagada `_ 52 pytest plugin to implement PEP712 - `pytest-random-0.02 `_ `Leah Klearman `_ 117 py.test plugin to randomize tests - `pytest-rerunfailures-0.03 `_ `Leah Klearman `_ 62 py.test plugin to re-run tests to eliminate flakey failures - `pytest-runfailed-0.3 `_ `Dimitri Merejkowsky `_ 102 implement a --failed option for pytest - `pytest-runner-2.0 `_ `Jason R. Coombs `_ 7313 UNKNOWN - `pytest-sugar-0.2.2 `_ `Teemu, Janne Vanhala `_ 532 py.test plugin that adds instafail, ETA and neat graphics - `pytest-timeout-0.3 `_ `Floris Bruynooghe `_ 5309 pytest plugin to abort tests after a timeout - `pytest-twisted-1.4 `_ `Ralf Schmitt `_ 516 A twisted plugin for py.test. - `pytest-xdist-1.9 `_ `holger krekel and contributors `_ 8289 py.test xdist plugin for distributed testing and loop-on-failing modes - `pytest-xprocess-0.8 `_ `Holger Krekel `_ 212 pytest plugin to manage external processes across test runs - `pytest-yamlwsgi-0.6 `_ `Ali Afshar `_ 271 Run tests against wsgi apps defined in yaml - `pytest-zap-0.1 `_ `Dave Hunt `_ 57 OWASP ZAP plugin for py.test. +========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= + Name Author Downloads Python 2.7 Python 3.3 Summary +========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= + `pytest-bdd-0.6.4 `_ `Oleg Pidsadnyi `_ 1156 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-0.6.4?py=py33&pytest=2.4.2 BDD for pytest + `pytest-bdd-splinter-0.5.2 `_ `Oleg Pidsadnyi `_ 540 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bdd-splinter-0.5.2?py=py33&pytest=2.4.2 Splinter subplugin for Pytest BDD plugin + `pytest-bench-0.2.5 `_ `Concordus Applications `_ 826 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bench-0.2.5?py=py33&pytest=2.4.2 Benchmark utility that plugs into pytest. + `pytest-blockage-0.1 `_ `UNKNOWN `_ 121 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-blockage-0.1?py=py33&pytest=2.4.2 Disable network requests during a test run. + `pytest-browsermob-proxy-0.1 `_ `Dave Hunt `_ 72 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-browsermob-proxy-0.1?py=py33&pytest=2.4.2 BrowserMob proxy plugin for py.test. + `pytest-bugzilla-0.2 `_ `Noufal Ibrahim `_ 115 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-bugzilla-0.2?py=py33&pytest=2.4.2 py.test bugzilla integration plugin + `pytest-cache-1.0 `_ `Holger Krekel `_ 5191 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cache-1.0?py=py33&pytest=2.4.2 pytest plugin with mechanisms for caching across test runs + `pytest-capturelog-0.7 `_ `Meme Dough `_ 1788 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-capturelog-0.7?py=py33&pytest=2.4.2 py.test plugin to capture log messages + `pytest-codecheckers-0.2 `_ `Ronny Pfannschmidt `_ 235 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-codecheckers-0.2?py=py33&pytest=2.4.2 pytest plugin to add source code sanity checks (pep8 and friends) + `pytest-contextfixture-0.1.1 `_ `Andreas Pelme `_ 106 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-contextfixture-0.1.1?py=py33&pytest=2.4.2 Define pytest fixtures as context managers. + `pytest-couchdbkit-0.5.1 `_ `RonnyPfannschmidt `_ 187 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-couchdbkit-0.5.1?py=py33&pytest=2.4.2 py.test extension for per-test couchdb databases using couchdbkit + `pytest-cov-1.6 `_ `Meme Dough `_ 21817 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-cov-1.6?py=py33&pytest=2.4.2 py.test plugin for coverage reporting with support for both centralised and distributed testing, including subprocesses and multiprocessing + `pytest-dbfixtures-0.3.8.8 `_ `Clearcode - The A Room `_ 2090 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.3.8.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-dbfixtures-0.3.8.8?py=py33&pytest=2.4.2 dbfixtures plugin for py.test. + `pytest-django-2.4 `_ `Andreas Pelme `_ 4461 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-2.4?py=py33&pytest=2.4.2 A Django plugin for py.test. + `pytest-django-lite-0.1.0 `_ `David Cramer `_ 820 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-django-lite-0.1.0?py=py33&pytest=2.4.2 The bare minimum to integrate py.test with Django. + `pytest-figleaf-1.0 `_ `holger krekel `_ 69 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-figleaf-1.0?py=py33&pytest=2.4.2 py.test figleaf coverage plugin + `pytest-flakes-0.2 `_ `Florian Schulze, Holger Krekel and Ronny Pfannschmidt `_ 1002 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-flakes-0.2?py=py33&pytest=2.4.2 pytest plugin to check source code with pyflakes + `pytest-greendots-0.2 `_ `UNKNOWN `_ 163 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-greendots-0.2?py=py33&pytest=2.4.2 Green progress dots + `pytest-growl-0.1 `_ `Anthony Long `_ 87 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-growl-0.1?py=py33&pytest=2.4.2 Growl notifications for pytest results. + `pytest-incremental-0.3.0 `_ `Eduardo Naufel Schettino `_ 219 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-incremental-0.3.0?py=py33&pytest=2.4.2 an incremental test runner (pytest plugin) + `pytest-instafail-0.1.1 `_ `Janne Vanhala `_ 313 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-instafail-0.1.1?py=py33&pytest=2.4.2 py.test plugin to show failures instantly + `pytest-ipdb-0.1-prerelease `_ `Matthew de Verteuil `_ 72 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-ipdb-0.1-prerelease?py=py33&pytest=2.4.2 A py.test plug-in to enable drop to ipdb debugger on test failure. + `pytest-jira-0.01 `_ `James Laska `_ 269 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-jira-0.01?py=py33&pytest=2.4.2 py.test JIRA integration plugin, using markers + `pytest-konira-0.2 `_ `Alfredo Deza `_ 95 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-konira-0.2?py=py33&pytest=2.4.2 Run Konira DSL tests with py.test + `pytest-localserver-0.3.2 `_ `Sebastian Rahlf `_ 625 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-localserver-0.3.2?py=py33&pytest=2.4.2 py.test plugin to test server connections locally. + `pytest-marker-bugzilla-0.06 `_ `Eric Sammons `_ 166 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marker-bugzilla-0.06?py=py33&pytest=2.4.2 py.test bugzilla integration plugin, using markers + `pytest-markfiltration-0.8 `_ `adam goucher `_ 222 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-markfiltration-0.8?py=py33&pytest=2.4.2 UNKNOWN + `pytest-marks-0.4 `_ `adam goucher `_ 201 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-marks-0.4?py=py33&pytest=2.4.2 UNKNOWN + `pytest-monkeyplus-1.1.0 `_ `Virgil Dupras `_ 110 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-monkeyplus-1.1.0?py=py33&pytest=2.4.2 pytest's monkeypatch subclass with extra functionalities + `pytest-mozwebqa-1.1.1 `_ `Dave Hunt `_ 621 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-mozwebqa-1.1.1?py=py33&pytest=2.4.2 Mozilla WebQA plugin for py.test. + `pytest-oerp-0.2.0 `_ `Leonardo Santagada `_ 147 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-oerp-0.2.0?py=py33&pytest=2.4.2 pytest plugin to test OpenERP modules + `pytest-osxnotify-0.1.4 `_ `Daniel Bader `_ 202 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-osxnotify-0.1.4?py=py33&pytest=2.4.2 OS X notifications for py.test results. + `pytest-paste-config-0.1 `_ `UNKNOWN `_ 123 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-paste-config-0.1?py=py33&pytest=2.4.2 Allow setting the path to a paste config file + `pytest-pep8-1.0.5 `_ `Holger Krekel and Ronny Pfannschmidt `_ 5096 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pep8-1.0.5?py=py33&pytest=2.4.2 pytest plugin to check PEP8 requirements + `pytest-poo-0.2 `_ `Andreas Pelme `_ 93 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-poo-0.2?py=py33&pytest=2.4.2 Visualize your crappy tests + `pytest-pydev-0.1 `_ `Sebastian Rahlf `_ 96 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-pydev-0.1?py=py33&pytest=2.4.2 py.test plugin to connect to a remote debug server with PyDev or PyCharm. + `pytest-qt-1.0.2 `_ `Bruno Oliveira `_ 152 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-qt-1.0.2?py=py33&pytest=2.4.2 pytest plugin that adds fixtures for testing Qt (PyQt and PySide) applications. + `pytest-quickcheck-0.7 `_ `Tetsuya Morimoto `_ 182 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.7?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-quickcheck-0.7?py=py33&pytest=2.4.2 pytest plugin to generate random data inspired by QuickCheck + `pytest-rage-0.1 `_ `Leonardo Santagada `_ 67 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rage-0.1?py=py33&pytest=2.4.2 pytest plugin to implement PEP712 + `pytest-random-0.02 `_ `Leah Klearman `_ 111 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-random-0.02?py=py33&pytest=2.4.2 py.test plugin to randomize tests + `pytest-rerunfailures-0.03 `_ `Leah Klearman `_ 79 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-rerunfailures-0.03?py=py33&pytest=2.4.2 py.test plugin to re-run tests to eliminate flakey failures + `pytest-runfailed-0.3 `_ `Dimitri Merejkowsky `_ 95 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runfailed-0.3?py=py33&pytest=2.4.2 implement a --failed option for pytest + `pytest-runner-2.0 `_ `Jason R. Coombs `_ 7458 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-runner-2.0?py=py33&pytest=2.4.2 UNKNOWN + `pytest-sugar-0.2.2 `_ `Teemu, Janne Vanhala `_ 323 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-sugar-0.2.2?py=py33&pytest=2.4.2 py.test plugin that adds instafail, ETA and neat graphics + `pytest-timeout-0.3 `_ `Floris Bruynooghe `_ 3689 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-timeout-0.3?py=py33&pytest=2.4.2 pytest plugin to abort tests after a timeout + `pytest-twisted-1.4 `_ `Ralf Schmitt `_ 504 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-twisted-1.4?py=py33&pytest=2.4.2 A twisted plugin for py.test. + `pytest-xdist-1.9 `_ `holger krekel and contributors `_ 7287 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xdist-1.9?py=py33&pytest=2.4.2 py.test xdist plugin for distributed testing and loop-on-failing modes + `pytest-xprocess-0.8 `_ `Holger Krekel `_ 118 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-xprocess-0.8?py=py33&pytest=2.4.2 pytest plugin to manage external processes across test runs + `pytest-yamlwsgi-0.6 `_ `Ali Afshar `_ 187 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-yamlwsgi-0.6?py=py33&pytest=2.4.2 Run tests against wsgi apps defined in yaml + `pytest-zap-0.1 `_ `Dave Hunt `_ 71 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-zap-0.1?py=py33&pytest=2.4.2 OWASP ZAP plugin for py.test. -========================================================================================== ==================================================================================== ========= ============================================================================================================================================= +========================================================================================== ==================================================================================== ========= ====================================================================================================== ====================================================================================================== ============================================================================================================================================= *(Downloads are given from last month only)* -*(Updated on 2013-10-14)* +*(Updated on 2013-11-12)* diff -r 8ebe029cde4d67b822bbb8b4ffe1f896498e29e2 -r 5d9ad221c1bef740a566bc9bc34055347a60b9dc doc/en/plugins_index/test_plugins_index.py --- a/doc/en/plugins_index/test_plugins_index.py +++ b/doc/en/plugins_index/test_plugins_index.py @@ -80,13 +80,13 @@ List of Third-Party Plugins =========================== -============================================ ============================= ========= =================== - Name Author Downloads Summary -============================================ ============================= ========= =================== - `pytest-plugin1-1.0 `_ `someone `_ 4 some plugin - `pytest-plugin2-1.2 `_ `other `_ 40 some other plugin +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + Name Author Downloads Python 2.7 Python 3.3 Summary +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== + `pytest-plugin1-1.0 `_ `someone `_ 4 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin1-1.0?py=py33&pytest=2.4.2 some plugin + `pytest-plugin2-1.2 `_ `other `_ 40 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py27&pytest=2.4.2 .. image:: http://pytest-plugs.herokuapp.com/status/pytest-plugin2-1.2?py=py33&pytest=2.4.2 some other plugin -============================================ ============================= ========= =================== +============================================ ============================= ========= ============================================================================================= ============================================================================================= =================== *(Downloads are given from last month only)* @@ -98,4 +98,4 @@ # main #=================================================================================================== if __name__ == '__main__': - pytest.main() \ No newline at end of file + pytest.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 Nov 14 05:58:53 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 14 Nov 2013 04:58:53 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131114045853.11183.85362@app06.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/75a20d1bb563/ Changeset: 75a20d1bb563 Branch: fix-fixturedef-merge User: bubenkoff Date: 2013-11-13 18:25:55 Summary: correctly check for fixturedef when merging Affected #: 1 file diff -r 5d9ad221c1bef740a566bc9bc34055347a60b9dc -r 75a20d1bb5639f79fc135b078385f367c8ef42f3 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1555,7 +1555,7 @@ continue fixturedefs = self.getfixturedefs(argname, parentid) arg2fixturedefs[argname] = fixturedefs - if fixturedefs is not None: + if fixturedefs: merge(fixturedefs[-1].argnames) return fixturenames_closure, arg2fixturedefs https://bitbucket.org/hpk42/pytest/commits/979602dcb416/ Changeset: 979602dcb416 User: hpk42 Date: 2013-11-14 05:58:50 Summary: Merged in paylogic/pytest/fix-fixturedef-merge (pull request #86) correctly check for fixturedef when merging Affected #: 1 file diff -r 5d9ad221c1bef740a566bc9bc34055347a60b9dc -r 979602dcb416e9b537e109cbe853a0ef3b9bfbbe _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1555,7 +1555,7 @@ continue fixturedefs = self.getfixturedefs(argname, parentid) arg2fixturedefs[argname] = fixturedefs - if fixturedefs is not None: + if fixturedefs: merge(fixturedefs[-1].argnames) return fixturenames_closure, arg2fixturedefs 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 issues-reply at bitbucket.org Thu Nov 14 11:20:49 2013 From: issues-reply at bitbucket.org (Chris Jerdonek) Date: Thu, 14 Nov 2013 10:20:49 -0000 Subject: [Pytest-commit] Issue #137: Unexpected setenv behavior (hpk42/tox) Message-ID: <20131114102049.15705.61926@app12.ash-private.bitbucket.org> New issue 137: Unexpected setenv behavior https://bitbucket.org/hpk42/tox/issue/137/unexpected-setenv-behavior Chris Jerdonek: The following behavior was unexpected to me. With an ini section like the following: [testenv] setenv = FOO = bar commands = echo {env:FOO} The environment variable `FOO` set via `setenv` is not reflected in the `{env:FOO}` substitution. I think the documentation should clarify this because it may be surprising to some. Also, there is a typo [here](https://bitbucket.org/hpk42/tox/src/72ba41dbebee260b19f8ef1a337c83d45ab8fcf3/tox/_config.py?at=default#cl-550) (unkown -> unknown). From commits-noreply at bitbucket.org Fri Nov 15 11:05:17 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 15 Nov 2013 10:05:17 -0000 Subject: [Pytest-commit] commit/tox: cjerdonek: Address issue #125 by adding a --hashseed command-line option. Message-ID: <20131115100517.9236.46988@app08.ash-private.bitbucket.org> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/5630201c3d53/ Changeset: 5630201c3d53 User: cjerdonek Date: 2013-11-14 10:51:26 Summary: Address issue #125 by adding a --hashseed command-line option. This commit also causes Tox to set PYTHONHASHSEED for test commands to a random integer generated when tox is invoked. See the issue here: https://bitbucket.org/hpk42/tox/issue/125 Affected #: 5 files diff -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 -r 5630201c3d53266e9a8fb0b9b37310256ddb213e doc/example/basic.txt --- a/doc/example/basic.txt +++ b/doc/example/basic.txt @@ -175,6 +175,27 @@ from the ``subdir`` below the directory where your ``tox.ini`` file resides. +special handling of PYTHONHASHSEED +------------------------------------------- + +.. versionadded:: 1.6.2 + +By default, Tox sets PYTHONHASHSEED_ for test commands to a random integer +generated when ``tox`` is invoked. This mimics Python's hash randomization +enabled by default starting `in Python 3.3`_. To aid in reproducing test +failures, Tox displays the value of ``PYTHONHASHSEED`` in the test output. + +You can tell Tox to use an explicit hash seed value via the ``--hashseed`` +command-line option to ``tox``. You can also override the hash seed value +per test environment in ``tox.ini`` as follows:: + + [testenv:hash] + setenv = + PYTHONHASHSEED = 100 + +.. _`in Python 3.3`: http://docs.python.org/3/whatsnew/3.3.html#builtin-functions-and-types +.. _PYTHONHASHSEED: http://docs.python.org/using/cmdline.html#envvar-PYTHONHASHSEED + Integration with setuptools/distribute test commands ---------------------------------------------------- diff -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 -r 5630201c3d53266e9a8fb0b9b37310256ddb213e tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -5,6 +5,7 @@ from textwrap import dedent import py +import tox._config from tox._config import * from tox._config import _split_env @@ -405,7 +406,13 @@ assert envconfig.sitepackages == False assert envconfig.develop == False assert envconfig.envlogdir == envconfig.envdir.join("log") - assert envconfig.setenv is None + assert list(envconfig.setenv.keys()) == ['PYTHONHASHSEED'] + hashseed = envconfig.setenv['PYTHONHASHSEED'] + assert isinstance(hashseed, str) + # The following line checks that hashseed parses to an integer. + int_hashseed = int(hashseed) + # hashseed is random by default, so we can't assert a specific value. + assert int_hashseed > 0 def test_installpkg_tops_develop(self, newconfig): config = newconfig(["--installpkg=abc"], """ @@ -899,6 +906,120 @@ assert env.basepython == "python2.4" assert env.commands == [['xyz']] +class TestHashseedOption: + + def _get_envconfigs(self, newconfig, args=None, tox_ini=None, + make_hashseed=None): + if args is None: + args = [] + if tox_ini is None: + tox_ini = """ + [testenv] + """ + if make_hashseed is None: + make_hashseed = lambda: '123456789' + original_make_hashseed = tox._config.make_hashseed + tox._config.make_hashseed = make_hashseed + try: + config = newconfig(args, tox_ini) + finally: + tox._config.make_hashseed = original_make_hashseed + return config.envconfigs + + def _get_envconfig(self, newconfig, args=None, tox_ini=None): + envconfigs = self._get_envconfigs(newconfig, args=args, + tox_ini=tox_ini) + return envconfigs["python"] + + def _check_hashseed(self, envconfig, expected): + assert envconfig.setenv == {'PYTHONHASHSEED': expected} + + def _check_testenv(self, newconfig, expected, args=None, tox_ini=None): + envconfig = self._get_envconfig(newconfig, args=args, tox_ini=tox_ini) + self._check_hashseed(envconfig, expected) + + def test_default(self, tmpdir, newconfig): + self._check_testenv(newconfig, '123456789') + + def test_passing_integer(self, tmpdir, newconfig): + args = ['--hashseed', '1'] + self._check_testenv(newconfig, '1', args=args) + + def test_passing_string(self, tmpdir, newconfig): + args = ['--hashseed', 'random'] + self._check_testenv(newconfig, 'random', args=args) + + def test_passing_empty_string(self, tmpdir, newconfig): + args = ['--hashseed', ''] + self._check_testenv(newconfig, '', args=args) + + def test_passing_no_argument(self, tmpdir, newconfig): + """Test that passing no arguments to --hashseed is not allowed.""" + args = ['--hashseed'] + try: + self._check_testenv(newconfig, '', args=args) + except SystemExit: + e = sys.exc_info()[1] + assert e.code == 2 + return + assert False # getting here means we failed the test. + + def test_setenv(self, tmpdir, newconfig): + """Check that setenv takes precedence.""" + tox_ini = """ + [testenv] + setenv = + PYTHONHASHSEED = 2 + """ + self._check_testenv(newconfig, '2', tox_ini=tox_ini) + args = ['--hashseed', '1'] + self._check_testenv(newconfig, '2', args=args, tox_ini=tox_ini) + + def test_noset(self, tmpdir, newconfig): + args = ['--hashseed', 'noset'] + envconfig = self._get_envconfig(newconfig, args=args) + assert envconfig.setenv is None + + def test_noset_with_setenv(self, tmpdir, newconfig): + tox_ini = """ + [testenv] + setenv = + PYTHONHASHSEED = 2 + """ + args = ['--hashseed', 'noset'] + self._check_testenv(newconfig, '2', args=args, tox_ini=tox_ini) + + def test_one_random_hashseed(self, tmpdir, newconfig): + """Check that different testenvs use the same random seed.""" + tox_ini = """ + [testenv:hash1] + [testenv:hash2] + """ + next_seed = [1000] + # This function is guaranteed to generate a different value each time. + def make_hashseed(): + next_seed[0] += 1 + return str(next_seed[0]) + # Check that make_hashseed() works. + assert make_hashseed() == '1001' + envconfigs = self._get_envconfigs(newconfig, tox_ini=tox_ini, + make_hashseed=make_hashseed) + self._check_hashseed(envconfigs["hash1"], '1002') + # Check that hash2's value is not '1003', for example. + self._check_hashseed(envconfigs["hash2"], '1002') + + def test_setenv_in_one_testenv(self, tmpdir, newconfig): + """Check using setenv in one of multiple testenvs.""" + tox_ini = """ + [testenv:hash1] + setenv = + PYTHONHASHSEED = 2 + [testenv:hash2] + """ + envconfigs = self._get_envconfigs(newconfig, tox_ini=tox_ini) + self._check_hashseed(envconfigs["hash1"], '2') + self._check_hashseed(envconfigs["hash2"], '123456789') + class TestIndexServer: def test_indexserver(self, tmpdir, newconfig): config = newconfig(""" diff -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 -r 5630201c3d53266e9a8fb0b9b37310256ddb213e tests/test_venv.py --- a/tests/test_venv.py +++ b/tests/test_venv.py @@ -2,6 +2,7 @@ import tox import pytest import os, sys +import tox._config from tox._venv import * py25calls = int(sys.version_info[:2] == (2,5)) @@ -231,6 +232,20 @@ venv.update() mocksession.report.expect("verbosity0", "*recreate*") +def test_test_hashseed_is_in_output(newmocksession): + original_make_hashseed = tox._config.make_hashseed + tox._config.make_hashseed = lambda: '123456789' + try: + mocksession = newmocksession([], ''' + [testenv] + ''') + finally: + tox._config.make_hashseed = original_make_hashseed + venv = mocksession.getenv('python') + venv.update() + venv.test() + mocksession.report.expect("verbosity0", "python runtests: PYTHONHASHSEED='123456789'") + def test_test_runtests_action_command_is_in_output(newmocksession): mocksession = newmocksession([], ''' [testenv] diff -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 -r 5630201c3d53266e9a8fb0b9b37310256ddb213e tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -1,6 +1,7 @@ import argparse import distutils.sysconfig import os +import random import sys import re import shlex @@ -117,6 +118,12 @@ "all commands and results involved. This will turn off " "pass-through output from running test commands which is " "instead captured into the json result file.") + # We choose 1 to 4294967295 because it is the range of PYTHONHASHSEED. + parser.add_argument("--hashseed", action="store", + metavar="SEED", default=None, + help="set PYTHONHASHSEED to SEED before running commands. " + "Defaults to a random integer in the range 1 to 4294967295. " + "Passing 'noset' suppresses this behavior.") parser.add_argument("args", nargs="*", help="additional arguments available to command positional substitution") return parser @@ -180,6 +187,9 @@ except Exception: return None +def make_hashseed(): + return str(random.randint(1, 4294967295)) + class parseini: def __init__(self, config, inipath): config.toxinipath = inipath @@ -200,6 +210,13 @@ else: raise ValueError("invalid context") + if config.option.hashseed is None: + hashseed = make_hashseed() + elif config.option.hashseed == 'noset': + hashseed = None + else: + hashseed = config.option.hashseed + config.hashseed = hashseed reader.addsubstitutions(toxinidir=config.toxinidir, homedir=config.homedir) @@ -306,7 +323,11 @@ arg = vc.changedir.bestrelpath(origpath) args.append(arg) reader.addsubstitutions(args) - vc.setenv = reader.getdict(section, 'setenv') + setenv = {} + if config.hashseed is not None: + setenv['PYTHONHASHSEED'] = config.hashseed + setenv.update(reader.getdict(section, 'setenv')) + vc.setenv = setenv if not vc.setenv: vc.setenv = None diff -r 72ba41dbebee260b19f8ef1a337c83d45ab8fcf3 -r 5630201c3d53266e9a8fb0b9b37310256ddb213e tox/_venv.py --- a/tox/_venv.py +++ b/tox/_venv.py @@ -336,14 +336,13 @@ self.run_install_command(packages=packages, options=options, action=action, extraenv=extraenv) - def _getenv(self): - env = self.envconfig.setenv - if env: - env_arg = os.environ.copy() - env_arg.update(env) - else: - env_arg = None - return env_arg + def _getenv(self, extraenv={}): + env = os.environ.copy() + setenv = self.envconfig.setenv + if setenv: + env.update(setenv) + env.update(extraenv) + return env def test(self, redirect=False): action = self.session.newaction(self, "runtests") @@ -351,6 +350,9 @@ self.status = 0 self.session.make_emptydir(self.envconfig.envtmpdir) cwd = self.envconfig.changedir + env = self._getenv() + # Display PYTHONHASHSEED to assist with reproducibility. + action.setactivity("runtests", "PYTHONHASHSEED=%r" % env.get('PYTHONHASHSEED')) for i, argv in enumerate(self.envconfig.commands): # have to make strings as _pcall changes argv[0] to a local() # happens if the same environment is invoked twice @@ -380,8 +382,7 @@ old = self.patchPATH() try: args[0] = self.getcommandpath(args[0], venv, cwd) - env = self._getenv() or os.environ.copy() - env.update(extraenv) + env = self._getenv(extraenv) return action.popen(args, cwd=cwd, env=env, redirect=redirect) finally: os.environ['PATH'] = old Repository URL: https://bitbucket.org/hpk42/tox/ -- 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 Nov 15 11:08:46 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 15 Nov 2013 10:08:46 -0000 Subject: [Pytest-commit] commit/tox: hpk42: merged PR125: tox now sets "PYTHONHASHSEED" if it is not set Message-ID: <20131115100846.30398.48101@app05.ash-private.bitbucket.org> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/9db7aee8fb06/ Changeset: 9db7aee8fb06 User: hpk42 Date: 2013-11-15 11:08:42 Summary: merged PR125: tox now sets "PYTHONHASHSEED" if it is not set and offers a "--hashseed" option to repeat a test run with a specific seed. Thanks Chris Jerdonek for all the work behind this. Affected #: 2 files diff -r 5630201c3d53266e9a8fb0b9b37310256ddb213e -r 9db7aee8fb06c55ef4c3ddfc3aba97eff24bc8d7 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ 1.6.2.dev --------- +- merged PR125: tox now sets "PYTHONHASHSEED" if it is not set + and offers a "--hashseed" option to repeat a test run with a specific seed. + Thanks Chris Jerdonek for all the work behind this. + - fix issue132: removing zip_safe setting (so it defaults to false) to allow installation of tox via easy_install/eggs. Thanks Jenisys. diff -r 5630201c3d53266e9a8fb0b9b37310256ddb213e -r 9db7aee8fb06c55ef4c3ddfc3aba97eff24bc8d7 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -953,6 +953,9 @@ args = ['--hashseed', ''] self._check_testenv(newconfig, '', args=args) + @pytest.mark.xfail(sys.version_info >= (3,2), + reason="at least Debian python 3.2/3.3 have a bug: " + "http://bugs.python.org/issue11884") def test_passing_no_argument(self, tmpdir, newconfig): """Test that passing no arguments to --hashseed is not allowed.""" args = ['--hashseed'] Repository URL: https://bitbucket.org/hpk42/tox/ -- 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 Nov 15 12:29:06 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 15 Nov 2013 11:29:06 -0000 Subject: [Pytest-commit] commit/tox: hpk42: fix changelog entry for hashseed. Thanks Chris Jerdonek. Message-ID: <20131115112906.20467.46217@app11.ash-private.bitbucket.org> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/1421955f0d5f/ Changeset: 1421955f0d5f User: hpk42 Date: 2013-11-15 12:29:01 Summary: fix changelog entry for hashseed. Thanks Chris Jerdonek. Affected #: 1 file diff -r 9db7aee8fb06c55ef4c3ddfc3aba97eff24bc8d7 -r 1421955f0d5faab5d579ff40ceca7385d49e40ad CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,10 @@ 1.6.2.dev --------- -- merged PR125: tox now sets "PYTHONHASHSEED" if it is not set +- merged PR125: tox now sets "PYTHONHASHSEED" to a random value and offers a "--hashseed" option to repeat a test run with a specific seed. - Thanks Chris Jerdonek for all the work behind this. + You can also use --hashsheed=notset to instruct tox to leave the value + alone. Thanks Chris Jerdonek for all the work behind this. - fix issue132: removing zip_safe setting (so it defaults to false) to allow installation of tox Repository URL: https://bitbucket.org/hpk42/tox/ -- 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 Nov 15 21:02:33 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 15 Nov 2013 20:02:33 -0000 Subject: [Pytest-commit] commit/pytest: 3 new changesets Message-ID: <20131115200233.8798.16534@app11.ash-private.bitbucket.org> 3 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/dac4900b78f2/ Changeset: dac4900b78f2 User: hsoft Date: 2013-11-08 22:59:13 Summary: Fix TypeError crash on failed imports under py3.3. Starting with Python 3.3, NamespacePath passed to importlib hooks seem to have lost the ability to be accessed by index. We wrap the index access in a try..except and wrap the path in a list if it happens. Fixes #383. Affected #: 1 file diff -r 257206079babf818a2819a44f5cf30c64d572287 -r dac4900b78f2046b734ab6d356ee82f910d35b75 _pytest/assertion/rewrite.py --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -57,7 +57,12 @@ lastname = names[-1] pth = None if path is not None and len(path) == 1: - pth = path[0] + try: + pth = path[0] + except TypeError: + # Starting with Python 3.3, `path` started being unsubscriptable, we have to wrap it + # in a list. + pth = list(path)[0] if pth is None: try: fd, fn, desc = imp.find_module(lastname, path) https://bitbucket.org/hpk42/pytest/commits/c9a1939bda35/ Changeset: c9a1939bda35 User: hsoft Date: 2013-11-15 20:03:57 Summary: Added test for previous crash on failed import fix Also, rewrote the fix a bit. ref #383. Affected #: 2 files diff -r dac4900b78f2046b734ab6d356ee82f910d35b75 -r c9a1939bda358b08bdfc0d1129c5fa874cff8f04 _pytest/assertion/rewrite.py --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -56,13 +56,12 @@ names = name.rsplit(".", 1) lastname = names[-1] pth = None - if path is not None and len(path) == 1: - try: + if path is not None: + # Starting with Python 3.3, path is a _NamespacePath(), which + # causes problems if not converted to list. + path = list(path) + if len(path) == 1: pth = path[0] - except TypeError: - # Starting with Python 3.3, `path` started being unsubscriptable, we have to wrap it - # in a list. - pth = list(path)[0] if pth is None: try: fd, fn, desc = imp.find_module(lastname, path) diff -r dac4900b78f2046b734ab6d356ee82f910d35b75 -r c9a1939bda358b08bdfc0d1129c5fa874cff8f04 testing/acceptance_test.py --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -307,6 +307,24 @@ '*ERROR*', ]) assert result.ret == 4 # usage error only if item not found + + def test_namespace_import_doesnt_confuse_import_hook(self, testdir): + # Ref #383. Python 3.3's namespace package messed with our import hooks + # Importing a module that didn't exist, even if the ImportError was + # gracefully handled, would make our test crash. + testdir.mkdir('not_a_package') + p = testdir.makepyfile(""" + try: + from not_a_package import doesnt_exist + except ImportError: + # We handle the import error gracefully here + pass + + def test_whatever(): + pass + """) + res = testdir.runpytest(p.basename) + assert res.ret == 0 class TestInvocationVariants: https://bitbucket.org/hpk42/pytest/commits/89b0f6f0e7d8/ Changeset: 89b0f6f0e7d8 User: hpk42 Date: 2013-11-15 21:02:30 Summary: Merged in hsoft/pytest (pull request #81) Fix TypeError crash on failed imports under py3.3. Affected #: 2 files diff -r 979602dcb416e9b537e109cbe853a0ef3b9bfbbe -r 89b0f6f0e7d8a87edd3fb9d1dcaa8c58d1ed0361 _pytest/assertion/rewrite.py --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -56,8 +56,12 @@ names = name.rsplit(".", 1) lastname = names[-1] pth = None - if path is not None and len(path) == 1: - pth = path[0] + if path is not None: + # Starting with Python 3.3, path is a _NamespacePath(), which + # causes problems if not converted to list. + path = list(path) + if len(path) == 1: + pth = path[0] if pth is None: try: fd, fn, desc = imp.find_module(lastname, path) diff -r 979602dcb416e9b537e109cbe853a0ef3b9bfbbe -r 89b0f6f0e7d8a87edd3fb9d1dcaa8c58d1ed0361 testing/acceptance_test.py --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -307,6 +307,24 @@ '*ERROR*', ]) assert result.ret == 4 # usage error only if item not found + + def test_namespace_import_doesnt_confuse_import_hook(self, testdir): + # Ref #383. Python 3.3's namespace package messed with our import hooks + # Importing a module that didn't exist, even if the ImportError was + # gracefully handled, would make our test crash. + testdir.mkdir('not_a_package') + p = testdir.makepyfile(""" + try: + from not_a_package import doesnt_exist + except ImportError: + # We handle the import error gracefully here + pass + + def test_whatever(): + pass + """) + res = testdir.runpytest(p.basename) + assert res.ret == 0 class TestInvocationVariants: 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 Nov 18 21:32:07 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Mon, 18 Nov 2013 20:32:07 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: a script to read bitbucket pytest issues Message-ID: <20131118203207.6686.28490@app08.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/fbff0a016b3b/ Changeset: fbff0a016b3b User: hpk42 Date: 2013-11-18 21:31:32 Summary: a script to read bitbucket pytest issues Affected #: 1 file diff -r 89b0f6f0e7d8a87edd3fb9d1dcaa8c58d1ed0361 -r fbff0a016b3bff6d6ccfa36f66249508689b7ee8 extra/get_issues.py --- /dev/null +++ b/extra/get_issues.py @@ -0,0 +1,73 @@ +import json +import py +import textwrap + +issues_url = "http://bitbucket.org/api/1.0/repositories/hpk42/pytest/issues" + +import requests + +def get_issues(): + chunksize = 50 + start = 0 + issues = [] + while 1: + post_data = {"accountname": "hpk42", + "repo_slug": "pytest", + "start": start, + "limit": chunksize} + print ("getting from", start) + r = requests.get(issues_url, params=post_data) + data = r.json() + issues.extend(data["issues"]) + if start + chunksize >= data["count"]: + return issues + start += chunksize + +kind2num = "bug enhancement task proposal".split() + +status2num = "new open resolved duplicate invalid wontfix".split() + +def main(args): + cachefile = py.path.local(args.cache) + if not cachefile.exists() or args.refresh: + issues = get_issues() + cachefile.write(json.dumps(issues)) + else: + issues = json.loads(cachefile.read()) + + open_issues = [x for x in issues + if x["status"] in ("new", "open")] + + def kind_and_id(x): + kind = x["metadata"]["kind"] + return kind2num.index(kind), len(issues)-int(x["local_id"]) + open_issues.sort(key=kind_and_id) + report(open_issues) + +def report(issues): + for issue in issues: + metadata = issue["metadata"] + priority = issue["priority"] + title = issue["title"] + content = issue["content"] + kind = metadata["kind"] + status = issue["status"] + id = issue["local_id"] + link = "https://bitbucket.org/hpk42/pytest/issues/%s/" % id + print("----") + print(status, kind, link) + print(title) + #print() + #lines = content.split("\n") + #print ("\n".join(lines[:3])) + #if len(lines) > 3 or len(content) > 240: + # print ("...") + +if __name__ == "__main__": + import argparse + parser = argparse.ArgumentParser("process bitbucket issues") + parser.add_argument("--refresh", help="invalidate cache, refresh issues") + parser.add_argument("--cache", action="store", default="issues.json", + help="cache file") + args = parser.parse_args() + main(args) 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 Nov 19 09:20:56 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 08:20:56 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix issues link Message-ID: <20131119082056.9196.83608@app03.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/77b0a734de06/ Changeset: 77b0a734de06 User: hpk42 Date: 2013-11-19 09:20:50 Summary: fix issues link Affected #: 1 file diff -r fbff0a016b3bff6d6ccfa36f66249508689b7ee8 -r 77b0a734de063196acea35e63c0ece16078cd8f0 extra/get_issues.py --- a/extra/get_issues.py +++ b/extra/get_issues.py @@ -53,7 +53,7 @@ kind = metadata["kind"] status = issue["status"] id = issue["local_id"] - link = "https://bitbucket.org/hpk42/pytest/issues/%s/" % id + link = "https://bitbucket.org/hpk42/pytest/issue/%s/" % id print("----") print(status, kind, link) print(title) 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 Nov 19 10:10:34 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 09:10:34 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix pexpect-3.0 compatibility for pytest's own tests. Message-ID: <20131119091034.8608.4682@app07.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/304f9f212ae3/ Changeset: 304f9f212ae3 User: hpk42 Date: 2013-11-19 10:10:27 Summary: fix pexpect-3.0 compatibility for pytest's own tests. (fixes issue386) Affected #: 4 files diff -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 304f9f212ae373dbb55129b41b88e413baceba51 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ Unreleased ----------------------------------- +- fix pexpect-3.0 compatibility for pytest's own tests. + (fixes issue386) + - allow nested parametrize-value markers, thanks James Lan for the PR. - fix unicode handling with new monkeypatch.setattr(import_path, value) diff -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 304f9f212ae373dbb55129b41b88e413baceba51 _pytest/pytester.py --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -516,15 +516,16 @@ return self.spawn(cmd, expect_timeout=expect_timeout) def spawn(self, cmd, expect_timeout=10.0): - pexpect = py.test.importorskip("pexpect", "2.4") + pexpect = py.test.importorskip("pexpect", "3.0") if hasattr(sys, 'pypy_version_info') and '64' in py.std.platform.machine(): pytest.skip("pypy-64 bit not supported") if sys.platform == "darwin": pytest.xfail("pexpect does not work reliably on darwin?!") if sys.platform.startswith("freebsd"): pytest.xfail("pexpect does not work reliably on freebsd") - logfile = self.tmpdir.join("spawn.out") - child = pexpect.spawn(cmd, logfile=logfile.open("w")) + logfile = self.tmpdir.join("spawn.out").open("wb") + child = pexpect.spawn(cmd, logfile=logfile) + self.request.addfinalizer(logfile.close) child.timeout = expect_timeout return child diff -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 304f9f212ae373dbb55129b41b88e413baceba51 testing/test_pdb.py --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -1,3 +1,4 @@ + import py import sys @@ -62,7 +63,7 @@ child.expect(".*i = 0") child.expect("(Pdb)") child.sendeof() - rest = child.read() + rest = child.read().decode("utf8") assert "1 failed" in rest assert "def test_1" not in rest if child.isalive(): @@ -127,7 +128,7 @@ child.expect("x = 3") child.expect("(Pdb)") child.sendeof() - rest = child.read() + rest = child.read().decode("utf-8") assert "1 failed" in rest assert "def test_1" in rest assert "hello17" in rest # out is captured @@ -144,7 +145,7 @@ child.expect("test_1") child.expect("(Pdb)") child.sendeof() - rest = child.read() + rest = child.read().decode("utf8") assert "1 failed" in rest assert "reading from stdin while output" not in rest if child.isalive(): @@ -182,7 +183,7 @@ child.expect("0") child.expect("(Pdb)") child.sendeof() - rest = child.read() + rest = child.read().decode("utf8") assert "1 failed" in rest if child.isalive(): child.wait() @@ -206,7 +207,7 @@ child.sendline('c') child.expect("x = 4") child.sendeof() - rest = child.read() + rest = child.read().decode("utf8") assert "1 failed" in rest assert "def test_1" in rest assert "hello17" in rest # out is captured @@ -238,6 +239,7 @@ child.expect("x = 5") child.sendeof() child.wait() + def test_pdb_collection_failure_is_shown(self, testdir): p1 = testdir.makepyfile("""xxx """) result = testdir.runpytest("--pdb", p1) diff -r 77b0a734de063196acea35e63c0ece16078cd8f0 -r 304f9f212ae373dbb55129b41b88e413baceba51 tox.ini --- a/tox.ini +++ b/tox.ini @@ -16,6 +16,7 @@ [testenv:py25] setenv = PIP_INSECURE=1 +deps=nose [testenv:flakes] changedir= @@ -55,14 +56,6 @@ commands=py.test --doctest-modules _pytest deps= -[testenv:py32] -deps= - nose - -[testenv:py33] -deps= - nose - [testenv:doc] basepython=python changedir=doc/en 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 notifications at travis-ci.org Tue Nov 19 09:27:35 2013 From: notifications at travis-ci.org (Travis CI) Date: Tue, 19 Nov 2013 08:27:35 +0000 Subject: [Pytest-commit] [Broken] hpk42/pytest#48 (master - f5003f2) Message-ID: <528b20f798198_2181ec4296586@f9a41beb-6dc4-4bb1-9b37-1e28424d4536.mail> Build Update for hpk42/pytest ------------------------------------- Build: #48 Status: Broken Duration: 5 minutes and 16 seconds Commit: f5003f2 (master) Author: holger krekel Message: fix issues link View the changeset: https://github.com/hpk42/pytest/compare/6a18795d6c38...f5003f2a1fef View the full build log and details: https://travis-ci.org/hpk42/pytest/builds/14185545 -- You can configure recipients for build notifications in your .travis.yml file. See http://about.travis-ci.org/docs/user/build-configuration -------------- next part -------------- An HTML attachment was scrubbed... URL: From commits-noreply at bitbucket.org Tue Nov 19 11:12:40 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 10:12:40 -0000 Subject: [Pytest-commit] commit/pytest: RonnyPfannschmidt: fix issue384 by removing the trial support code Message-ID: <20131119101240.6978.40704@app02.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/ba546e167318/ Changeset: ba546e167318 User: RonnyPfannschmidt Date: 2013-11-19 10:58:24 Summary: fix issue384 by removing the trial support code Affected #: 3 files diff -r 304f9f212ae373dbb55129b41b88e413baceba51 -r ba546e167318e92a2f2f052a958e093e536aff2e CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ Unreleased ----------------------------------- +- fix issue384 by removing the trial support code + since the unittest compat enhancements allow + trial to handle it on its own + - fix pexpect-3.0 compatibility for pytest's own tests. (fixes issue386) diff -r 304f9f212ae373dbb55129b41b88e413baceba51 -r ba546e167318e92a2f2f052a958e093e536aff2e _pytest/unittest.py --- a/_pytest/unittest.py +++ b/_pytest/unittest.py @@ -50,8 +50,6 @@ x = getattr(self.obj, name) funcobj = getattr(x, 'im_func', x) transfer_markers(funcobj, cls, module) - if hasattr(funcobj, 'todo'): - pytest.mark.xfail(reason=str(funcobj.todo))(funcobj) yield TestCaseFunction(name, parent=self) foundsomething = True @@ -70,10 +68,6 @@ def setup(self): self._testcase = self.parent.obj(self.name) self._obj = getattr(self._testcase, self.name) - if hasattr(self._testcase, 'skip'): - pytest.skip(self._testcase.skip) - if hasattr(self._obj, 'skip'): - pytest.skip(self._obj.skip) if hasattr(self._testcase, 'setup_method'): self._testcase.setup_method(self._obj) if hasattr(self, "_request"): diff -r 304f9f212ae373dbb55129b41b88e413baceba51 -r ba546e167318e92a2f2f052a958e093e536aff2e testing/test_unittest.py --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -310,9 +310,10 @@ reprec.assertoutcome(skipped=1) -def test_testcase_skip_property(testdir): +def test_trial_testcase_skip_property(testdir): + testpath = testdir.makepyfile(""" - import unittest + from twisted.trial import unittest class MyTestCase(unittest.TestCase): skip = 'dont run' def test_func(self): @@ -321,9 +322,11 @@ reprec = testdir.inline_run(testpath, "-s") reprec.assertoutcome(skipped=1) -def test_testfunction_skip_property(testdir): + +def test_trial_testfunction_skip_property(testdir): + pytest.importorskip('twisted.trial.unittest') testpath = testdir.makepyfile(""" - import unittest + from twisted.trial import unittest class MyTestCase(unittest.TestCase): def test_func(self): pass @@ -333,6 +336,32 @@ reprec.assertoutcome(skipped=1) +def test_trial_testcase_todo_property(testdir): + + testpath = testdir.makepyfile(""" + from twisted.trial import unittest + class MyTestCase(unittest.TestCase): + todo = 'dont run' + def test_func(self): + assert 0 + """) + reprec = testdir.inline_run(testpath, "-s") + reprec.assertoutcome(skipped=1) + + +def test_trial_testfunction_todo_property(testdir): + pytest.importorskip('twisted.trial.unittest') + testpath = testdir.makepyfile(""" + from twisted.trial import unittest + class MyTestCase(unittest.TestCase): + def test_func(self): + assert 0 + test_func.todo = 'dont run' + """) + reprec = testdir.inline_run(testpath, "-s") + reprec.assertoutcome(skipped=1) + + class TestTrialUnittest: def setup_class(cls): cls.ut = pytest.importorskip("twisted.trial.unittest") 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 Nov 19 11:18:58 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 10:18:58 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: xfail a test on pypy that checks wrong encoding/ascii (pypy does Message-ID: <20131119101858.19385.36875@app13.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/d1418860dd4a/ Changeset: d1418860dd4a User: hpk42 Date: 2013-11-19 11:18:51 Summary: xfail a test on pypy that checks wrong encoding/ascii (pypy does not error out). fixes issue385. also re-enable pypy tests in tox. Affected #: 3 files diff -r ba546e167318e92a2f2f052a958e093e536aff2e -r d1418860dd4a5dc8ed88ff2104e8e9b1801477e1 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -39,6 +39,8 @@ arg is an lambda and thus the example will work. Thanks Alex Gaynor for bringing it up. +- xfail a test on pypy that checks wrong encoding/ascii (pypy does + not error out). fixes issue385. Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r ba546e167318e92a2f2f052a958e093e536aff2e -r d1418860dd4a5dc8ed88ff2104e8e9b1801477e1 testing/test_assertrewrite.py --- a/testing/test_assertrewrite.py +++ b/testing/test_assertrewrite.py @@ -441,8 +441,9 @@ ]) @pytest.mark.skipif("sys.version_info[0] >= 3") + @pytest.mark.xfail("hasattr(sys, 'pypy_translation_info')") def test_assume_ascii(self, testdir): - content = "u'\xe2\x99\xa5'" + content = "u'\xe2\x99\xa5\x01\xfe'" testdir.tmpdir.join("test_encoding.py").write(content, "wb") res = testdir.runpytest() assert res.ret != 0 diff -r ba546e167318e92a2f2f052a958e093e536aff2e -r d1418860dd4a5dc8ed88ff2104e8e9b1801477e1 tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] distshare={homedir}/.tox/distshare -envlist=flakes,py25,py26,py27,py27-nobyte,py32,py33,py27-xdist,trial +envlist=flakes,py25,py26,py27,pypy,py27-nobyte,py32,py33,py27-xdist,trial [testenv] changedir=testing 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 Nov 19 12:25:37 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 11:25:37 -0000 Subject: [Pytest-commit] commit/pytest: RonnyPfannschmidt: add missing importorskip Message-ID: <20131119112537.23413.4236@app02.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/20a35e86eff1/ Changeset: 20a35e86eff1 User: RonnyPfannschmidt Date: 2013-11-19 12:21:47 Summary: add missing importorskip Affected #: 1 file diff -r d1418860dd4a5dc8ed88ff2104e8e9b1801477e1 -r 20a35e86eff1895b8eaade96dd6ebb58814d3c8a testing/test_unittest.py --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -311,7 +311,7 @@ def test_trial_testcase_skip_property(testdir): - + pytest.importorskip('twisted.trial.unittest') testpath = testdir.makepyfile(""" from twisted.trial import unittest class MyTestCase(unittest.TestCase): @@ -337,7 +337,7 @@ def test_trial_testcase_todo_property(testdir): - + pytest.importorskip('twisted.trial.unittest') testpath = testdir.makepyfile(""" from twisted.trial import unittest class MyTestCase(unittest.TestCase): 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 Nov 19 14:19:37 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 13:19:37 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix issue380 by making --resultlog only rely on longrepr instead Message-ID: <20131119131937.3717.69421@app03.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/b1bd58344edd/ Changeset: b1bd58344edd User: hpk42 Date: 2013-11-19 14:19:29 Summary: fix issue380 by making --resultlog only rely on longrepr instead of the "reprcrash" attribute which only exists sometimes. Affected #: 3 files diff -r 20a35e86eff1895b8eaade96dd6ebb58814d3c8a -r b1bd58344eddcb775617b83e87a74333a1febe84 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,9 @@ since the unittest compat enhancements allow trial to handle it on its own +- fix issue380 by making --resultlog only rely on longrepr instead + of the "reprcrash" attribute which only exists sometimes. + - fix pexpect-3.0 compatibility for pytest's own tests. (fixes issue386) diff -r 20a35e86eff1895b8eaade96dd6ebb58814d3c8a -r b1bd58344eddcb775617b83e87a74333a1febe84 _pytest/resultlog.py --- a/_pytest/resultlog.py +++ b/_pytest/resultlog.py @@ -6,7 +6,7 @@ def pytest_addoption(parser): group = parser.getgroup("terminal reporting", "resultlog plugin options") - group.addoption('--resultlog', '--result-log', action="store", + group.addoption('--resultlog', '--result-log', action="store", metavar="path", default=None, help="path for machine-readable result log.") @@ -85,7 +85,7 @@ if not report.passed: if report.failed: code = "F" - longrepr = str(report.longrepr.reprcrash) + longrepr = str(report.longrepr) else: assert report.skipped code = "S" diff -r 20a35e86eff1895b8eaade96dd6ebb58814d3c8a -r b1bd58344eddcb775617b83e87a74333a1febe84 testing/test_resultlog.py --- a/testing/test_resultlog.py +++ b/testing/test_resultlog.py @@ -195,3 +195,23 @@ pytest_unconfigure(config) assert not hasattr(config, '_resultlog') + +def test_failure_issue380(testdir): + testdir.makeconftest(""" + import pytest + class MyCollector(pytest.File): + def collect(self): + raise ValueError() + def repr_failure(self, excinfo): + return "somestring" + def pytest_collect_file(path, parent): + return MyCollector(parent=parent, fspath=path) + """) + testdir.makepyfile(""" + def test_func(): + pass + """) + result = testdir.runpytest("--resultlog=log") + assert result.ret == 1 + + 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 Nov 19 14:45:57 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 13:45:57 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: don't hide an ImportError when importing a plugin produces one. Message-ID: <20131119134557.30297.11528@app01.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/f9e200cee8f7/ Changeset: f9e200cee8f7 User: hpk42 Date: 2013-11-19 14:45:51 Summary: don't hide an ImportError when importing a plugin produces one. fixes issue375. Affected #: 3 files diff -r b1bd58344eddcb775617b83e87a74333a1febe84 -r f9e200cee8f7ec364af514d38f5f8865509fa227 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,9 @@ since the unittest compat enhancements allow trial to handle it on its own +- don't hide an ImportError when importing a plugin produces one. + fixes issue375. + - fix issue380 by making --resultlog only rely on longrepr instead of the "reprcrash" attribute which only exists sometimes. diff -r b1bd58344eddcb775617b83e87a74333a1febe84 -r f9e200cee8f7ec364af514d38f5f8865509fa227 _pytest/core.py --- a/_pytest/core.py +++ b/_pytest/core.py @@ -263,20 +263,11 @@ name = importspec try: mod = "_pytest." + name - #print >>sys.stderr, "tryimport", mod __import__(mod) return sys.modules[mod] except ImportError: - #e = py.std.sys.exc_info()[1] - #if str(e).find(name) == -1: - # raise - pass # - try: - #print >>sys.stderr, "tryimport", importspec __import__(importspec) - except ImportError: - raise ImportError(importspec) - return sys.modules[importspec] + return sys.modules[importspec] class MultiCall: """ execute a call into multiple python functions/methods. """ diff -r b1bd58344eddcb775617b83e87a74333a1febe84 -r f9e200cee8f7ec364af514d38f5f8865509fa227 testing/test_core.py --- a/testing/test_core.py +++ b/testing/test_core.py @@ -1,6 +1,5 @@ import pytest, py, os -from _pytest.core import PluginManager -from _pytest.core import MultiCall, HookRelay, varnames +from _pytest.core import * # noqa from _pytest.config import get_plugin_manager @@ -652,3 +651,11 @@ "*tryfirst*first*", "*trylast*last*", ]) + +def test_importplugin_issue375(testdir): + testdir.makepyfile(qwe="import aaaa") + with pytest.raises(ImportError) as excinfo: + importplugin("qwe") + assert "qwe" not in str(excinfo.value) + assert "aaaa" in str(excinfo.value) + 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 Nov 19 15:33:58 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 14:33:58 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: internally make varnames() deal with classes's __init__, Message-ID: <20131119143358.31476.20710@app09.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/282e0cca851c/ Changeset: 282e0cca851c User: hpk42 Date: 2013-11-19 15:33:52 Summary: internally make varnames() deal with classes's __init__, although it's not needed by pytest itself atm. Also fix caching. Fixes issue376. Affected #: 3 files diff -r f9e200cee8f7ec364af514d38f5f8865509fa227 -r 282e0cca851c58e64ddaeeb56907f4376927ac13 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -48,6 +48,10 @@ - xfail a test on pypy that checks wrong encoding/ascii (pypy does not error out). fixes issue385. +- internally make varnames() deal with classes's __init__, + although it's not needed by pytest itself atm. Also + fix caching. Fixes issue376. + Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r f9e200cee8f7ec364af514d38f5f8865509fa227 -r 282e0cca851c58e64ddaeeb56907f4376927ac13 _pytest/core.py --- a/_pytest/core.py +++ b/_pytest/core.py @@ -304,19 +304,36 @@ return kwargs def varnames(func): + """ return argument name tuple for a function, method, class or callable. + + In case of a class, its "__init__" method is considered. + For methods the "self" parameter is not included unless you are passing + an unbound method with Python3 (which has no supports for unbound methods) + """ + cache = getattr(func, "__dict__", {}) try: - return func._varnames - except AttributeError: + return cache["_varnames"] + except KeyError: pass - if not inspect.isfunction(func) and not inspect.ismethod(func): - func = getattr(func, '__call__', func) - ismethod = inspect.ismethod(func) + if inspect.isclass(func): + try: + func = func.__init__ + except AttributeError: + return () + ismethod = True + else: + if not inspect.isfunction(func) and not inspect.ismethod(func): + func = getattr(func, '__call__', func) + ismethod = inspect.ismethod(func) rawcode = py.code.getrawcode(func) try: x = rawcode.co_varnames[ismethod:rawcode.co_argcount] except AttributeError: x = () - py.builtin._getfuncdict(func)['_varnames'] = x + try: + cache["_varnames"] = x + except TypeError: + pass return x class HookRelay: diff -r f9e200cee8f7ec364af514d38f5f8865509fa227 -r 282e0cca851c58e64ddaeeb56907f4376927ac13 testing/test_core.py --- a/testing/test_core.py +++ b/testing/test_core.py @@ -438,6 +438,15 @@ assert varnames(A().f) == ('y',) assert varnames(B()) == ('z',) +def test_varnames_class(): + class C: + def __init__(self, x): + pass + class D: + pass + assert varnames(C) == ("x",) + assert varnames(D) == () + class TestMultiCall: def test_uses_copy_of_methods(self): l = [lambda: 42] @@ -654,8 +663,7 @@ def test_importplugin_issue375(testdir): testdir.makepyfile(qwe="import aaaa") - with pytest.raises(ImportError) as excinfo: - importplugin("qwe") + excinfo = pytest.raises(ImportError, lambda: importplugin("qwe")) assert "qwe" not in str(excinfo.value) assert "aaaa" in str(excinfo.value) 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 Nov 19 23:22:39 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Tue, 19 Nov 2013 22:22:39 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix ordering when mock.patch or other standard decorator-wrappings Message-ID: <20131119222239.614.81764@app04.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/f0e54be5f8ea/ Changeset: f0e54be5f8ea User: hpk42 Date: 2013-11-19 23:22:27 Summary: fix ordering when mock.patch or other standard decorator-wrappings are used with test methods. This fixues issue346. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. Affected #: 4 files diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r f0e54be5f8eacf91a33361dd2772a2cfe5a1289f CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ Unreleased ----------------------------------- +- fix ordering when mock.patch or other standard decorator-wrappings + are used with test methods. This fixues issue346. Thanks to + Ronny Pfannschmidt and Donald Stufft for helping to isolate it. + - fix issue384 by removing the trial support code since the unittest compat enhancements allow trial to handle it on its own diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r f0e54be5f8eacf91a33361dd2772a2cfe5a1289f _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -697,11 +697,4 @@ yield x node.ihook.pytest_collectreport(report=rep) -def getfslineno(obj): - # xxx let decorators etc specify a sane ordering - if hasattr(obj, 'place_as'): - obj = obj.place_as - fslineno = py.code.getfslineno(obj) - assert isinstance(fslineno[1], int), obj - return fslineno diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r f0e54be5f8eacf91a33361dd2772a2cfe5a1289f _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -3,7 +3,6 @@ import inspect import sys import pytest -from _pytest.main import getfslineno from _pytest.mark import MarkDecorator from _pytest.monkeypatch import monkeypatch from py._code.code import TerminalRepr @@ -15,6 +14,16 @@ callable = py.builtin.callable +def getfslineno(obj): + # xxx let decorators etc specify a sane ordering + while hasattr(obj, "__wrapped__"): + obj = obj.__wrapped__ + if hasattr(obj, 'place_as'): + obj = obj.place_as + fslineno = py.code.getfslineno(obj) + assert isinstance(fslineno[1], int), obj + return fslineno + def getimfunc(func): try: return func.__func__ diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r f0e54be5f8eacf91a33361dd2772a2cfe5a1289f testing/python/integration.py --- a/testing/python/integration.py +++ b/testing/python/integration.py @@ -1,5 +1,6 @@ import pytest from _pytest import runner +from _pytest import python class TestOEJSKITSpecials: def test_funcarg_non_pycollectobj(self, testdir): # rough jstests usage @@ -55,6 +56,20 @@ assert not clscol.funcargs +def test_wrapped_getfslineno(): + def func(): + pass + def wrap(f): + func.__wrapped__ = f + func.patchings = ["qwe"] + return func + @wrap + def wrapped_func(x, y, z): + pass + fs, lineno = python.getfslineno(wrapped_func) + fs2, lineno2 = python.getfslineno(wrap) + assert lineno > lineno2, "getfslineno does not unwrap correctly" + class TestMockDecoration: def test_wrapped_getfuncargnames(self): from _pytest.python import getfuncargnames @@ -119,6 +134,28 @@ reprec = testdir.inline_run() reprec.assertoutcome(passed=2) + def test_mock_sorting(self, testdir): + pytest.importorskip("mock", "1.0.1") + testdir.makepyfile(""" + import os + import mock + + @mock.patch("os.path.abspath") + def test_one(abspath): + pass + @mock.patch("os.path.abspath") + def test_two(abspath): + pass + @mock.patch("os.path.abspath") + def test_three(abspath): + pass + """) + reprec = testdir.inline_run() + calls = reprec.getreports("pytest_runtest_logreport") + calls = [x for x in calls if x.when == "call"] + names = [x.nodeid.split("::")[-1] for x in calls] + assert names == ["test_one", "test_two", "test_three"] + class TestReRunTests: def test_rerun(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 notifications at travis-ci.org Wed Nov 20 12:43:47 2013 From: notifications at travis-ci.org (Travis CI) Date: Wed, 20 Nov 2013 11:43:47 +0000 Subject: [Pytest-commit] [Fixed] hpk42/pytest#49 (master - cd464c6) Message-ID: <528ca0737fee0_2377a309563@87c71a54-8980-4917-b4a6-8d47b86fe576.mail> Build Update for hpk42/pytest ------------------------------------- Build: #49 Status: Fixed Duration: 6 minutes and 30 seconds Commit: cd464c6 (master) Author: holger krekel Message: fix ordering when mock.patch or other standard decorator-wrappings are used with test methods. This fixues issue346. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. View the changeset: https://github.com/hpk42/pytest/compare/f5003f2a1fef...cd464c69e9b2 View the full build log and details: https://travis-ci.org/hpk42/pytest/builds/14246838 -- You can configure recipients for build notifications in your .travis.yml file. See http://about.travis-ci.org/docs/user/build-configuration -------------- next part -------------- An HTML attachment was scrubbed... URL: From commits-noreply at bitbucket.org Wed Nov 20 15:46:30 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 20 Nov 2013 14:46:30 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: remove testing of xdist+genscript -- doesn't really make sense Message-ID: <20131120144630.14256.92063@app07.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/0907cfd89959/ Changeset: 0907cfd89959 User: hpk42 Date: 2013-11-20 15:46:23 Summary: remove testing of xdist+genscript -- doesn't really make sense because for installing pytest-xdist you need pytest installed which defeats the purpose of genscript. Affected #: 1 file diff -r f0e54be5f8eacf91a33361dd2772a2cfe5a1289f -r 0907cfd89959be68e6efe109ab4e12f628fcde90 testing/test_genscript.py --- a/testing/test_genscript.py +++ b/testing/test_genscript.py @@ -35,14 +35,3 @@ result = standalone.run(anypython, testdir, p) assert result.ret != 0 -def test_rundist(testdir, pytestconfig, standalone): - pytestconfig.pluginmanager.skipifmissing("xdist") - testdir.makepyfile(""" - def test_one(): - pass - """) - result = standalone.run(sys.executable, testdir, '-n', '3') - assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) 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 Nov 20 16:04:00 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 20 Nov 2013 15:04:00 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: add py33-xdist to tox testing Message-ID: <20131120150400.8886.27462@app07.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/1b0415c6d1f5/ Changeset: 1b0415c6d1f5 User: hpk42 Date: 2013-11-20 16:03:55 Summary: add py33-xdist to tox testing Affected #: 1 file diff -r 0907cfd89959be68e6efe109ab4e12f628fcde90 -r 1b0415c6d1f54e6c908190f998ef6e2a5a9a1904 tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] distshare={homedir}/.tox/distshare -envlist=flakes,py25,py26,py27,pypy,py27-nobyte,py32,py33,py27-xdist,trial +envlist=flakes,py25,py26,py27,pypy,py27-nobyte,py32,py33,py27-xdist,py33-xdist,trial [testenv] changedir=testing @@ -33,6 +33,14 @@ py.test -n3 -rfsxX \ --junitxml={envlogdir}/junit-{envname}.xml testing +[testenv:py33-xdist] +changedir=. +basepython=python3.3 +deps={[testenv:py27-xdist]deps} +commands= + py.test -n3 -rfsxX \ + --junitxml={envlogdir}/junit-{envname}.xml testing + [testenv:py27-nobyte] changedir=. basepython=python2.7 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 Nov 20 20:01:09 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 20 Nov 2013 19:01:09 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: removing pexpect from general dependencies because Message-ID: <20131120190109.26868.97454@app13.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/4b53ddc11152/ Changeset: 4b53ddc11152 User: hpk42 Date: 2013-11-20 20:00:59 Summary: removing pexpect from general dependencies because it doesn't install on windows anymore. Instead to specific configurations for pexpect on py27 and py33 which only call the tests that need it. Affected #: 1 file diff -r 1b0415c6d1f54e6c908190f998ef6e2a5a9a1904 -r 4b53ddc1115215d533e29f500a2694b713e3f785 tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,11 @@ [tox] distshare={homedir}/.tox/distshare -envlist=flakes,py25,py26,py27,pypy,py27-nobyte,py32,py33,py27-xdist,py33-xdist,trial +envlist=flakes,py25,py26,py27,pypy,py27-pexpect,py33-pexpect,py27-nobyte,py32,py33,py27-xdist,py33-xdist,trial [testenv] changedir=testing commands= py.test --lsof -rfsxX --junitxml={envlogdir}/junit-{envname}.xml [] deps= - pexpect nose [testenv:genscript] @@ -41,6 +40,20 @@ py.test -n3 -rfsxX \ --junitxml={envlogdir}/junit-{envname}.xml testing +[testenv:py27-pexpect] +changedir=testing +basepython=python2.7 +deps=pexpect +commands= + py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py + +[testenv:py33-pexpect] +changedir=testing +basepython=python2.7 +deps={[testenv:py27-pexpect]deps} +commands= + py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py + [testenv:py27-nobyte] changedir=. basepython=python2.7 @@ -55,7 +68,6 @@ [testenv:trial] changedir=. deps=twisted - pexpect commands= py.test -rsxf \ --junitxml={envlogdir}/junit-{envname}.xml {posargs:testing/test_unittest.py} 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 Nov 20 21:04:25 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Wed, 20 Nov 2013 20:04:25 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix issue221 - handle importing of namespace-package with no Message-ID: <20131120200425.27851.49181@app10.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/51a962aea48e/ Changeset: 51a962aea48e User: hpk42 Date: 2013-11-20 21:04:19 Summary: fix issue221 - handle importing of namespace-package with no __init__.py properly. (This is a commit after the fix -- the original issue steps for failure cannot be reproduced anymore). Affected #: 2 files diff -r 4b53ddc1115215d533e29f500a2694b713e3f785 -r 51a962aea48e28953f2931aab62e5c1f1dc3848d CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -56,6 +56,9 @@ although it's not needed by pytest itself atm. Also fix caching. Fixes issue376. +- fix issue221 - handle importing of namespace-package with no + __init__.py properly. + Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r 4b53ddc1115215d533e29f500a2694b713e3f785 -r 51a962aea48e28953f2931aab62e5c1f1dc3848d extra/get_issues.py --- a/extra/get_issues.py +++ b/extra/get_issues.py @@ -66,7 +66,8 @@ if __name__ == "__main__": import argparse parser = argparse.ArgumentParser("process bitbucket issues") - parser.add_argument("--refresh", help="invalidate cache, refresh issues") + parser.add_argument("--refresh", action="store_true", + help="invalidate cache, refresh issues") parser.add_argument("--cache", action="store", default="issues.json", help="cache file") args = parser.parse_args() 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 Nov 21 02:39:20 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 01:39:20 -0000 Subject: [Pytest-commit] commit/pytest: 4 new changesets Message-ID: <20131121013920.25097.6245@app08.ash-private.bitbucket.org> 4 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/aeb2f224d691/ Changeset: aeb2f224d691 User: flub Date: 2013-11-19 18:26:18 Summary: Ensure all finalizations are run when one fails Fixes issue287. Affected #: 3 files diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r aeb2f224d69130ef99a4412bd4b1c64b66561420 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ Unreleased ----------------------------------- +- fix issue287 by running all finalizers but saving the exception + from the last failing finalizer and re-raising it so teardown will + still have failed. + - fix issue384 by removing the trial support code since the unittest compat enhancements allow trial to handle it on its own diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r aeb2f224d69130ef99a4412bd4b1c64b66561420 _pytest/runner.py --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -328,9 +328,17 @@ def _callfinalizers(self, colitem): finalizers = self._finalizers.pop(colitem, None) + exc = None while finalizers: fin = finalizers.pop() - fin() + try: + fin() + except KeyboardInterrupt: + raise + except: + exc = py.std.sys.exc_info() + if exc: + py.builtin._reraise(*exc) def _teardown_with_finalization(self, colitem): self._callfinalizers(colitem) diff -r 282e0cca851c58e64ddaeeb56907f4376927ac13 -r aeb2f224d69130ef99a4412bd4b1c64b66561420 testing/test_runner.py --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -43,6 +43,21 @@ pytest.raises(ValueError, lambda: ss.prepare(item)) pytest.raises(ValueError, lambda: ss.prepare(item)) + def test_teardown_multiple_one_fails(self, testdir): + r = [] + def fin1(): r.append('fin1') + def fin2(): raise Exception('oops') + def fin3(): r.append('fin3') + item = testdir.getitem("def test_func(): pass") + ss = runner.SetupState() + ss.addfinalizer(fin1, item) + ss.addfinalizer(fin2, item) + ss.addfinalizer(fin3, item) + with pytest.raises(Exception) as err: + ss._callfinalizers(item) + assert err.value.args == ('oops',) + assert r == ['fin3', 'fin1'] + class BaseFunctionalTests: def test_passfunction(self, testdir): https://bitbucket.org/hpk42/pytest/commits/20285c639280/ Changeset: 20285c639280 User: flub Date: 2013-11-21 02:15:24 Summary: Re-raise the first exception instead of the last This will make more sense if multiple fixtures depend on each other. It would be better if all exceptions could be shown however. Also depend on python 2.5+ exception hierarchy and use sys module directly. Affected #: 2 files diff -r aeb2f224d69130ef99a4412bd4b1c64b66561420 -r 20285c639280ff58255ade382b7648725fa637b0 _pytest/runner.py --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -333,10 +333,11 @@ fin = finalizers.pop() try: fin() - except KeyboardInterrupt: - raise - except: - exc = py.std.sys.exc_info() + except Exception: + # XXX Only first exception will be seen by user, + # ideally all should be reported. + if not exc: + exc = sys.exc_info() if exc: py.builtin._reraise(*exc) diff -r aeb2f224d69130ef99a4412bd4b1c64b66561420 -r 20285c639280ff58255ade382b7648725fa637b0 testing/test_runner.py --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -58,6 +58,19 @@ assert err.value.args == ('oops',) assert r == ['fin3', 'fin1'] + def test_teardown_multiple_fail(self, testdir): + # Ensure the first exception is the one which is re-raised. + # Ideally both would be reported however. + def fin1(): raise Exception('oops1') + def fin2(): raise Exception('oops2') + item = testdir.getitem("def test_func(): pass") + ss = runner.SetupState() + ss.addfinalizer(fin1, item) + ss.addfinalizer(fin2, item) + with pytest.raises(Exception) as err: + ss._callfinalizers(item) + assert err.value.args == ('oops2',) + class BaseFunctionalTests: def test_passfunction(self, testdir): https://bitbucket.org/hpk42/pytest/commits/d1087fb4853f/ Changeset: d1087fb4853f User: flub Date: 2013-11-21 02:16:49 Summary: Merge Affected #: 7 files diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,9 @@ - fix issue287 by running all finalizers but saving the exception from the last failing finalizer and re-raising it so teardown will still have failed. +- fix ordering when mock.patch or other standard decorator-wrappings + are used with test methods. This fixues issue346. Thanks to + Ronny Pfannschmidt and Donald Stufft for helping to isolate it. - fix issue384 by removing the trial support code since the unittest compat enhancements allow diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f _pytest/main.py --- a/_pytest/main.py +++ b/_pytest/main.py @@ -697,11 +697,4 @@ yield x node.ihook.pytest_collectreport(report=rep) -def getfslineno(obj): - # xxx let decorators etc specify a sane ordering - if hasattr(obj, 'place_as'): - obj = obj.place_as - fslineno = py.code.getfslineno(obj) - assert isinstance(fslineno[1], int), obj - return fslineno diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -3,7 +3,6 @@ import inspect import sys import pytest -from _pytest.main import getfslineno from _pytest.mark import MarkDecorator from _pytest.monkeypatch import monkeypatch from py._code.code import TerminalRepr @@ -15,6 +14,16 @@ callable = py.builtin.callable +def getfslineno(obj): + # xxx let decorators etc specify a sane ordering + while hasattr(obj, "__wrapped__"): + obj = obj.__wrapped__ + if hasattr(obj, 'place_as'): + obj = obj.place_as + fslineno = py.code.getfslineno(obj) + assert isinstance(fslineno[1], int), obj + return fslineno + def getimfunc(func): try: return func.__func__ diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f extra/get_issues.py --- a/extra/get_issues.py +++ b/extra/get_issues.py @@ -66,7 +66,8 @@ if __name__ == "__main__": import argparse parser = argparse.ArgumentParser("process bitbucket issues") - parser.add_argument("--refresh", help="invalidate cache, refresh issues") + parser.add_argument("--refresh", action="store_true", + help="invalidate cache, refresh issues") parser.add_argument("--cache", action="store", default="issues.json", help="cache file") args = parser.parse_args() diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f testing/python/integration.py --- a/testing/python/integration.py +++ b/testing/python/integration.py @@ -1,5 +1,6 @@ import pytest from _pytest import runner +from _pytest import python class TestOEJSKITSpecials: def test_funcarg_non_pycollectobj(self, testdir): # rough jstests usage @@ -55,6 +56,20 @@ assert not clscol.funcargs +def test_wrapped_getfslineno(): + def func(): + pass + def wrap(f): + func.__wrapped__ = f + func.patchings = ["qwe"] + return func + @wrap + def wrapped_func(x, y, z): + pass + fs, lineno = python.getfslineno(wrapped_func) + fs2, lineno2 = python.getfslineno(wrap) + assert lineno > lineno2, "getfslineno does not unwrap correctly" + class TestMockDecoration: def test_wrapped_getfuncargnames(self): from _pytest.python import getfuncargnames @@ -119,6 +134,28 @@ reprec = testdir.inline_run() reprec.assertoutcome(passed=2) + def test_mock_sorting(self, testdir): + pytest.importorskip("mock", "1.0.1") + testdir.makepyfile(""" + import os + import mock + + @mock.patch("os.path.abspath") + def test_one(abspath): + pass + @mock.patch("os.path.abspath") + def test_two(abspath): + pass + @mock.patch("os.path.abspath") + def test_three(abspath): + pass + """) + reprec = testdir.inline_run() + calls = reprec.getreports("pytest_runtest_logreport") + calls = [x for x in calls if x.when == "call"] + names = [x.nodeid.split("::")[-1] for x in calls] + assert names == ["test_one", "test_two", "test_three"] + class TestReRunTests: def test_rerun(self, testdir): diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f testing/test_genscript.py --- a/testing/test_genscript.py +++ b/testing/test_genscript.py @@ -35,14 +35,3 @@ result = standalone.run(anypython, testdir, p) assert result.ret != 0 -def test_rundist(testdir, pytestconfig, standalone): - pytestconfig.pluginmanager.skipifmissing("xdist") - testdir.makepyfile(""" - def test_one(): - pass - """) - result = standalone.run(sys.executable, testdir, '-n', '3') - assert result.ret == 0 - result.stdout.fnmatch_lines([ - "*1 passed*", - ]) diff -r 20285c639280ff58255ade382b7648725fa637b0 -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,11 @@ [tox] distshare={homedir}/.tox/distshare -envlist=flakes,py25,py26,py27,pypy,py27-nobyte,py32,py33,py27-xdist,trial +envlist=flakes,py25,py26,py27,pypy,py27-pexpect,py33-pexpect,py27-nobyte,py32,py33,py27-xdist,py33-xdist,trial [testenv] changedir=testing commands= py.test --lsof -rfsxX --junitxml={envlogdir}/junit-{envname}.xml [] deps= - pexpect nose [testenv:genscript] @@ -33,6 +32,28 @@ py.test -n3 -rfsxX \ --junitxml={envlogdir}/junit-{envname}.xml testing +[testenv:py33-xdist] +changedir=. +basepython=python3.3 +deps={[testenv:py27-xdist]deps} +commands= + py.test -n3 -rfsxX \ + --junitxml={envlogdir}/junit-{envname}.xml testing + +[testenv:py27-pexpect] +changedir=testing +basepython=python2.7 +deps=pexpect +commands= + py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py + +[testenv:py33-pexpect] +changedir=testing +basepython=python2.7 +deps={[testenv:py27-pexpect]deps} +commands= + py.test -rfsxX test_pdb.py test_terminal.py test_unittest.py + [testenv:py27-nobyte] changedir=. basepython=python2.7 @@ -47,7 +68,6 @@ [testenv:trial] changedir=. deps=twisted - pexpect commands= py.test -rsxf \ --junitxml={envlogdir}/junit-{envname}.xml {posargs:testing/test_unittest.py} https://bitbucket.org/hpk42/pytest/commits/6333d041d8dd/ Changeset: 6333d041d8dd User: flub Date: 2013-11-21 02:37:48 Summary: Fixup changelog This seems to have gone wrong in the merge. Affected #: 1 file diff -r d1087fb4853fe5bb65bb1f215cf88ee188467a4f -r 6333d041d8dd3ba39e2ca32e07d2354c8525cfdf CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ - fix issue287 by running all finalizers but saving the exception from the last failing finalizer and re-raising it so teardown will still have failed. + - fix ordering when mock.patch or other standard decorator-wrappings are used with test methods. This fixues issue346. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. @@ -59,6 +60,9 @@ although it's not needed by pytest itself atm. Also fix caching. Fixes issue376. +- fix issue221 - handle importing of namespace-package with no + __init__.py properly. + Changes between 2.4.1 and 2.4.2 ----------------------------------- 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 Nov 21 07:46:59 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 06:46:59 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: some amendments/fixes to changelog Message-ID: <20131121064659.25455.49132@app11.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/2a1cf904d5b7/ Changeset: 2a1cf904d5b7 User: hpk42 Date: 2013-11-21 07:46:53 Summary: some amendments/fixes to changelog Affected #: 1 file diff -r 6333d041d8dd3ba39e2ca32e07d2354c8525cfdf -r 2a1cf904d5b7854bbf4af9b30adb618a94f466c0 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -2,11 +2,13 @@ ----------------------------------- - fix issue287 by running all finalizers but saving the exception - from the last failing finalizer and re-raising it so teardown will - still have failed. + from the first failing finalizer and re-raising it so teardown will + still have failed. We reraise the first failing exception because + it might be the cause for other finalizers to fail. - fix ordering when mock.patch or other standard decorator-wrappings - are used with test methods. This fixues issue346. Thanks to + are used with test methods. This fixues issue346 and should + help with random "xdist" collection failures. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. - fix issue384 by removing the trial support code 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 Nov 21 09:28:08 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 08:28:08 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: move two fixture test modules into bigger testing/python/fixture.py Message-ID: <20131121082808.13565.9196@app03.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/fa4799179a30/ Changeset: fa4799179a30 User: hpk42 Date: 2013-11-21 09:26:45 Summary: move two fixture test modules into bigger testing/python/fixture.py Affected #: 3 files diff -r 2a1cf904d5b7854bbf4af9b30adb618a94f466c0 -r fa4799179a30f1108d9472b5aad9139e5be6deab testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -2,7 +2,7 @@ from _pytest import python as funcargs from _pytest.python import FixtureLookupError from _pytest.pytester import get_public_names - +from textwrap import dedent def test_getfuncargnames(): def f(): pass @@ -1738,6 +1738,60 @@ """) assert "error" not in result.stdout.str() + def test_fixture_finalizer(self, testdir): + testdir.makeconftest(""" + import pytest + import sys + + @pytest.fixture + def browser(request): + + def finalize(): + sys.stdout.write('Finalized') + request.addfinalizer(finalize) + return {} + """) + b = testdir.mkdir("subdir") + b.join("test_overriden_fixture_finalizer.py").write(dedent(""" + import pytest + @pytest.fixture + def browser(browser): + browser['visited'] = True + return browser + + def test_browser(browser): + assert browser['visited'] is True + """)) + reprec = testdir.runpytest("-s") + for test in ['test_browser']: + reprec.stdout.fnmatch_lines('*Finalized*') + + def test_class_scope_with_normal_tests(self, testdir): + testpath = testdir.makepyfile(""" + import pytest + + class Box: + value = 0 + + @pytest.fixture(scope='class') + def a(request): + Box.value += 1 + return Box.value + + def test_a(a): + assert a == 1 + + class Test1: + def test_b(self, a): + assert a == 2 + + class Test2: + def test_c(self, a): + assert a == 3""") + reprec = testdir.inline_run(testpath) + for test in ['test_a', 'test_b', 'test_c']: + assert reprec.matchreport(test).passed + def test_parametrize_separated_lifecycle(self, testdir): testdir.makepyfile(""" import pytest diff -r 2a1cf904d5b7854bbf4af9b30adb618a94f466c0 -r fa4799179a30f1108d9472b5aad9139e5be6deab testing/test_fixture_finalizer.py --- a/testing/test_fixture_finalizer.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Tests for fixtures with different scoping.""" -import py.code - - -def test_fixture_finalizer(testdir): - testdir.makeconftest(""" - import pytest - import sys - - @pytest.fixture - def browser(request): - - def finalize(): - sys.stdout.write('Finalized') - request.addfinalizer(finalize) - return {} - """) - b = testdir.mkdir("subdir") - b.join("test_overriden_fixture_finalizer.py").write(py.code.Source(""" - import pytest - @pytest.fixture - def browser(browser): - browser['visited'] = True - return browser - - def test_browser(browser): - assert browser['visited'] is True - """)) - reprec = testdir.runpytest("-s") - for test in ['test_browser']: - reprec.stdout.fnmatch_lines('*Finalized*') diff -r 2a1cf904d5b7854bbf4af9b30adb618a94f466c0 -r fa4799179a30f1108d9472b5aad9139e5be6deab testing/test_fixture_scope.py --- a/testing/test_fixture_scope.py +++ /dev/null @@ -1,28 +0,0 @@ -"""Tests for fixtures with different scoping.""" - - -def test_class_scope_with_normal_tests(testdir): - testpath = testdir.makepyfile(""" - import pytest - - class Box: - value = 0 - - @pytest.fixture(scope='class') - def a(request): - Box.value += 1 - return Box.value - - def test_a(a): - assert a == 1 - - class Test1: - def test_b(self, a): - assert a == 2 - - class Test2: - def test_c(self, a): - assert a == 3""") - reprec = testdir.inline_run(testpath) - for test in ['test_a', 'test_b', 'test_c']: - assert reprec.matchreport(test).passed 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 Nov 21 09:42:30 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 08:42:30 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: addresses issue246: add a test for module/function scope that shows that Message-ID: <20131121084230.17852.79807@app02.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/dcbe5c702399/ Changeset: dcbe5c702399 User: hpk42 Date: 2013-11-21 09:42:24 Summary: addresses issue246: add a test for module/function scope that shows that finalizer ordering is wrong. Affected #: 1 file diff -r fa4799179a30f1108d9472b5aad9139e5be6deab -r dcbe5c70239930fafdc762d0a427f8814c1d4799 testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1820,7 +1820,6 @@ assert l[3] == l[4] == 2 assert l[5] == "fin2" - def test_parametrize_function_scoped_finalizers_called(self, testdir): testdir.makepyfile(""" import pytest @@ -1843,6 +1842,39 @@ reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=5) + + @pytest.mark.issue246 + @pytest.mark.xfail(reason="per-arg finalization does not respect order") + @pytest.mark.parametrize("scope", ["function", "module"]) + def test_finalizer_order_on_parametrization(self, scope, testdir): + testdir.makepyfile(""" + import pytest + l = [] + + @pytest.fixture(scope=%(scope)r, params=["1"]) + def fix1(request): + return request.param + + @pytest.fixture(scope=%(scope)r) + def fix2(request, base): + def cleanup_fix2(): + assert not l, "base should not have been finalized" + request.addfinalizer(cleanup_fix2) + + @pytest.fixture(scope=%(scope)r) + def base(request, fix1): + def cleanup_base(): + l.append("fin_base") + request.addfinalizer(cleanup_base) + + def test_baz(base, fix2): + pass + """ % {"scope": scope}) + reprec = testdir.inline_run() + reprec.assertoutcome(passed=1) + l = reprec.getcall("pytest_runtest_call").item.module.l + assert l == ["test", "fin_fix2", "fin_fix3"] + def test_parametrize_setup_function(self, testdir): 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 Thu Nov 21 12:31:30 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 11:31:30 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131121113130.1659.38830@app06.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/05ea7094569f/ Changeset: 05ea7094569f User: hpk42 Date: 2013-11-21 12:21:52 Summary: refactor internal FixtureRequest handling to avoid monkeypatching. One of the positive user-facing effects is that the "request" object can now be used in closures. Affected #: 3 files diff -r dcbe5c70239930fafdc762d0a427f8814c1d4799 -r 05ea7094569fe3f3098fa8e965014d236bc3c907 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -65,6 +65,10 @@ - fix issue221 - handle importing of namespace-package with no __init__.py properly. +- refactor internal FixtureRequest handling to avoid monkeypatching. + One of the positive user-facing effects is that the "request" object + can now be used in closures. + Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r dcbe5c70239930fafdc762d0a427f8814c1d4799 -r 05ea7094569fe3f3098fa8e965014d236bc3c907 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -4,7 +4,6 @@ import sys import pytest from _pytest.mark import MarkDecorator -from _pytest.monkeypatch import monkeypatch from py._code.code import TerminalRepr import _pytest @@ -1083,14 +1082,12 @@ self.fixturename = None #: Scope string, one of "function", "cls", "module", "session" self.scope = "function" - self.getparent = pyfuncitem.getparent self._funcargs = self._pyfuncitem.funcargs.copy() - self._fixtureinfo = fi = pyfuncitem._fixtureinfo - self._arg2fixturedefs = fi.name2fixturedefs + fixtureinfo = pyfuncitem._fixtureinfo + self._arg2fixturedefs = fixtureinfo.name2fixturedefs self._arg2index = {} - self.fixturenames = self._fixtureinfo.names_closure + self.fixturenames = fixtureinfo.names_closure self._fixturemanager = pyfuncitem.session._fixturemanager - self._parentid = pyfuncitem.parent.nodeid self._fixturestack = [] @property @@ -1104,7 +1101,7 @@ # we arrive here because of a getfuncargvalue(argname) usage which # was naturally not knowable at parsing/collection time fixturedefs = self._fixturemanager.getfixturedefs( - argname, self._parentid) + argname, self._pyfuncitem.parent.nodeid) self._arg2fixturedefs[argname] = fixturedefs # fixturedefs is immutable so we maintain a decreasing index index = self._arg2index.get(argname, 0) - 1 @@ -1270,29 +1267,21 @@ return fixturedef.cached_result # set by fixturedef.execute() except AttributeError: pass - - # prepare request fixturename and param attributes before - # calling into fixture function + # prepare a subrequest object before calling fixture function + # (latter managed by fixturedef) argname = fixturedef.argname node = self._pyfuncitem - mp = monkeypatch() - mp.setattr(self, 'fixturename', argname) + scope = fixturedef.scope try: param = node.callspec.getparam(argname) except (AttributeError, ValueError): - pass + param = notset else: - mp.setattr(self, 'param', param, raising=False) - - # if a parametrize invocation set a scope it will override - # the static scope defined with the fixture function - scope = fixturedef.scope - try: - paramscopenum = node.callspec._arg2scopenum[argname] - except (KeyError, AttributeError): - pass - else: - if paramscopenum != scopenum_subfunction: + # if a parametrize invocation set a scope it will override + # the static scope defined with the fixture function + paramscopenum = node.callspec._arg2scopenum.get(argname) + if paramscopenum is not None and \ + paramscopenum != scopenum_subfunction: scope = scopes[paramscopenum] # check if a higher-level scoped fixture accesses a lower level one @@ -1302,31 +1291,29 @@ # try to report something helpful lines = self._factorytraceback() raise ScopeMismatchError("You tried to access the %r scoped " - "funcarg %r with a %r scoped request object, " + "fixture %r with a %r scoped request object, " "involved factories\n%s" %( (scope, argname, self.scope, "\n".join(lines)))) __tracebackhide__ = False - mp.setattr(self, "scope", scope) + else: + scope = self.scope - # route request.addfinalizer to fixturedef - mp.setattr(self, "addfinalizer", fixturedef.addfinalizer) - + subrequest = SubRequest(self, argname, scope, param, + fixturedef.addfinalizer) try: # perform the fixture call - val = fixturedef.execute(request=self) + val = fixturedef.execute(request=subrequest) finally: # if the fixture function failed it might still have # registered finalizers so we can register - # prepare finalization according to scope # (XXX analyse exact finalizing mechanics / cleanup) self.session._setupstate.addfinalizer(fixturedef.finish, - self.node) + subrequest.node) self._fixturemanager.addargfinalizer(fixturedef.finish, argname) for subargname in fixturedef.argnames: # XXX all deps? self._fixturemanager.addargfinalizer(fixturedef.finish, subargname) - mp.undo() return val def _factorytraceback(self): @@ -1358,6 +1345,28 @@ def __repr__(self): return "" %(self.node) +notset = object() +class SubRequest(FixtureRequest): + """ a sub request for handling getting a fixture from a + test function/fixture. """ + def __init__(self, request, argname, scope, param, addfinalizer): + self._parent_request = request + self.fixturename = argname + if param is not notset: + self.param = param + self.scope = scope + self.addfinalizer = addfinalizer + self._pyfuncitem = request._pyfuncitem + self._funcargs = request._funcargs + self._arg2fixturedefs = request._arg2fixturedefs + self._arg2index = request._arg2index + self.fixturenames = request.fixturenames + self._fixturemanager = request._fixturemanager + self._fixturestack = request._fixturestack + + def __repr__(self): + return "" % (self.fixturename, self.node) + class ScopeMismatchError(Exception): """ A fixture function tries to use a different fixture function which which has a lower scope (e.g. a Session one calls a function one) @@ -1399,8 +1408,8 @@ fm = self.request._fixturemanager available = [] for name, fixturedef in fm._arg2fixturedefs.items(): - faclist = list(fm._matchfactories(fixturedef, - self.request._parentid)) + parentid = self.request._pyfuncitem.parent.nodeid + faclist = list(fm._matchfactories(fixturedef, parentid)) if faclist: available.append(name) msg = "fixture %r not found" % (self.argname,) @@ -1744,7 +1753,6 @@ func() # check neccesity of next commented call self._fixturemanager.removefinalizer(self.finish) - #print "finished", self try: del self.cached_result except AttributeError: diff -r dcbe5c70239930fafdc762d0a427f8814c1d4799 -r 05ea7094569fe3f3098fa8e965014d236bc3c907 testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -473,7 +473,7 @@ assert l == ["module", "function", "class", "function", "method", "function"] """) - reprec = testdir.inline_run() + reprec = testdir.inline_run("-v") reprec.assertoutcome(passed=3) def test_fixtures_sub_subdir_normalize_sep(self, testdir): @@ -1792,6 +1792,20 @@ for test in ['test_a', 'test_b', 'test_c']: assert reprec.matchreport(test).passed + def test_request_is_clean(self, testdir): + testdir.makepyfile(""" + import pytest + l = [] + @pytest.fixture(params=[1, 2]) + def fix(request): + request.addfinalizer(lambda: l.append(request.param)) + def test_fix(fix): + pass + """) + reprec = testdir.inline_run("-s") + l = reprec.getcalls("pytest_runtest_call")[0].item.module.l + assert l == [1,2] + def test_parametrize_separated_lifecycle(self, testdir): testdir.makepyfile(""" import pytest https://bitbucket.org/hpk42/pytest/commits/7c1e760976b2/ Changeset: 7c1e760976b2 User: hpk42 Date: 2013-11-21 12:31:22 Summary: fix py25 compat Affected #: 1 file diff -r 05ea7094569fe3f3098fa8e965014d236bc3c907 -r 7c1e760976b2e7097588da6d7d9cdc892330722f testing/test_runner.py --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -1,3 +1,5 @@ +from __future__ import with_statement + import pytest, py, sys, os from _pytest import runner, 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 Nov 21 13:26:06 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 12:26:06 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131121122606.3438.20957@app01.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/9d36814fac65/ Changeset: 9d36814fac65 User: hpk42 Date: 2013-11-21 12:42:22 Summary: avoid maintaining a fixturestack Affected #: 1 file diff -r 7c1e760976b2e7097588da6d7d9cdc892330722f -r 9d36814fac65ebe65bd1e1e4f6752acfa60339a1 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1298,8 +1298,7 @@ else: scope = self.scope - subrequest = SubRequest(self, argname, scope, param, - fixturedef.addfinalizer) + subrequest = SubRequest(self, scope, param, fixturedef) try: # perform the fixture call val = fixturedef.execute(request=subrequest) @@ -1349,13 +1348,13 @@ class SubRequest(FixtureRequest): """ a sub request for handling getting a fixture from a test function/fixture. """ - def __init__(self, request, argname, scope, param, addfinalizer): + def __init__(self, request, scope, param, fixturedef): self._parent_request = request - self.fixturename = argname + self.fixturename = fixturedef.argname if param is not notset: self.param = param self.scope = scope - self.addfinalizer = addfinalizer + self.addfinalizer = fixturedef.addfinalizer self._pyfuncitem = request._pyfuncitem self._funcargs = request._funcargs self._arg2fixturedefs = request._arg2fixturedefs https://bitbucket.org/hpk42/pytest/commits/1e714f46ad69/ Changeset: 1e714f46ad69 User: hpk42 Date: 2013-11-21 13:15:32 Summary: remove _fixturestack attribute now that we have a proper request->subrequest->subrequest chain. Affected #: 1 file diff -r 9d36814fac65ebe65bd1e1e4f6752acfa60339a1 -r 1e714f46ad69bbb150b53ddca1df97c823d650c8 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -10,6 +10,7 @@ cutdir = py.path.local(_pytest.__file__).dirpath() NoneType = type(None) +NOTSET = object() callable = py.builtin.callable @@ -943,18 +944,18 @@ # # the basic py.test Function item # -_dummy = object() + class Function(FunctionMixin, pytest.Item, FuncargnamesCompatAttr): """ a Function Item is responsible for setting up and executing a Python test function. """ _genid = None def __init__(self, name, parent, args=None, config=None, - callspec=None, callobj=_dummy, keywords=None, session=None): + callspec=None, callobj=NOTSET, keywords=None, session=None): super(Function, self).__init__(name, parent, config=config, session=session) self._args = args - if callobj is not _dummy: + if callobj is not NOTSET: self.obj = callobj for name, val in (py.builtin._getfuncdict(self.obj) or {}).items(): @@ -1088,7 +1089,6 @@ self._arg2index = {} self.fixturenames = fixtureinfo.names_closure self._fixturemanager = pyfuncitem.session._fixturemanager - self._fixturestack = [] @property def node(self): @@ -1254,13 +1254,20 @@ if argname == "request": return self raise - self._fixturestack.append(fixturedef) - try: - result = self._getfuncargvalue(fixturedef) - self._funcargs[argname] = result - return result - finally: - self._fixturestack.pop() + result = self._getfuncargvalue(fixturedef) + self._funcargs[argname] = result + return result + + def _get_fixturestack(self): + current = self + l = [] + while 1: + fixturedef = getattr(current, "_fixturedef", None) + if fixturedef is None: + l.reverse() + return l + l.append(fixturedef) + current = current._parent_request def _getfuncargvalue(self, fixturedef): try: @@ -1275,7 +1282,7 @@ try: param = node.callspec.getparam(argname) except (AttributeError, ValueError): - param = notset + param = NOTSET else: # if a parametrize invocation set a scope it will override # the static scope defined with the fixture function @@ -1284,21 +1291,20 @@ paramscopenum != scopenum_subfunction: scope = scopes[paramscopenum] + subrequest = SubRequest(self, scope, param, fixturedef) + # check if a higher-level scoped fixture accesses a lower level one if scope is not None: __tracebackhide__ = True if scopemismatch(self.scope, scope): # try to report something helpful - lines = self._factorytraceback() + lines = subrequest._factorytraceback() raise ScopeMismatchError("You tried to access the %r scoped " "fixture %r with a %r scoped request object, " "involved factories\n%s" %( (scope, argname, self.scope, "\n".join(lines)))) __tracebackhide__ = False - else: - scope = self.scope - subrequest = SubRequest(self, scope, param, fixturedef) try: # perform the fixture call val = fixturedef.execute(request=subrequest) @@ -1317,7 +1323,7 @@ def _factorytraceback(self): lines = [] - for fixturedef in self._fixturestack: + for fixturedef in self._get_fixturestack(): factory = fixturedef.func fs, lineno = getfslineno(factory) p = self._pyfuncitem.session.fspath.bestrelpath(fs) @@ -1344,16 +1350,17 @@ def __repr__(self): return "" %(self.node) -notset = object() + class SubRequest(FixtureRequest): """ a sub request for handling getting a fixture from a test function/fixture. """ def __init__(self, request, scope, param, fixturedef): self._parent_request = request self.fixturename = fixturedef.argname - if param is not notset: + if param is not NOTSET: self.param = param self.scope = scope + self._fixturedef = fixturedef self.addfinalizer = fixturedef.addfinalizer self._pyfuncitem = request._pyfuncitem self._funcargs = request._funcargs @@ -1361,10 +1368,10 @@ self._arg2index = request._arg2index self.fixturenames = request.fixturenames self._fixturemanager = request._fixturemanager - self._fixturestack = request._fixturestack def __repr__(self): - return "" % (self.fixturename, self.node) + return "" % (self.fixturename, self._pyfuncitem) + class ScopeMismatchError(Exception): """ A fixture function tries to use a different fixture function which @@ -1381,7 +1388,7 @@ def __init__(self, argname, request, msg=None): self.argname = argname self.request = request - self.fixturestack = list(request._fixturestack) + self.fixturestack = request._get_fixturestack() self.msg = msg def formatrepr(self): @@ -1619,8 +1626,8 @@ for fin in reversed(l): fin() - def parsefactories(self, node_or_obj, nodeid=_dummy, unittest=False): - if nodeid is not _dummy: + def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False): + if nodeid is not NOTSET: holderobj = node_or_obj else: holderobj = node_or_obj.obj 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 Nov 21 13:53:12 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 12:53:12 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fixed version comparison in pytest.importskip(modname, minverstring) Message-ID: <20131121125312.27229.45637@app13.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/1bd6fe5fd273/ Changeset: 1bd6fe5fd273 User: hpk42 Date: 2013-11-21 13:53:04 Summary: fixed version comparison in pytest.importskip(modname, minverstring) Affected #: 3 files diff -r 1e714f46ad69bbb150b53ddca1df97c823d650c8 -r 1bd6fe5fd2731d9e54c1b5e01ebc411c582f6818 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -69,6 +69,8 @@ One of the positive user-facing effects is that the "request" object can now be used in closures. +- fixed version comparison in pytest.importskip(modname, minverstring) + Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r 1e714f46ad69bbb150b53ddca1df97c823d650c8 -r 1bd6fe5fd2731d9e54c1b5e01ebc411c582f6818 _pytest/runner.py --- a/_pytest/runner.py +++ b/_pytest/runner.py @@ -336,7 +336,7 @@ except Exception: # XXX Only first exception will be seen by user, # ideally all should be reported. - if not exc: + if exc is None: exc = sys.exc_info() if exc: py.builtin._reraise(*exc) @@ -459,25 +459,25 @@ def importorskip(modname, minversion=None): - """ return imported module if it has a higher __version__ than the - optionally specified 'minversion' - otherwise call py.test.skip() - with a message detailing the mismatch. + """ return imported module if it has at least "minversion" as its + __version__ attribute. If no minversion is specified the a skip + is only triggered if the module can not be imported. + Note that version comparison only works with simple version strings + like "1.2.3" but not "1.2.3.dev1" or others. """ __tracebackhide__ = True compile(modname, '', 'eval') # to catch syntaxerrors try: __import__(modname) except ImportError: - py.test.skip("could not import %r" %(modname,)) + skip("could not import %r" %(modname,)) mod = sys.modules[modname] if minversion is None: return mod verattr = getattr(mod, '__version__', None) - if isinstance(minversion, str): - minver = minversion.split(".") - else: - minver = list(minversion) - if verattr is None or verattr.split(".") < minver: - py.test.skip("module %r has __version__ %r, required is: %r" %( - modname, verattr, minversion)) + def intver(verstring): + return [int(x) for x in verstring.split(".")] + if verattr is None or intver(verattr) < intver(minversion): + skip("module %r has __version__ %r, required is: %r" %( + modname, verattr, minversion)) return mod diff -r 1e714f46ad69bbb150b53ddca1df97c823d650c8 -r 1bd6fe5fd2731d9e54c1b5e01ebc411c582f6818 testing/test_runner.py --- a/testing/test_runner.py +++ b/testing/test_runner.py @@ -469,11 +469,11 @@ assert path.purebasename == "test_runner" pytest.raises(SyntaxError, "py.test.importorskip('x y z')") pytest.raises(SyntaxError, "py.test.importorskip('x=y')") - path = importorskip("py", minversion=".".join(py.__version__)) + path = importorskip("py", minversion=py.__version__) mod = py.std.types.ModuleType("hello123") mod.__version__ = "1.3" pytest.raises(pytest.skip.Exception, """ - py.test.importorskip("hello123", minversion="5.0") + py.test.importorskip("hello123", minversion="1.3.1") """) except pytest.skip.Exception: print(py.code.ExceptionInfo()) 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 Nov 21 14:16:52 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 13:16:52 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix ordering of finalizers of parametrized interdependent fixtures. Message-ID: <20131121131652.10440.13667@app03.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/5db368c10f64/ Changeset: 5db368c10f64 User: hpk42 Date: 2013-11-21 14:16:44 Summary: fix ordering of finalizers of parametrized interdependent fixtures. This fixes issue246 as reported. Thanks Ralph Schmitt for the precise failure example. Affected #: 3 files diff -r 1bd6fe5fd2731d9e54c1b5e01ebc411c582f6818 -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,10 @@ since the unittest compat enhancements allow trial to handle it on its own +- fix ordering of finalizers of parametrized interdependent fixtures. + This fixes issue246 as reported. Thanks Ralph Schmitt for the + precise failure example. + - don't hide an ImportError when importing a plugin produces one. fixes issue375. diff -r 1bd6fe5fd2731d9e54c1b5e01ebc411c582f6818 -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -1380,6 +1380,7 @@ scopes = "session module class function subfunction".split() scopenum_subfunction = scopes.index("subfunction") +scopenum_function = scopes.index("function") def scopemismatch(currentscope, newscope): return scopes.index(newscope) > scopes.index(currentscope) @@ -1597,6 +1598,7 @@ # separate parametrized setups items[:] = parametrize_sorted(items, set(), {}, 0) + @pytest.mark.trylast def pytest_runtest_teardown(self, item, nextitem): # XXX teardown needs to be normalized for parametrized and # no-parametrized functions @@ -1620,6 +1622,8 @@ # sort by scope (function scope first, then higher ones) keylist.sort() for (scopenum, name, param) in keylist: + #if -scopenum >= scopenum_function: + # continue # handled by runner.pytest_runtest_teardown item.session._setupstate._callfinalizers((name, param)) l = self._arg2finish.pop(name, None) if l is not None: diff -r 1bd6fe5fd2731d9e54c1b5e01ebc411c582f6818 -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -1810,25 +1810,23 @@ testdir.makepyfile(""" import pytest + l = [] @pytest.fixture(scope="module", params=[1, 2]) def arg(request): - request.config.l = l # to access from outer x = request.param request.addfinalizer(lambda: l.append("fin%s" % x)) return request.param - - l = [] def test_1(arg): l.append(arg) def test_2(arg): l.append(arg) """) - reprec = testdir.inline_run("-v") + reprec = testdir.inline_run("-vs") reprec.assertoutcome(passed=4) - l = reprec.getcalls("pytest_configure")[0].config.l + l = reprec.getcalls("pytest_runtest_call")[0].item.module.l import pprint pprint.pprint(l) - assert len(l) == 6 + #assert len(l) == 6 assert l[0] == l[1] == 1 assert l[2] == "fin1" assert l[3] == l[4] == 2 @@ -1858,8 +1856,7 @@ @pytest.mark.issue246 - @pytest.mark.xfail(reason="per-arg finalization does not respect order") - @pytest.mark.parametrize("scope", ["function", "module"]) + @pytest.mark.parametrize("scope", ["session", "function", "module"]) def test_finalizer_order_on_parametrization(self, scope, testdir): testdir.makepyfile(""" import pytest @@ -1883,11 +1880,11 @@ def test_baz(base, fix2): pass + def test_other(): + pass """ % {"scope": scope}) reprec = testdir.inline_run() - reprec.assertoutcome(passed=1) - l = reprec.getcall("pytest_runtest_call").item.module.l - assert l == ["test", "fin_fix2", "fin_fix3"] + reprec.assertoutcome(passed=2) def test_parametrize_setup_function(self, testdir): testdir.makepyfile(""" 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 Nov 21 14:40:22 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 13:40:22 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: remove an old duplicate marker and use recent pytest mechanism for parametrization Message-ID: <20131121134022.18537.29606@app10.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/4c926afb69fc/ Changeset: 4c926afb69fc User: hpk42 Date: 2013-11-21 14:40:14 Summary: remove an old duplicate marker and use recent pytest mechanism for parametrization Affected #: 6 files diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/conftest.py --- a/testing/conftest.py +++ b/testing/conftest.py @@ -12,10 +12,6 @@ help=("run FD checks if lsof is available")) def pytest_configure(config): - config.addinivalue_line("markers", - "multi(arg=[value1,value2, ...]): call the test function " - "multiple times with arg=value1, then with arg=value2, ... " - ) if config.getvalue("lsof"): try: out = py.process.cmdexec("lsof -p %d" % pid) @@ -57,19 +53,6 @@ check_open_files(item.config) return x -def pytest_generate_tests(metafunc): - multi = getattr(metafunc.function, 'multi', None) - if multi is not None: - assert len(multi.kwargs) == 1 - for name, l in multi.kwargs.items(): - for val in l: - metafunc.addcall(funcargs={name: val}) - elif 'anypython' in metafunc.fixturenames: - for name in ('python2.5', 'python2.6', - 'python2.7', 'python3.2', "python3.3", - 'pypy', 'jython'): - metafunc.addcall(id=name, param=name) - # XXX copied from execnet's conftest.py - needs to be merged winpymap = { 'python2.7': r'C:\Python27\python.exe', @@ -100,7 +83,10 @@ cache[name] = executable return executable -def pytest_funcarg__anypython(request): + at pytest.fixture(params=['python2.5', 'python2.6', + 'python2.7', 'python3.2', "python3.3", + 'pypy', 'jython']) +def anypython(request): name = request.param executable = getexecutable(name) if executable is None: diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_capture.py --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -32,7 +32,7 @@ assert capman._getmethod(config, sub.join("test_hello.py")) == mode @needsosdup - @pytest.mark.multi(method=['no', 'fd', 'sys']) + @pytest.mark.parametrize("method", ['no', 'fd', 'sys']) def test_capturing_basic_api(self, method): capouter = py.io.StdCaptureFD() old = sys.stdout, sys.stderr, sys.stdin @@ -81,7 +81,7 @@ capouter.reset() @pytest.mark.xfail("hasattr(sys, 'pypy_version_info')") - at pytest.mark.multi(method=['fd', 'sys']) + at pytest.mark.parametrize("method", ['fd', 'sys']) def test_capturing_unicode(testdir, method): if sys.version_info >= (3,0): obj = "'b\u00f6y'" @@ -100,7 +100,7 @@ "*1 passed*" ]) - at pytest.mark.multi(method=['fd', 'sys']) + at pytest.mark.parametrize("method", ['fd', 'sys']) def test_capturing_bytes_in_utf8_encoding(testdir, method): testdir.makepyfile(""" def test_unicode(): diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_config.py --- a/testing/test_config.py +++ b/testing/test_config.py @@ -41,7 +41,7 @@ "*tox.ini:2*requires*9.0*actual*" ]) - @pytest.mark.multi(name="setup.cfg tox.ini pytest.ini".split()) + @pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split()) def test_ini_names(self, testdir, name): testdir.tmpdir.join(name).write(py.std.textwrap.dedent(""" [pytest] diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_conftest.py --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -182,7 +182,7 @@ assert conftest.getconftestmodules(sub) == [] assert conftest.getconftestmodules(conf.dirpath()) == [] - at pytest.mark.multi(name='test tests whatever .dotdir'.split()) + at pytest.mark.parametrize("name", 'test tests whatever .dotdir'.split()) def test_setinitial_conftest_subdirs(testdir, name): sub = testdir.mkdir(name) subconftest = sub.ensure("conftest.py") diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_mark.py --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -124,7 +124,7 @@ "*unregisteredmark*not*registered*", ]) - at pytest.mark.multi(spec=[ + at pytest.mark.parametrize("spec", [ ("xyz", ("test_one",)), ("xyz and xyz2", ()), ("xyz2", ("test_two",)), @@ -147,7 +147,7 @@ assert len(passed) == len(passed_result) assert list(passed) == list(passed_result) - at pytest.mark.multi(spec=[ + at pytest.mark.parametrize("spec", [ ("interface", ("test_interface",)), ("not interface", ("test_nointer",)), ]) @@ -172,7 +172,7 @@ assert len(passed) == len(passed_result) assert list(passed) == list(passed_result) - at pytest.mark.multi(spec=[ + at pytest.mark.parametrize("spec", [ ("interface", ("test_interface",)), ("not interface", ("test_nointer",)), ]) diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_unittest.py --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -236,7 +236,7 @@ reprec.assertoutcome(passed=3) - at pytest.mark.multi(type=['Error', 'Failure']) + at pytest.mark.parametrize("type", ['Error', 'Failure']) def test_testcase_adderrorandfailure_defers(testdir, type): testdir.makepyfile(""" from unittest import TestCase @@ -256,7 +256,7 @@ result = testdir.runpytest() assert 'should not raise' not in result.stdout.str() - at pytest.mark.multi(type=['Error', 'Failure']) + at pytest.mark.parametrize("type", ['Error', 'Failure']) def test_testcase_custom_exception_info(testdir, type): testdir.makepyfile(""" from unittest import TestCase 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 Nov 21 15:29:19 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Thu, 21 Nov 2013 14:29:19 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131121142919.29845.71596@app12.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/b04ea4da194b/ Changeset: b04ea4da194b User: hpk42 Date: 2013-11-21 14:54:46 Summary: simplify basedir isolation Affected #: 1 file diff -r 4c926afb69fc84051e08a2816085a58a74493ebf -r b04ea4da194bbce91e32fc94fbfafa7ee20ee456 testing/conftest.py --- a/testing/conftest.py +++ b/testing/conftest.py @@ -12,6 +12,7 @@ help=("run FD checks if lsof is available")) def pytest_configure(config): + config._basedir = py.path.local() if config.getvalue("lsof"): try: out = py.process.cmdexec("lsof -p %d" % pid) @@ -42,12 +43,8 @@ config._numfiles = len(lines2) raise AssertionError("\n".join(error)) - at pytest.mark.tryfirst # XXX rather do item.addfinalizer -def pytest_runtest_setup(item): - item._oldir = py.path.local() - def pytest_runtest_teardown(item, __multicall__): - item._oldir.chdir() + item.config._basedir.chdir() if hasattr(item.config, '_numfiles'): x = __multicall__.execute() check_open_files(item.config) https://bitbucket.org/hpk42/pytest/commits/4951204afadc/ Changeset: 4951204afadc User: hpk42 Date: 2013-11-21 15:25:16 Summary: fix issue357 - special case "-k" expressions to allow for filtering with simple strings that are not valid python expressions. Examples: "-k 1.3" matches all tests parametrized with 1.3. "-k None" filters all tests that have "None" in their name and conversely "-k 'not None'". Previously these examples would raise syntax errors. Also add a note to the docs about what is allowed. Affected #: 4 files diff -r b04ea4da194bbce91e32fc94fbfafa7ee20ee456 -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -11,6 +11,13 @@ help with random "xdist" collection failures. Thanks to Ronny Pfannschmidt and Donald Stufft for helping to isolate it. +- fix issue357 - special case "-k" expressions to allow for + filtering with simple strings that are not valid python expressions. + Examples: "-k 1.3" matches all tests parametrized with 1.3. + "-k None" filters all tests that have "None" in their name + and conversely "-k 'not None'". + Previously these examples would raise syntax errors. + - fix issue384 by removing the trial support code since the unittest compat enhancements allow trial to handle it on its own diff -r b04ea4da194bbce91e32fc94fbfafa7ee20ee456 -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd _pytest/mark.py --- a/_pytest/mark.py +++ b/_pytest/mark.py @@ -140,7 +140,13 @@ for name in colitem.function.__dict__: mapped_names.add(name) - return eval(keywordexpr, {}, KeywordMapping(mapped_names)) + mapping = KeywordMapping(mapped_names) + if " " not in keywordexpr: + # special case to allow for simple "-k pass" and "-k 1.3" + return mapping[keywordexpr] + elif keywordexpr.startswith("not ") and " " not in keywordexpr[4:]: + return not mapping[keywordexpr[4:]] + return eval(keywordexpr, {}, mapping) def pytest_configure(config): diff -r b04ea4da194bbce91e32fc94fbfafa7ee20ee456 -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd doc/en/example/markers.txt --- a/doc/en/example/markers.txt +++ b/doc/en/example/markers.txt @@ -95,6 +95,17 @@ ================= 1 tests deselected by '-khttp or quick' ================== ================== 2 passed, 1 deselected in 0.01 seconds ================== +.. note:: + + If you are using expressions such as "X and Y" then both X and Y + need to be simple non-keyword names. For example, "pass" or "from" + will result in SyntaxErrors because "-k" evaluates the expression. + + However, if the "-k" argument is a simple string, no such restrictions + apply. Also "-k 'not STRING'" has no restrictions. You can also + specify numbers like "-k 1.3" to match tests which are parametrized + with the float "1.3". + Registering markers ------------------------------------- diff -r b04ea4da194bbce91e32fc94fbfafa7ee20ee456 -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd testing/test_mark.py --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -174,7 +174,9 @@ @pytest.mark.parametrize("spec", [ ("interface", ("test_interface",)), - ("not interface", ("test_nointer",)), + ("not interface", ("test_nointer", "test_pass")), + ("pass", ("test_pass",)), + ("not pass", ("test_interface", "test_nointer")), ]) def test_keyword_option_custom(spec, testdir): testdir.makepyfile(""" @@ -182,6 +184,8 @@ pass def test_nointer(): pass + def test_pass(): + pass """) opt, passed_result = spec rec = testdir.inline_run("-k", opt) @@ -191,6 +195,24 @@ assert list(passed) == list(passed_result) + at pytest.mark.parametrize("spec", [ + ("None", ("test_func[None]",)), + ("1.3", ("test_func[1.3]",)) +]) +def test_keyword_option_parametrize(spec, testdir): + testdir.makepyfile(""" + import pytest + @pytest.mark.parametrize("arg", [None, 1.3]) + def test_func(arg): + pass + """) + opt, passed_result = spec + rec = testdir.inline_run("-k", opt) + passed, skipped, fail = rec.listoutcomes() + passed = [x.nodeid.split("::")[-1] for x in passed] + assert len(passed) == len(passed_result) + assert list(passed) == list(passed_result) + class TestFunctional: def test_mark_per_function(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 Fri Nov 22 06:47:01 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 05:47:01 -0000 Subject: [Pytest-commit] commit/tox: nicoddemus: Added --force-dep-version command-line option Message-ID: <20131122054701.30896.99108@app07.ash-private.bitbucket.org> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/93a867482895/ Changeset: 93a867482895 User: nicoddemus Date: 2013-11-21 23:15:14 Summary: Added --force-dep-version command-line option Affected #: 3 files diff -r 1421955f0d5faab5d579ff40ceca7385d49e40ad -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 CONTRIBUTORS --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -11,3 +11,4 @@ Lukasz Balcerzak Philip Thiem Monty Taylor +Bruno Oliveira diff -r 1421955f0d5faab5d579ff40ceca7385d49e40ad -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -62,6 +62,41 @@ envconfig = config.envconfigs['devenv'] assert envconfig.envdir == config.toxworkdir.join('foobar') + def test_force_dep_version(self, initproj): + """ + Make sure we can override dependencies configured in tox.ini when using the command line option + --force-dep-version. + """ + initproj("example123-0.5", filedefs={ + 'tox.ini': ''' + [tox] + + [testenv] + deps= + dep1==1.0 + dep2>=2.0 + dep3 + dep4==4.0 + ''' + }) + config = parseconfig( + ['--force-dep-version=dep1==1.5', '--force-dep-version=dep2==2.1', '--force-dep-version=dep3==3.0']) + assert config.option.force_dep_version == ['dep1==1.5', 'dep2==2.1', 'dep3==3.0'] + assert [str(x) for x in config.envconfigs['python'].deps] == [ + 'dep1==1.5', 'dep2==2.1', 'dep3==3.0', 'dep4==4.0', + ] + + def test_is_same_dep(self): + """ + Ensure correct parseini._is_same_dep is working with a few samples. + """ + assert parseini._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3') + assert parseini._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3>=2.0') + assert parseini._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3>2.0') + assert parseini._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<2.0') + assert parseini._is_same_dep('pkg_hello-world3==1.0', 'pkg_hello-world3<=2.0') + assert not parseini._is_same_dep('pkg_hello-world3==1.0', 'otherpkg>=2.0') + class TestConfigPackage: def test_defaults(self, tmpdir, newconfig): config = newconfig([], "") @@ -1142,6 +1177,28 @@ "*ERROR*tox.ini*not*found*", ]) + def test_showconfig_with_force_dep_version(self, cmd, initproj): + initproj('force_dep_version', filedefs={ + 'tox.ini': ''' + [tox] + + [testenv] + deps= + dep1==2.3 + dep2 + ''', + }) + result = cmd.run("tox", "--showconfig") + assert result.ret == 0 + result.stdout.fnmatch_lines([ + r'*deps=*dep1==2.3, dep2*', + ]) + # override dep1 specific version, and force version for dep2 + result = cmd.run("tox", "--showconfig", "--force-dep-version=dep1", "--force-dep-version=dep2==5.0") + assert result.ret == 0 + result.stdout.fnmatch_lines([ + r'*deps=*dep1, dep2==5.0*', + ]) class TestArgumentParser: @@ -1229,5 +1286,3 @@ """) envconfig = config.envconfigs["py26"] assert envconfig.commands[0] == ["some", r"hello\world"] - - diff -r 1421955f0d5faab5d579ff40ceca7385d49e40ad -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -8,6 +8,7 @@ import string import subprocess import textwrap +import pkg_resources from tox.interpreters import Interpreters @@ -124,6 +125,10 @@ help="set PYTHONHASHSEED to SEED before running commands. " "Defaults to a random integer in the range 1 to 4294967295. " "Passing 'noset' suppresses this behavior.") + parser.add_argument("--force-dep-version", action="append", + metavar="DEP==VER", default=None, + help="Forces a certain version of one of the dependencies " + "when configuring the virtual environment.") parser.add_argument("args", nargs="*", help="additional arguments available to command positional substitution") return parser @@ -343,6 +348,7 @@ else: name = depline.strip() ixserver = None + name = self._replace_forced_dep(name, config) vc.deps.append(DepConfig(name, ixserver)) vc.distribute = reader.getbool(section, "distribute", False) vc.sitepackages = reader.getbool(section, "sitepackages", False) @@ -385,6 +391,31 @@ envlist.sort() return envlist + def _replace_forced_dep(self, name, config): + """ + Override the given dependency config name taking --force-dep-version + option into account. + + :param name: dep config, for example ["pkg==1.0", "other==2.0"]. + :param config: Config instance + :return: the new dependency that should be used for virtual environments + """ + if not config.option.force_dep_version: + return name + for forced_dep in config.option.force_dep_version: + if self._is_same_dep(forced_dep, name): + return forced_dep + return name + + @classmethod + def _is_same_dep(cls, dep1, dep2): + """ + Returns True if both dependency definitions refer to the same package, even if versions differ. + """ + dep1_name = pkg_resources.Requirement.parse(dep1).project_name + dep2_name = pkg_resources.Requirement.parse(dep2).project_name + return dep1_name == dep2_name + def _split_env(env): """if handed a list, action="append" was used for -e """ envlist = [] Repository URL: https://bitbucket.org/hpk42/tox/ -- 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 Nov 22 07:52:05 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 06:52:05 -0000 Subject: [Pytest-commit] commit/tox: hpk42: merged and slightly modified PR81: new option --force-dep which allows to Message-ID: <20131122065205.12882.86626@app07.ash-private.bitbucket.org> 1 new commit in tox: https://bitbucket.org/hpk42/tox/commits/7d8976da0b00/ Changeset: 7d8976da0b00 User: hpk42 Date: 2013-11-22 07:51:21 Summary: merged and slightly modified PR81: new option --force-dep which allows to override tox.ini specified dependencies in setuptools-style. For example "--force-dep 'django<1.6'" will make sure that any environment using "django" as a dependency will get the latest 1.5 release. Thanks Bruno Oliveria for the complete PR. Affected #: 3 files diff -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 -r 7d8976da0b000e0d36ef61545c0f779bb9fe4c09 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,13 @@ 1.6.2.dev --------- +- merged PR81: new option --force-dep which allows to + override tox.ini specified dependencies in setuptools-style. + For example "--force-dep 'django<1.6'" will make sure + that any environment using "django" as a dependency will + get the latest 1.5 release. Thanks Bruno Oliveria for + the complete PR. + - merged PR125: tox now sets "PYTHONHASHSEED" to a random value and offers a "--hashseed" option to repeat a test run with a specific seed. You can also use --hashsheed=notset to instruct tox to leave the value @@ -21,8 +28,8 @@ - fix issue129: tox now uses Popen(..., universal_newlines=True) to force creation of unicode stdout/stderr streams. fixes a problem on specific - platform configs when creating virtualenvs with Python3.3. Thanks Jorgen Sch?fer - or investigation and solution sketch. + platform configs when creating virtualenvs with Python3.3. Thanks + Jorgen Sch?fer or investigation and solution sketch. - fix issue128: enable full substitution in install_command, thanks for the PR to Ronald Evers diff -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 -r 7d8976da0b000e0d36ef61545c0f779bb9fe4c09 tests/test_config.py --- a/tests/test_config.py +++ b/tests/test_config.py @@ -65,7 +65,7 @@ def test_force_dep_version(self, initproj): """ Make sure we can override dependencies configured in tox.ini when using the command line option - --force-dep-version. + --force-dep. """ initproj("example123-0.5", filedefs={ 'tox.ini': ''' @@ -80,8 +80,10 @@ ''' }) config = parseconfig( - ['--force-dep-version=dep1==1.5', '--force-dep-version=dep2==2.1', '--force-dep-version=dep3==3.0']) - assert config.option.force_dep_version == ['dep1==1.5', 'dep2==2.1', 'dep3==3.0'] + ['--force-dep=dep1==1.5', '--force-dep=dep2==2.1', + '--force-dep=dep3==3.0']) + assert config.option.force_dep== [ + 'dep1==1.5', 'dep2==2.1', 'dep3==3.0'] assert [str(x) for x in config.envconfigs['python'].deps] == [ 'dep1==1.5', 'dep2==2.1', 'dep3==3.0', 'dep4==4.0', ] @@ -1194,7 +1196,8 @@ r'*deps=*dep1==2.3, dep2*', ]) # override dep1 specific version, and force version for dep2 - result = cmd.run("tox", "--showconfig", "--force-dep-version=dep1", "--force-dep-version=dep2==5.0") + result = cmd.run("tox", "--showconfig", "--force-dep=dep1", + "--force-dep=dep2==5.0") assert result.ret == 0 result.stdout.fnmatch_lines([ r'*deps=*dep1, dep2==5.0*', diff -r 93a867482895e5ba5ad879e8a68211a9f2ebefc9 -r 7d8976da0b000e0d36ef61545c0f779bb9fe4c09 tox/_config.py --- a/tox/_config.py +++ b/tox/_config.py @@ -125,10 +125,11 @@ help="set PYTHONHASHSEED to SEED before running commands. " "Defaults to a random integer in the range 1 to 4294967295. " "Passing 'noset' suppresses this behavior.") - parser.add_argument("--force-dep-version", action="append", - metavar="DEP==VER", default=None, + parser.add_argument("--force-dep", action="append", + metavar="REQ", default=None, help="Forces a certain version of one of the dependencies " - "when configuring the virtual environment.") + "when configuring the virtual environment. REQ Examples " + "'pytest<2.4' or 'django>=1.6'.") parser.add_argument("args", nargs="*", help="additional arguments available to command positional substitution") return parser @@ -400,9 +401,9 @@ :param config: Config instance :return: the new dependency that should be used for virtual environments """ - if not config.option.force_dep_version: + if not config.option.force_dep: return name - for forced_dep in config.option.force_dep_version: + for forced_dep in config.option.force_dep: if self._is_same_dep(forced_dep, name): return forced_dep return name @@ -410,7 +411,8 @@ @classmethod def _is_same_dep(cls, dep1, dep2): """ - Returns True if both dependency definitions refer to the same package, even if versions differ. + Returns True if both dependency definitions refer to the + same package, even if versions differ. """ dep1_name = pkg_resources.Requirement.parse(dep1).project_name dep2_name = pkg_resources.Requirement.parse(dep2).project_name Repository URL: https://bitbucket.org/hpk42/tox/ -- 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 Nov 22 13:45:04 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 12:45:04 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: clarify that python_functions does not apply to unittest.TestCase Message-ID: <20131122124504.10838.40510@app03.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/73b1eed8ce09/ Changeset: 73b1eed8ce09 User: hpk42 Date: 2013-11-22 13:44:56 Summary: clarify that python_functions does not apply to unittest.TestCase classes and their methods. Addresses issue284. Affected #: 4 files diff -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f _pytest/assertion/__init__.py --- a/_pytest/assertion/__init__.py +++ b/_pytest/assertion/__init__.py @@ -78,10 +78,12 @@ for new_expl in hook_result: if new_expl: - # Don't include pageloads of data unless we are very verbose (-vv) + # Don't include pageloads of data unless we + # are very verbose (-vv) if len(''.join(new_expl[1:])) > 80*8 and item.config.option.verbose < 2: new_expl[1:] = ['Detailed information truncated, use "-vv" to see'] - res = '\n~'.join(new_expl) + res = '\n'.join(new_expl) + print res if item.config.getvalue("assertmode") == "rewrite": # The result will be fed back a python % formatting # operation, which will fail if there are extraneous diff -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -95,9 +95,6 @@ def assertrepr_compare(config, op, left, right): """Return specialised explanations for some operators/operands""" width = 80 - 15 - len(op) - 2 # 15 chars indentation, 1 space around op - left_repr = py.io.saferepr(left, maxsize=int(width/2)) - right_repr = py.io.saferepr(right, maxsize=width-len(left_repr)) - summary = '%s %s %s' % (left_repr, op, right_repr) issequence = lambda x: (isinstance(x, (list, tuple, Sequence)) and not isinstance(x, basestring)) @@ -120,9 +117,7 @@ elif op == 'not in': if istext(left) and istext(right): explanation = _notin_text(left, right, verbose) - except py.builtin._sysex: - raise - except: + except Exception: excinfo = py.code.ExceptionInfo() explanation = [ '(pytest_assertion plugin: representation of details failed. ' @@ -130,7 +125,15 @@ if not explanation: return None - + if istext(left): + left_repr = left[:int(width/2)] + else: + left_repr = py.io.saferepr(left, maxsize=int(width/2)) + if istext(right): + right_repr = right[:int(width/2)] + else: + right_repr = py.io.saferepr(right, maxsize=width-len(left_repr)) + summary = '%s %s %s' % (left_repr, op, right_repr) return [summary] + explanation diff -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f doc/en/customize.txt --- a/doc/en/customize.txt +++ b/doc/en/customize.txt @@ -121,6 +121,8 @@ .. confval:: python_functions One or more name prefixes determining which test functions - and methods are considered as test modules. + and methods are considered as test modules. Note that this + has no effect on methods that live on a ``unittest.TestCase`` + derived class. See :ref:`change naming conventions` for examples. diff -r 4951204afadcc1070e0d478c7ba4e8bdd29cd8fd -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f doc/en/example/pythoncollection.txt --- a/doc/en/example/pythoncollection.txt +++ b/doc/en/example/pythoncollection.txt @@ -53,6 +53,12 @@ ============================= in 0.01 seconds ============================= +.. note:: + + the ``python_functions`` and ``python_classes`` has no effect + for ``unittest.TestCase`` test discovery because pytest delegates + detection of test case methods to unittest code. + Interpreting cmdline arguments as Python packages ----------------------------------------------------- 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 Nov 22 13:54:08 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 12:54:08 -0000 Subject: [Pytest-commit] commit/pytest: 2 new changesets Message-ID: <20131122125408.13689.22606@app12.ash-private.bitbucket.org> 2 new commits in pytest: https://bitbucket.org/hpk42/pytest/commits/8bd7d1c4fef0/ Changeset: 8bd7d1c4fef0 User: hpk42 Date: 2013-11-22 13:52:53 Summary: Backed out changeset 73b1eed8ce09 Affected #: 4 files diff -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f -r 8bd7d1c4fef0d79b067829c18756e5352f9ca60b _pytest/assertion/__init__.py --- a/_pytest/assertion/__init__.py +++ b/_pytest/assertion/__init__.py @@ -78,12 +78,10 @@ for new_expl in hook_result: if new_expl: - # Don't include pageloads of data unless we - # are very verbose (-vv) + # Don't include pageloads of data unless we are very verbose (-vv) if len(''.join(new_expl[1:])) > 80*8 and item.config.option.verbose < 2: new_expl[1:] = ['Detailed information truncated, use "-vv" to see'] - res = '\n'.join(new_expl) - print res + res = '\n~'.join(new_expl) if item.config.getvalue("assertmode") == "rewrite": # The result will be fed back a python % formatting # operation, which will fail if there are extraneous diff -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f -r 8bd7d1c4fef0d79b067829c18756e5352f9ca60b _pytest/assertion/util.py --- a/_pytest/assertion/util.py +++ b/_pytest/assertion/util.py @@ -95,6 +95,9 @@ def assertrepr_compare(config, op, left, right): """Return specialised explanations for some operators/operands""" width = 80 - 15 - len(op) - 2 # 15 chars indentation, 1 space around op + left_repr = py.io.saferepr(left, maxsize=int(width/2)) + right_repr = py.io.saferepr(right, maxsize=width-len(left_repr)) + summary = '%s %s %s' % (left_repr, op, right_repr) issequence = lambda x: (isinstance(x, (list, tuple, Sequence)) and not isinstance(x, basestring)) @@ -117,7 +120,9 @@ elif op == 'not in': if istext(left) and istext(right): explanation = _notin_text(left, right, verbose) - except Exception: + except py.builtin._sysex: + raise + except: excinfo = py.code.ExceptionInfo() explanation = [ '(pytest_assertion plugin: representation of details failed. ' @@ -125,15 +130,7 @@ if not explanation: return None - if istext(left): - left_repr = left[:int(width/2)] - else: - left_repr = py.io.saferepr(left, maxsize=int(width/2)) - if istext(right): - right_repr = right[:int(width/2)] - else: - right_repr = py.io.saferepr(right, maxsize=width-len(left_repr)) - summary = '%s %s %s' % (left_repr, op, right_repr) + return [summary] + explanation diff -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f -r 8bd7d1c4fef0d79b067829c18756e5352f9ca60b doc/en/customize.txt --- a/doc/en/customize.txt +++ b/doc/en/customize.txt @@ -121,8 +121,6 @@ .. confval:: python_functions One or more name prefixes determining which test functions - and methods are considered as test modules. Note that this - has no effect on methods that live on a ``unittest.TestCase`` - derived class. + and methods are considered as test modules. See :ref:`change naming conventions` for examples. diff -r 73b1eed8ce09afd9c4944dda484fdfee6c3a428f -r 8bd7d1c4fef0d79b067829c18756e5352f9ca60b doc/en/example/pythoncollection.txt --- a/doc/en/example/pythoncollection.txt +++ b/doc/en/example/pythoncollection.txt @@ -53,12 +53,6 @@ ============================= in 0.01 seconds ============================= -.. note:: - - the ``python_functions`` and ``python_classes`` has no effect - for ``unittest.TestCase`` test discovery because pytest delegates - detection of test case methods to unittest code. - Interpreting cmdline arguments as Python packages ----------------------------------------------------- https://bitbucket.org/hpk42/pytest/commits/09aa69307b21/ Changeset: 09aa69307b21 User: hpk42 Date: 2013-11-22 13:53:43 Summary: apply doc changes from just backed out changeset Affected #: 2 files diff -r 8bd7d1c4fef0d79b067829c18756e5352f9ca60b -r 09aa69307b2120b2c90ca3a9a3f954668e483589 doc/en/customize.txt --- a/doc/en/customize.txt +++ b/doc/en/customize.txt @@ -121,6 +121,8 @@ .. confval:: python_functions One or more name prefixes determining which test functions - and methods are considered as test modules. + and methods are considered as test modules. Note that this + has no effect on methods that live on a ``unittest.TestCase`` + derived class. See :ref:`change naming conventions` for examples. diff -r 8bd7d1c4fef0d79b067829c18756e5352f9ca60b -r 09aa69307b2120b2c90ca3a9a3f954668e483589 doc/en/example/pythoncollection.txt --- a/doc/en/example/pythoncollection.txt +++ b/doc/en/example/pythoncollection.txt @@ -53,6 +53,12 @@ ============================= in 0.01 seconds ============================= +.. note:: + + the ``python_functions`` and ``python_classes`` has no effect + for ``unittest.TestCase`` test discovery because pytest delegates + detection of test case methods to unittest code. + Interpreting cmdline arguments as Python packages ----------------------------------------------------- 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 Nov 22 13:57:20 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 12:57:20 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: python2.4 is not really tested or supported anymore Message-ID: <20131122125720.6711.33819@app04.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/b990b02ea715/ Changeset: b990b02ea715 User: hpk42 Date: 2013-11-22 13:57:15 Summary: python2.4 is not really tested or supported anymore Affected #: 1 file diff -r 09aa69307b2120b2c90ca3a9a3f954668e483589 -r b990b02ea715ab5bf95f32dd8661308d994626c3 doc/en/index.txt --- a/doc/en/index.txt +++ b/doc/en/index.txt @@ -8,7 +8,7 @@ **a mature full-featured Python testing tool** - - runs on Posix/Windows, Python 2.4-3.3, PyPy and Jython-2.5.1 + - runs on Posix/Windows, Python 2.5-3.3, PyPy and Jython-2.5.1 - :ref:`comprehensive online ` and `PDF documentation `_ - many :ref:`third party plugins ` and :ref:`builtin helpers ` 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 Nov 22 14:08:39 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 13:08:39 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix issue377 by clarifying in the nose-compat docs that pytest Message-ID: <20131122130839.6490.8793@app02.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/4ff693c6e443/ Changeset: 4ff693c6e443 User: hpk42 Date: 2013-11-22 14:07:56 Summary: fix issue377 by clarifying in the nose-compat docs that pytest does not duplicate the unittest-API into the "plain" namespace. Affected #: 2 files diff -r b990b02ea715ab5bf95f32dd8661308d994626c3 -r 4ff693c6e4436ff1abb6f2a7da96b73d0bae1993 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -82,6 +82,9 @@ - fixed version comparison in pytest.importskip(modname, minverstring) +- fix issue377 by clarifying in the nose-compat docs that pytest + does not duplicate the unittest-API into the "plain" namespace. + Changes between 2.4.1 and 2.4.2 ----------------------------------- diff -r b990b02ea715ab5bf95f32dd8661308d994626c3 -r 4ff693c6e4436ff1abb6f2a7da96b73d0bae1993 doc/en/nose.txt --- a/doc/en/nose.txt +++ b/doc/en/nose.txt @@ -30,9 +30,18 @@ Unsupported idioms / known issues ---------------------------------- +- unittest-style ``setUp, tearDown, setUpClass, tearDownClass`` + are recognized only on ``unittest.TestCase`` classes but not + on plain classes. ``nose`` supports these methods also on plain + classes but pytest deliberately does not. As nose and pytest already + both support ``setup_class, teardown_class, setup_method, teardown_method`` + it doesn't seem useful to duplicate the unittest-API like nose does. + If you however rather think pytest should support the unittest-spelling on + plain classes please post `to this issue + `_. + - nose-style doctests are not collected and executed correctly, also doctest fixtures don't work. - no nose-configuration is recognized - 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 Nov 22 15:12:19 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 14:12:19 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: add a note to the documentation that pytest does not mimick nose try to perform "import isolation". Addresses issue268. Message-ID: <20131122141219.1691.14525@app14.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/a5419e5024d9/ Changeset: a5419e5024d9 User: hpk42 Date: 2013-11-22 15:12:12 Summary: add a note to the documentation that pytest does not mimick nose try to perform "import isolation". Addresses issue268. Affected #: 1 file diff -r 4ff693c6e4436ff1abb6f2a7da96b73d0bae1993 -r a5419e5024d9719d49f7d3fc8ff1811021a106c3 doc/en/nose.txt --- a/doc/en/nose.txt +++ b/doc/en/nose.txt @@ -39,6 +39,13 @@ If you however rather think pytest should support the unittest-spelling on plain classes please post `to this issue `_. + +- nose imports test modules with the same import path (e.g. + ``tests.test_mod``) but different file system paths + (e.g. ``tests/test_mode.py`` and ``other/tests/test_mode.py``) + by extending sys.path/import semantics. pytest does not do that + but there is discussion in `issue268 `_ for adding some support. Note that + `nose2 choose to avoid this sys.path/import hackery `_. - nose-style doctests are not collected and executed correctly, also doctest fixtures don't work. 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 Nov 22 15:35:26 2013 From: commits-noreply at bitbucket.org (commits-noreply at bitbucket.org) Date: Fri, 22 Nov 2013 14:35:26 -0000 Subject: [Pytest-commit] commit/pytest: hpk42: fix issue275 - allow usefixtures and autouse fixtures Message-ID: <20131122143526.17960.19255@app10.ash-private.bitbucket.org> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/7cc1a4514c8e/ Changeset: 7cc1a4514c8e User: hpk42 Date: 2013-11-22 15:35:20 Summary: fix issue275 - allow usefixtures and autouse fixtures for running doctest text files. Affected #: 4 files diff -r a5419e5024d9719d49f7d3fc8ff1811021a106c3 -r 7cc1a4514c8e4b8329e28c6de8a7de6174c239ec CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -29,6 +29,9 @@ - don't hide an ImportError when importing a plugin produces one. fixes issue375. +- fix issue275 - allow usefixtures and autouse fixtures + for running doctest text files. + - fix issue380 by making --resultlog only rely on longrepr instead of the "reprcrash" attribute which only exists sometimes. diff -r a5419e5024d9719d49f7d3fc8ff1811021a106c3 -r 7cc1a4514c8e4b8329e28c6de8a7de6174c239ec _pytest/doctest.py --- a/_pytest/doctest.py +++ b/_pytest/doctest.py @@ -91,8 +91,13 @@ doctest = py.std.doctest # satisfy `FixtureRequest` constructor... self.funcargs = {} - self._fixtureinfo = FuncFixtureInfo((), [], {}) + fm = self.session._fixturemanager + def func(): + pass + self._fixtureinfo = fm.getfixtureinfo(node=self, func=func, + cls=None, funcargs=False) fixture_request = FixtureRequest(self) + fixture_request._fillfixtures() failed, tot = doctest.testfile( str(self.fspath), module_relative=False, optionflags=doctest.ELLIPSIS, diff -r a5419e5024d9719d49f7d3fc8ff1811021a106c3 -r 7cc1a4514c8e4b8329e28c6de8a7de6174c239ec doc/en/doctest.txt --- a/doc/en/doctest.txt +++ b/doc/en/doctest.txt @@ -56,3 +56,7 @@ # content of example.rst >>> tmp = getfixture('tmpdir') >>> ... + >>> + +Also, :ref:`usefixtures` and :ref:`autouse` fixtures are supported +when executing text doctest files. diff -r a5419e5024d9719d49f7d3fc8ff1811021a106c3 -r 7cc1a4514c8e4b8329e28c6de8a7de6174c239ec testing/test_doctest.py --- a/testing/test_doctest.py +++ b/testing/test_doctest.py @@ -209,6 +209,26 @@ reprec = testdir.inline_run(p, ) reprec.assertoutcome(passed=1) + @xfail_if_pdbpp_installed + def test_txtfile_with_usefixtures_in_ini(self, testdir): + testdir.makeini(""" + [pytest] + usefixtures = myfixture + """) + testdir.makeconftest(""" + import pytest + @pytest.fixture + def myfixture(monkeypatch): + monkeypatch.setenv("HELLO", "WORLD") + """) + + p = testdir.maketxtfile(""" + >>> import os + >>> os.environ["HELLO"] + 'WORLD' + """) + reprec = testdir.inline_run(p, ) + reprec.assertoutcome(passed=1) @xfail_if_pdbpp_installed def test_doctestmodule_with_fixtures(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 issues-reply at bitbucket.org Fri Nov 29 09:32:40 2013 From: issues-reply at bitbucket.org (Lukasz Balcerzak) Date: Fri, 29 Nov 2013 08:32:40 -0000 Subject: [Pytest-commit] Issue #138: console script is not created when using Python 3 within testenv (hpk42/tox) Message-ID: <20131129083240.13438.60645@app02.ash-private.bitbucket.org> New issue 138: console script is not created when using Python 3 within testenv https://bitbucket.org/hpk42/tox/issue/138/console-script-is-not-created-when-using Lukasz Balcerzak: I have a Python2/3 package and ``console_script`` directive at my setup.py. For some reason, tox works great for Python 2 but for Python 3 it doesn't install it. ``` #!shell ? ~/develop/workspace/porunga ? ? py3shell-testenv ? ? ls -l .tox/shell3/bin lukasz staff 2232 Nov 29 09:23 activate lukasz staff 1288 Nov 29 09:23 activate.csh lukasz staff 2427 Nov 29 09:23 activate.fish lukasz staff 1129 Nov 29 09:23 activate_this.py lukasz staff 370 Nov 29 09:23 easy_install lukasz staff 378 Nov 29 09:23 easy_install-3.3 lukasz staff 331 Nov 29 09:23 pip lukasz staff 339 Nov 29 09:23 pip-3.3 lukasz staff 9 Nov 29 09:23 python -> python3.3 lukasz staff 9 Nov 29 09:23 python3 -> python3.3 lukasz staff 13188 Nov 29 09:23 python3.3 ? ~/develop/workspace/porunga ? ? py3shell-testenv ? ? ls -l .tox/shell/bin lukasz staff 2231 Nov 29 09:23 activate lukasz staff 1287 Nov 29 09:23 activate.csh lukasz staff 2426 Nov 29 09:23 activate.fish lukasz staff 1129 Nov 29 09:23 activate_this.py lukasz staff 369 Nov 29 09:23 easy_install lukasz staff 377 Nov 29 09:23 easy_install-2.7 lukasz staff 330 Nov 29 09:23 pip lukasz staff 338 Nov 29 09:23 pip-2.7 lukasz staff 359 Nov 29 09:23 porunga lukasz staff 9 Nov 29 09:23 python -> python2.7 lukasz staff 9 Nov 29 09:23 python2 -> python2.7 lukasz staff 12624 Nov 29 09:23 python2.7 ``` Am working on this at branch, here are codes: https://github.com/lukaszb/porunga/blob/py3shell-testenv/tox.ini