4 new commits in pytest-xdist: https://bitbucket.org/hpk42/pytest-xdist/commits/d9fe8e544abf/ Changeset: d9fe8e544abf User: hpk42 Date: 2012-11-20 13:26:29 Summary: add boxed example Affected #: 1 file
diff -r db56e4b41e9bff631eec7b1f3db9dd5cf1b3e574 -r d9fe8e544abfb630e9126c0d1a29ab9795c510d6 example/boxed.txt --- /dev/null +++ b/example/boxed.txt @@ -0,0 +1,62 @@ + + +If your testing involves C or C++ libraries you might have to deal +with crashing processes. The xdist-plugin provides the ``--boxed`` option +to run each test in a controled subprocess. Here is a basic example:: + + # content of test_module.py + + import pytest + import os + import time + + # run test function 50 times with different argument + @pytest.mark.parametrize("arg", range(50)) + def test_func(arg): + time.sleep(0.05) # each tests takes a while + if arg % 19 == 0: + os.kill(os.getpid(), 15) + +If you run this with:: + + $ py.test --boxed + =========================== test session starts ============================ + platform linux2 -- Python 2.7.3 -- pytest-2.3.0.dev8 + plugins: xdist, bugzilla, cache, oejskit, cli, pep8, cov + collecting ... collected 50 items + + test_module.py f..................f..................f........... + + ================================= FAILURES ================================= + _______________________________ test_func[0] _______________________________ + /home/hpk/tmp/doc-exec-420/test_module.py:6: running the test CRASHED with signal 15 + ______________________________ test_func[19] _______________________________ + /home/hpk/tmp/doc-exec-420/test_module.py:6: running the test CRASHED with signal 15 + ______________________________ test_func[38] _______________________________ + /home/hpk/tmp/doc-exec-420/test_module.py:6: running the test CRASHED with signal 15 + =================== 3 failed, 47 passed in 3.41 seconds ==================== + +You'll see that a couple of tests are reported as crashing, indicated +by lower-case ``f`` and the respective failure summary. You can also use +the xdist-provided parallelization feature to speed up your testing:: + + $ py.test --boxed -n3 + =========================== test session starts ============================ + platform linux2 -- Python 2.7.3 -- pytest-2.3.0.dev8 + plugins: xdist, bugzilla, cache, oejskit, cli, pep8, cov + gw0 I / gw1 I / gw2 I + gw0 [50] / gw1 [50] / gw2 [50] + + scheduling tests via LoadScheduling + ..f...............f..................f............ + ================================= FAILURES ================================= + _______________________________ test_func[0] _______________________________ + [gw0] linux2 -- Python 2.7.3 /home/hpk/venv/1/bin/python + /home/hpk/tmp/doc-exec-420/test_module.py:6: running the test CRASHED with signal 15 + ______________________________ test_func[19] _______________________________ + [gw2] linux2 -- Python 2.7.3 /home/hpk/venv/1/bin/python + /home/hpk/tmp/doc-exec-420/test_module.py:6: running the test CRASHED with signal 15 + ______________________________ test_func[38] _______________________________ + [gw2] linux2 -- Python 2.7.3 /home/hpk/venv/1/bin/python + /home/hpk/tmp/doc-exec-420/test_module.py:6: running the test CRASHED with signal 15 + =================== 3 failed, 47 passed in 2.03 seconds ==================== https://bitbucket.org/hpk42/pytest-xdist/commits/59b574025218/ Changeset: 59b574025218 User: hpk42 Date: 2013-04-02 10:29:51 Summary: merge Affected #: 4 files diff -r d9fe8e544abfb630e9126c0d1a29ab9795c510d6 -r 59b574025218f112876c3b130dc353ddb8e433a5 setup.py --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="pytest-xdist", - version='1.8', + version='1.9dev1', description='py.test xdist plugin for distributed testing and loop-on-failing modes', long_description=open('README.txt').read(), license='GPLv2 or later', diff -r d9fe8e544abfb630e9126c0d1a29ab9795c510d6 -r 59b574025218f112876c3b130dc353ddb8e433a5 testing/test_remote.py --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -88,7 +88,7 @@ assert newrep.passed == rep.passed assert newrep.failed == rep.failed assert newrep.skipped == rep.skipped - if newrep.skipped and 'xfail' not in newrep.keywords: + if newrep.skipped and not hasattr(newrep, "wasxfail"): assert len(newrep.longrepr) == 3 assert newrep.outcome == rep.outcome assert newrep.when == rep.when diff -r d9fe8e544abfb630e9126c0d1a29ab9795c510d6 -r 59b574025218f112876c3b130dc353ddb8e433a5 testing/test_slavemanage.py --- a/testing/test_slavemanage.py +++ b/testing/test_slavemanage.py @@ -15,12 +15,14 @@ config = testdir.parseconfig() return config -class pytest_funcarg__mysetup: - def __init__(self, request): - temp = request.getfuncargvalue("tmpdir") - self.source = temp.mkdir("source") - self.dest = temp.mkdir("dest") - request.getfuncargvalue("_pytest") +def pytest_funcarg__mysetup(request): + class mysetup: + def __init__(self, request): + temp = request.getfuncargvalue("tmpdir") + self.source = temp.mkdir("source") + self.dest = temp.mkdir("dest") + request.getfuncargvalue("_pytest") + return mysetup(request) class TestNodeManagerPopen: def test_popen_no_default_chdir(self, config): @@ -97,11 +99,13 @@ call = hookrecorder.popcall("pytest_xdist_rsyncfinish") class TestHRSync: - class pytest_funcarg__mysetup: - def __init__(self, request): - tmp = request.getfuncargvalue('tmpdir') - self.source = tmp.mkdir("source") - self.dest = tmp.mkdir("dest") + def pytest_funcarg__mysetup(self, request): + class mysetup: + def __init__(self, request): + tmp = request.getfuncargvalue('tmpdir') + self.source = tmp.mkdir("source") + self.dest = tmp.mkdir("dest") + return mysetup(request) def test_hrsync_filter(self, mysetup): source, dest = mysetup.source, mysetup.dest diff -r d9fe8e544abfb630e9126c0d1a29ab9795c510d6 -r 59b574025218f112876c3b130dc353ddb8e433a5 xdist/__init__.py --- a/xdist/__init__.py +++ b/xdist/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '1.8' +__version__ = '1.9dev1' https://bitbucket.org/hpk42/pytest-xdist/commits/5e49f2b13ab6/ Changeset: 5e49f2b13ab6 User: hpk42 Date: 2013-04-02 10:30:52 Summary: merge again Affected #: 2 files diff -r 59b574025218f112876c3b130dc353ddb8e433a5 -r 5e49f2b13ab6fecf1e221131ea6d1efe5f73fab3 testing/test_looponfail.py --- a/testing/test_looponfail.py +++ b/testing/test_looponfail.py @@ -206,6 +206,24 @@ remotecontrol.loop_once() assert len(remotecontrol.failures) == 1 + def test_looponfail_multiple_errors(self, testdir, monkeypatch): + modcol = testdir.getmodulecol(""" + def test_one(): + assert 0 + """) + remotecontrol = RemoteControl(modcol.config) + orig_runsession = remotecontrol.runsession + + def runsession_dups(): + # twisted.trial test cases may report multiple errors. + failures, reports, collection_failed = orig_runsession() + print failures + return failures * 2, reports, collection_failed + + monkeypatch.setattr(remotecontrol, 'runsession', runsession_dups) + remotecontrol.loop_once() + assert len(remotecontrol.failures) == 1 + class TestFunctional: def test_fail_to_ok(self, testdir): diff -r 59b574025218f112876c3b130dc353ddb8e433a5 -r 5e49f2b13ab6fecf1e221131ea6d1efe5f73fab3 xdist/looponfail.py --- a/xdist/looponfail.py +++ b/xdist/looponfail.py @@ -89,7 +89,11 @@ if collection_failed: reports = ["Collection failed, keeping previous failure set"] else: - self.failures = failures + uniq_failures = [] + for failure in failures: + if failure not in uniq_failures: + uniq_failures.append(failure) + self.failures = uniq_failures def repr_pytest_looponfailinfo(failreports, rootdirs): tr = py.io.TerminalWriter() https://bitbucket.org/hpk42/pytest-xdist/commits/4bd2bb53ae3e/ Changeset: 4bd2bb53ae3e User: hpk42 Date: 2013-04-02 10:33:36 Summary: - changed LICENSE to MIT - attribute Jeremy's change Affected #: 3 files diff -r 5e49f2b13ab6fecf1e221131ea6d1efe5f73fab3 -r 4bd2bb53ae3e6d7c4f183f250ef291ebe90207b1 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,11 @@ +1.9.dev +------------------------- + +- changed LICENSE to MIT + +- fix duplicate reported test ids with --looponfailing + (thanks Jeremy Thurgood) + 1.8 ------------------------- diff -r 5e49f2b13ab6fecf1e221131ea6d1efe5f73fab3 -r 4bd2bb53ae3e6d7c4f183f250ef291ebe90207b1 LICENSE --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,19 @@ -The execnet package is released under the provisions of the Gnu Public -License (GPL), version 2 or later. -See http://www.fsf.org/licensing/licenses/ for more information. + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. -This package also contains some minor parts which -which are useable under the MIT license. - -If you have questions and/or want to use parts of -the code under a different license than the GPL -please contact me. - -holger krekel, January 2010, holger at merlinux eu diff -r 5e49f2b13ab6fecf1e221131ea6d1efe5f73fab3 -r 4bd2bb53ae3e6d7c4f183f250ef291ebe90207b1 setup.py --- a/setup.py +++ b/setup.py @@ -5,9 +5,9 @@ version='1.9dev1', description='py.test xdist plugin for distributed testing and loop-on-failing modes', long_description=open('README.txt').read(), - license='GPLv2 or later', + license='MIT', author='holger krekel and contributors', - author_email='py-...@codespeak.net,hol...@merlinux.eu', + author_email='pytest-...@python.org,hol...@merlinux.eu', url='http://bitbucket.org/hpk42/pytest-xdist', platforms=['linux', 'osx', 'win32'], packages = ['xdist'], @@ -17,7 +17,7 @@ classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', - 'License :: OSI Approved :: GNU General Public License (GPL)', + 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Operating System :: MacOS :: MacOS X', Repository URL: https://bitbucket.org/hpk42/pytest-xdist/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit