From c4b365b082452fd425d19ab1db0e51653767ce45 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 16 Nov 2018 12:50:15 -0200 Subject: [PATCH 1/5] Update test that used deprecated cached_setup function --- testing/acceptance_test.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index be4c7d8..02f2d20 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -517,16 +517,15 @@ def test_session_testscollected(testdir): assert collected_file.read() == "collected = 3" -def test_funcarg_teardown_failure(testdir): +def test_fixture_teardown_failure(testdir): p = testdir.makepyfile( """ import pytest - @pytest.fixture + @pytest.fixture(scope="module") def myarg(request): - def teardown(val): - raise ValueError(val) - return request.cached_setup(setup=lambda: 42, teardown=teardown, - scope="module") + yield 42 + raise ValueError(42) + def test_hello(myarg): pass """ From 16db6eddd7e6313e095bebebced813fef76f4802 Mon Sep 17 00:00:00 2001 From: tzickel Date: Wed, 21 Nov 2018 18:34:32 +0200 Subject: [PATCH 2/5] fix a bug with gevent monkeypatch --- changelog/378.bugfix.rst | 1 + xdist/workermanage.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/378.bugfix.rst diff --git a/changelog/378.bugfix.rst b/changelog/378.bugfix.rst new file mode 100644 index 0000000..ceb0af8 --- /dev/null +++ b/changelog/378.bugfix.rst @@ -0,0 +1 @@ +Fix support for gevent monkeypatching diff --git a/xdist/workermanage.py b/xdist/workermanage.py index 3b35c14..c6f0010 100644 --- a/xdist/workermanage.py +++ b/xdist/workermanage.py @@ -268,7 +268,7 @@ class WorkerController(object): if not self._down: try: self.sendcommand("shutdown") - except IOError: + except (IOError, OSError): pass self._shutdown_sent = True From 50b27d27358ee67dfeb395a9a2e2a59633998f78 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 21 Nov 2018 19:57:24 -0200 Subject: [PATCH 3/5] Skip test which needs pytest_namespace(), removed recently --- testing/acceptance_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 02f2d20..8a06645 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -611,6 +611,11 @@ def test_skipping(testdir): def test_issue34_pluginloading_in_subprocess(testdir): + import _pytest.hookspec + + if not hasattr(_pytest.hookspec, "pytest_namespace"): + pytest.skip("this pytest version no longer supports pytest_namespace()") + testdir.tmpdir.join("plugin123.py").write( textwrap.dedent( """ From 6a21a5aa8170a3fd9bf14fc8a56d624fa07ddc29 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 5 Dec 2018 19:46:14 +0100 Subject: [PATCH 4/5] minor: fix error message and wrongly joined/blackified strings --- xdist/looponfail.py | 2 +- xdist/plugin.py | 4 ++-- xdist/scheduler/loadscope.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xdist/looponfail.py b/xdist/looponfail.py index d49a05b..ef68c6e 100644 --- a/xdist/looponfail.py +++ b/xdist/looponfail.py @@ -32,7 +32,7 @@ def pytest_cmdline_main(config): if config.getoption("looponfail"): usepdb = config.getoption("usepdb") # a core option if usepdb: - raise pytest.UsageError("--pdb incompatible with --looponfail.") + raise pytest.UsageError("--pdb is incompatible with --looponfail.") looponfail_main(config) return 2 # looponfail only can get stop with ctrl-C anyway diff --git a/xdist/plugin.py b/xdist/plugin.py index ce8f643..3cff561 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -126,12 +126,12 @@ def pytest_addoption(parser): ) parser.addini( "rsyncdirs", - "list of (relative) paths to be rsynced for" " remote distributed testing.", + "list of (relative) paths to be rsynced for remote distributed testing.", type="pathlist", ) parser.addini( "rsyncignore", - "list of (relative) glob-style paths to be ignored " "for rsyncing.", + "list of (relative) glob-style paths to be ignored for rsyncing.", type="pathlist", ) parser.addini( diff --git a/xdist/scheduler/loadscope.py b/xdist/scheduler/loadscope.py index 2917fc0..426d340 100644 --- a/xdist/scheduler/loadscope.py +++ b/xdist/scheduler/loadscope.py @@ -187,7 +187,7 @@ class LoadScopeScheduling(object): break else: raise RuntimeError( - "Unable to identify crashitem on a workload with " "pending items" + "Unable to identify crashitem on a workload with pending items" ) # Made uncompleted work unit available again From dd6eac12a4e7394a30c504c5665e0fc5b45fc597 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 12:19:34 -0200 Subject: [PATCH 5/5] Fix ExceptionInfo usage for pytest 4.1 Fix #384 --- changelog/384.bugfix.rst | 1 + xdist/workermanage.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog/384.bugfix.rst diff --git a/changelog/384.bugfix.rst b/changelog/384.bugfix.rst new file mode 100644 index 0000000..2ea011e --- /dev/null +++ b/changelog/384.bugfix.rst @@ -0,0 +1 @@ +Add support for pytest 4.1. diff --git a/xdist/workermanage.py b/xdist/workermanage.py index c6f0010..418a66c 100644 --- a/xdist/workermanage.py +++ b/xdist/workermanage.py @@ -345,7 +345,11 @@ class WorkerController(object): except: # noqa from _pytest._code import ExceptionInfo - excinfo = ExceptionInfo() + # ExceptionInfo API changed in pytest 4.1 + if hasattr(ExceptionInfo, "from_current"): + excinfo = ExceptionInfo.from_current() + else: + excinfo = ExceptionInfo() print("!" * 20, excinfo) self.config.notify_exception(excinfo) self.shutdown()