From d8c6c229895d3d5032e2f1bbb0377c92dc4b42b6 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 12 Nov 2018 13:31:19 -0800 Subject: [PATCH 01/35] Don't show node setup when running quiet --- xdist/dsession.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/xdist/dsession.py b/xdist/dsession.py index be3ba77..5b2a302 100644 --- a/xdist/dsession.py +++ b/xdist/dsession.py @@ -344,8 +344,11 @@ class TerminalDistReporter(object): self.rewrite(self.getstatus()) def getstatus(self): - parts = ["%s %s" % (spec.id, self._status[spec.id]) for spec in self._specs] - return " / ".join(parts) + if self.config.option.verbose >= 0: + parts = ["%s %s" % (spec.id, self._status[spec.id]) for spec in self._specs] + return " / ".join(parts) + else: + return "bringing up nodes..." def rewrite(self, line, newline=False): pline = line + " " * max(self._lastlen - len(line), 0) From b819657dac19fffc0b44cbf84cd18009836063b8 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 12 Nov 2018 13:37:10 -0800 Subject: [PATCH 02/35] Add changelog entry --- changelog/373.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/373.feature.rst diff --git a/changelog/373.feature.rst b/changelog/373.feature.rst new file mode 100644 index 0000000..64a8eb0 --- /dev/null +++ b/changelog/373.feature.rst @@ -0,0 +1 @@ +Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines. \ No newline at end of file From 5465d936f79237665ffaeb8a44bf2b4140eac73a Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Mon, 12 Nov 2018 14:05:07 -0800 Subject: [PATCH 03/35] Add newline --- changelog/373.feature.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/373.feature.rst b/changelog/373.feature.rst index 64a8eb0..5a11da4 100644 --- a/changelog/373.feature.rst +++ b/changelog/373.feature.rst @@ -1 +1 @@ -Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines. \ No newline at end of file +Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines. From c4b365b082452fd425d19ab1db0e51653767ce45 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 16 Nov 2018 12:50:15 -0200 Subject: [PATCH 04/35] 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 05/35] 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 06/35] 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 566480fdd3981a22f6f8c379a4a1cf0d397f8e3a Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Thu, 29 Nov 2018 00:25:30 -0800 Subject: [PATCH 07/35] Add test and silence completely --- testing/acceptance_test.py | 12 ++++++++++++ xdist/dsession.py | 7 ++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index be4c7d8..deeafaa 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -358,6 +358,18 @@ class TestDistEach: class TestTerminalReporting: + def test_quiet_no_output(self, testdir): + testdir.makepyfile( + """ + def test_ok(): + pass + """ + ) + result = testdir.runpytest("-q") + result.stdout.fnmatch_lines( + [".*[100%]*", "*1*passed*"] + ) + def test_pass_skip_fail(self, testdir): testdir.makepyfile( """ diff --git a/xdist/dsession.py b/xdist/dsession.py index 5b2a302..8bb559c 100644 --- a/xdist/dsession.py +++ b/xdist/dsession.py @@ -229,9 +229,10 @@ class DSession(object): if self.terminal and not self.sched.has_pending: self.trdist.ensure_show_status() self.terminal.write_line("") - self.terminal.write_line( - "scheduling tests via %s" % (self.sched.__class__.__name__) - ) + if self.config.option.verbose > 0: + self.terminal.write_line( + "scheduling tests via %s" % (self.sched.__class__.__name__) + ) self.sched.schedule() def worker_logstart(self, node, nodeid, location): From 49c09117ed510425a82a11a7a4ed207070358636 Mon Sep 17 00:00:00 2001 From: Ethan Smith Date: Thu, 29 Nov 2018 00:55:33 -0800 Subject: [PATCH 08/35] Fix lint --- testing/acceptance_test.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index deeafaa..d7a1d7c 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -366,9 +366,7 @@ class TestTerminalReporting: """ ) result = testdir.runpytest("-q") - result.stdout.fnmatch_lines( - [".*[100%]*", "*1*passed*"] - ) + result.stdout.fnmatch_lines([".*[100%]*", "*1*passed*"]) def test_pass_skip_fail(self, testdir): testdir.makepyfile( From 6a21a5aa8170a3fd9bf14fc8a56d624fa07ddc29 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 5 Dec 2018 19:46:14 +0100 Subject: [PATCH 09/35] 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 a70dace69cce08cb9e4f39768e018aa24f367eb7 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 9 Dec 2018 18:09:59 +0100 Subject: [PATCH 10/35] Pass and use original sys.argv to/with workers This gets used e.g. by argparse for the "prog" part. We could explicitly pass it through and/or set it on config._parser.prog, but that is a bit tedious just for this use case, and it looks like "simulating" the main prog here appears to not be that bad of a hack after all. --- changelog/388.feature.rst | 3 ++ testing/test_remote.py | 67 +++++++++++++++++++++++++++++++++++++++ xdist/remote.py | 1 + xdist/workermanage.py | 2 ++ 4 files changed, 73 insertions(+) create mode 100644 changelog/388.feature.rst diff --git a/changelog/388.feature.rst b/changelog/388.feature.rst new file mode 100644 index 0000000..57f5943 --- /dev/null +++ b/changelog/388.feature.rst @@ -0,0 +1,3 @@ +``mainargv`` is made available in ``workerinput`` from the host's ``sys.argv``. + +This can be used via ``request.config.workerinput["mainargv"]``. diff --git a/testing/test_remote.py b/testing/test_remote.py index dd6ee87..d0e4757 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -1,6 +1,8 @@ +import os import py import pprint import pytest +import sys from xdist.workermanage import WorkerController, unserialize_report from xdist.remote import serialize_report @@ -397,3 +399,68 @@ def test_remote_env_vars(testdir): ) result = testdir.runpytest("-n2", "--max-worker-restart=0") assert result.ret == 0 + + +def test_remote_inner_argv(testdir): + """Test/document the behavior due to execnet using `python -c`.""" + testdir.makepyfile( + """ + import sys + + def test_argv(): + assert sys.argv == ["-c"] + """ + ) + result = testdir.runpytest("-n1") + assert result.ret == 0 + + +def test_remote_mainargv(testdir): + outer_argv = sys.argv + + testdir.makepyfile( + """ + def test_mainargv(request): + assert request.config.workerinput["mainargv"] == {!r} + """.format( + outer_argv + ) + ) + result = testdir.runpytest("-n1") + assert result.ret == 0 + + +def test_remote_usage_prog(testdir, request): + if not hasattr(request.config._parser, "prog"): + pytest.skip("prog not available in config parser") + prog = os.path.basename(sys.argv[0]) + + testdir.makeconftest( + """ + import pytest + + config_parser = None + + @pytest.fixture + def get_config_parser(): + return config_parser + + def pytest_configure(config): + global config_parser + config_parser = config._parser + """ + ) + testdir.makepyfile( + """ + import sys + + def test(get_config_parser, request): + get_config_parser._getparser().error("my_usage_error") + """ + ) + + result = testdir.runpytest_subprocess("-n1") + assert result.ret == 1 + result.stdout.fnmatch_lines( + ["usage: %s *" % prog, "%s: error: my_usage_error" % prog] + ) diff --git a/xdist/remote.py b/xdist/remote.py index a0afa49..4050385 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -261,6 +261,7 @@ if __name__ == "__channelexec__": import py config = remote_initconfig(option_dict, args) + config._parser.prog = os.path.basename(workerinput["mainargv"][0]) config.workerinput = workerinput config.workeroutput = {} # TODO: deprecated name, backward compatibility only. Remove it in future diff --git a/xdist/workermanage.py b/xdist/workermanage.py index c6f0010..20cdad4 100644 --- a/xdist/workermanage.py +++ b/xdist/workermanage.py @@ -2,6 +2,7 @@ from __future__ import print_function import fnmatch import os import re +import sys import threading import py @@ -213,6 +214,7 @@ class WorkerController(object): "workercount": len(nodemanager.specs), "slaveid": gateway.id, "slavecount": len(nodemanager.specs), + "mainargv": sys.argv, } # TODO: deprecated name, backward compatibility only. Remove it in future self.slaveinput = self.workerinput From dd6eac12a4e7394a30c504c5665e0fc5b45fc597 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 12:19:34 -0200 Subject: [PATCH 11/35] 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() From 3332c99e1ee1ef65f84e2c7e39c6b72ed2424aff Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 14:34:39 -0200 Subject: [PATCH 12/35] Improve verbosity test --- testing/acceptance_test.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index d7a1d7c..e4bccaf 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -358,15 +358,29 @@ class TestDistEach: class TestTerminalReporting: - def test_quiet_no_output(self, testdir): + @pytest.mark.parametrize("verbosity", ["", "-q", "-v"]) + def test_output_verbosity(self, testdir, verbosity): testdir.makepyfile( """ def test_ok(): pass """ ) - result = testdir.runpytest("-q") - result.stdout.fnmatch_lines([".*[100%]*", "*1*passed*"]) + args = ["-n1"] + if verbosity: + args.append(verbosity) + result = testdir.runpytest(*args) + out = result.stdout.str() + if verbosity == "-v": + assert "scheduling tests" in out + assert "gw" in out + elif verbosity == "-q": + assert "scheduling tests" not in out + assert "gw" not in out + assert "bringing up nodes..." in out + else: + assert "scheduling tests" not in out + assert "gw" in out def test_pass_skip_fail(self, testdir): testdir.makepyfile( From a30124e858322d27b31941c6ce97c8c339f21e0d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 18:46:30 -0200 Subject: [PATCH 13/35] Prepare for the removal of pytest_logwarning in pytest 4.1 --- xdist/remote.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/xdist/remote.py b/xdist/remote.py index a0afa49..615a88c 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -115,14 +115,17 @@ class WorkerInteractor(object): data = serialize_report(report) self.sendevent("collectreport", data=data) - def pytest_logwarning(self, message, code, nodeid, fslocation): - self.sendevent( - "logwarning", - message=message, - code=code, - nodeid=nodeid, - fslocation=str(fslocation), - ) + # the pytest_logwarning hook was removed in pytest 4.1 + if hasattr(_pytest.hookspec, "pytest_logwarning"): + + def pytest_logwarning(self, message, code, nodeid, fslocation): + self.sendevent( + "logwarning", + message=message, + code=code, + nodeid=nodeid, + fslocation=str(fslocation), + ) # the pytest_warning_captured hook was introduced in pytest 3.8 if hasattr(_pytest.hookspec, "pytest_warning_captured"): From b5c09f8e8488710bae276f4f41711613ce5053b1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 11 Dec 2018 18:49:40 -0200 Subject: [PATCH 14/35] Add CHANGELOG --- changelog/384.bugfix.rst | 2 +- changelog/390.bugfix.rst | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 changelog/390.bugfix.rst diff --git a/changelog/384.bugfix.rst b/changelog/384.bugfix.rst index 2ea011e..0dd2f03 100644 --- a/changelog/384.bugfix.rst +++ b/changelog/384.bugfix.rst @@ -1 +1 @@ -Add support for pytest 4.1. +pytest 4.1 support: ``ExceptionInfo`` API changes. diff --git a/changelog/390.bugfix.rst b/changelog/390.bugfix.rst new file mode 100644 index 0000000..a4ea70f --- /dev/null +++ b/changelog/390.bugfix.rst @@ -0,0 +1 @@ +pytest 4.1 support: ``pytest_logwarning`` hook removed. From 86bf3cb8b3bff46b2df5767accebbc6d67047ae4 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 12 Dec 2018 15:24:02 -0200 Subject: [PATCH 15/35] Release 1.25.0 --- CHANGELOG.rst | 31 +++++++++++++++++++++++++++++++ changelog/332.bugfix.rst | 1 - changelog/372.removal.rst | 1 - changelog/373.feature.rst | 1 - changelog/378.bugfix.rst | 1 - changelog/384.bugfix.rst | 1 - changelog/388.feature.rst | 3 --- changelog/390.bugfix.rst | 1 - 8 files changed, 31 insertions(+), 9 deletions(-) delete mode 100644 changelog/332.bugfix.rst delete mode 100644 changelog/372.removal.rst delete mode 100644 changelog/373.feature.rst delete mode 100644 changelog/378.bugfix.rst delete mode 100644 changelog/384.bugfix.rst delete mode 100644 changelog/388.feature.rst delete mode 100644 changelog/390.bugfix.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 915fc1c..a375432 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,34 @@ +pytest-xdist 1.25.0 (2018-12-12) +================================ + +Deprecations and Removals +------------------------- + +- `#372 `_: Pytest versions older than 3.6 are no longer supported. + + +Features +-------- + +- `#373 `_: Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines. + +- `#388 `_: ``mainargv`` is made available in ``workerinput`` from the host's ``sys.argv``. + + This can be used via ``request.config.workerinput["mainargv"]``. + + +Bug Fixes +--------- + +- `#332 `_: Fix report of module-level skips (``pytest.skip(reason, allow_module_level=True)``). + +- `#378 `_: Fix support for gevent monkeypatching + +- `#384 `_: pytest 4.1 support: ``ExceptionInfo`` API changes. + +- `#390 `_: pytest 4.1 support: ``pytest_logwarning`` hook removed. + + pytest-xdist 1.24.1 (2018-11-09) ================================ diff --git a/changelog/332.bugfix.rst b/changelog/332.bugfix.rst deleted file mode 100644 index 467c0e5..0000000 --- a/changelog/332.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix report of module-level skips (``pytest.skip(reason, allow_module_level=True)``). diff --git a/changelog/372.removal.rst b/changelog/372.removal.rst deleted file mode 100644 index ea14c5b..0000000 --- a/changelog/372.removal.rst +++ /dev/null @@ -1 +0,0 @@ -Pytest versions older than 3.6 are no longer supported. diff --git a/changelog/373.feature.rst b/changelog/373.feature.rst deleted file mode 100644 index 5a11da4..0000000 --- a/changelog/373.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Node setup information is hidden when pytest is run in quiet mode to reduce noise on many-core machines. diff --git a/changelog/378.bugfix.rst b/changelog/378.bugfix.rst deleted file mode 100644 index ceb0af8..0000000 --- a/changelog/378.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix support for gevent monkeypatching diff --git a/changelog/384.bugfix.rst b/changelog/384.bugfix.rst deleted file mode 100644 index 0dd2f03..0000000 --- a/changelog/384.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -pytest 4.1 support: ``ExceptionInfo`` API changes. diff --git a/changelog/388.feature.rst b/changelog/388.feature.rst deleted file mode 100644 index 57f5943..0000000 --- a/changelog/388.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -``mainargv`` is made available in ``workerinput`` from the host's ``sys.argv``. - -This can be used via ``request.config.workerinput["mainargv"]``. diff --git a/changelog/390.bugfix.rst b/changelog/390.bugfix.rst deleted file mode 100644 index a4ea70f..0000000 --- a/changelog/390.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -pytest 4.1 support: ``pytest_logwarning`` hook removed. From 2b658007388f99d01b34c176e3e12f46a914c5d5 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 12 Dec 2018 18:25:04 -0200 Subject: [PATCH 16/35] Fix test_remote_usage_prog which started to break with pytest@features --- testing/test_remote.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index d0e4757..42b28a7 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -1,4 +1,3 @@ -import os import py import pprint import pytest @@ -433,8 +432,6 @@ def test_remote_mainargv(testdir): def test_remote_usage_prog(testdir, request): if not hasattr(request.config._parser, "prog"): pytest.skip("prog not available in config parser") - prog = os.path.basename(sys.argv[0]) - testdir.makeconftest( """ import pytest @@ -462,5 +459,5 @@ def test_remote_usage_prog(testdir, request): result = testdir.runpytest_subprocess("-n1") assert result.ret == 1 result.stdout.fnmatch_lines( - ["usage: %s *" % prog, "%s: error: my_usage_error" % prog] + ["usage: pytest.py *", "pytest.py: error: my_usage_error"] ) From 261d4189f06b250fc1b4487bc47b345a95751947 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 8 Jan 2019 09:14:29 -0200 Subject: [PATCH 17/35] Skip config.warn tests in pytest 4.1 --- testing/acceptance_test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 2c026d4..44b2efd 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -738,10 +738,12 @@ def test_sub_plugins_disabled(testdir, plugin): class TestWarnings: @pytest.mark.parametrize("n", ["-n0", "-n1"]) @pytest.mark.parametrize("warn_type", ["pytest", "builtin"]) - def test_warnings(self, testdir, n, warn_type): + def test_warnings(self, testdir, n, request, warn_type): if warn_type == "builtin": warn_code = """warnings.warn(UserWarning('this is a warning'))""" elif warn_type == "pytest": + if not hasattr(request.config, "warn"): + pytest.skip("config.warn has been removed in pytest 4.1") warn_code = """request.config.warn('', 'this is a warning', fslocation=py.path.local())""" else: From 4632df37a6e00b7b1b059e8f3f5cc9b4147b20ac Mon Sep 17 00:00:00 2001 From: Alex Adamson Date: Wed, 21 Nov 2018 14:29:08 -0500 Subject: [PATCH 18/35] Check that we can serialize the warning detail attr --- xdist/remote.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/xdist/remote.py b/xdist/remote.py index b0092e0..1faf3b2 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -218,7 +218,15 @@ def serialize_warning_message(warning_message): for attr_name in warning_message._WARNING_DETAILS: if attr_name in ("message", "category"): continue - result[attr_name] = getattr(warning_message, attr_name) + attr = getattr(warning_message, attr_name) + # Check if we can serialize the warning detail, marking `None` otherwise + # Note that we need to define the attr (even as `None`) to allow deserializing + try: + dumps(attr) + except DumpError: + result[attr_name] = None + else: + result[attr_name] = attr return result From d55fab3aa7d585dde952afc6fb246bc4929ee156 Mon Sep 17 00:00:00 2001 From: Alex Adamson Date: Wed, 21 Nov 2018 14:35:01 -0500 Subject: [PATCH 19/35] Add changelog entry --- changelog/379.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/379.bugfix.rst diff --git a/changelog/379.bugfix.rst b/changelog/379.bugfix.rst new file mode 100644 index 0000000..f77ad12 --- /dev/null +++ b/changelog/379.bugfix.rst @@ -0,0 +1,2 @@ +Attributes of _WARNING_DETAILS are checked to make sure they can be dumped +prior to serializing the warning for submission to the master node. From fa85371c73b998743410a5bdb4a2f4842bed7ca8 Mon Sep 17 00:00:00 2001 From: Alex Adamson Date: Wed, 21 Nov 2018 15:26:35 -0500 Subject: [PATCH 20/35] Add test for #379 --- testing/acceptance_test.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 44b2efd..c0cefed 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -803,6 +803,37 @@ class TestWarnings: result = testdir.runpytest(n) result.stdout.fnmatch_lines(["*UserWarning*foo.txt*", "*1 passed, 1 warnings*"]) + @pytest.mark.parametrize("n", ["-n0", "-n1"]) + def test_unserializable_warning_details(self, testdir, n): + """Check that warnings with unserializable _WARNING_DETAILS are + handled correctly (#379). + """ + testdir.makepyfile( + """ + import warnings, pytest + import socket + import gc + def abuse_socket(): + s = socket.socket() + del s + + # Deliberately provoke a ResourceWarning for an unclosed socket. + # The socket itself will end up attached as a value in + # _WARNING_DETAIL. We need to test that it is not serialized + # (it can't be, so the test will fail if we try to). + def test_func(tmpdir): + warnings.resetwarnings() + warnings.simplefilter('always', ResourceWarning) + abuse_socket() + gc.collect() + """ + ) + testdir.syspathinsert() + result = testdir.runpytest(n) + result.stdout.fnmatch_lines( + ["*ResourceWarning*unclosed*", "*1 passed, 1 warnings*"] + ) + class TestNodeFailure: def test_load_single(self, testdir): From ac2bf10fe2c2d22cad4430f5f27b76ae6535ed71 Mon Sep 17 00:00:00 2001 From: Alex Adamson Date: Mon, 7 Jan 2019 18:43:59 -0500 Subject: [PATCH 21/35] Disable unserialized arguments check for py2 --- testing/acceptance_test.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index c0cefed..84c3bbe 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1,5 +1,6 @@ import os import re +import sys import textwrap import py @@ -808,6 +809,9 @@ class TestWarnings: """Check that warnings with unserializable _WARNING_DETAILS are handled correctly (#379). """ + if sys.version_info[0] < 3: + # The issue is only present in Python 3 warnings + return testdir.makepyfile( """ import warnings, pytest From f8d51aab57ebe0a8d579fadd3e30abb6091870c6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 8 Jan 2019 09:16:38 -0200 Subject: [PATCH 22/35] Do not change PYTHONPATH or sys.path on local workers Fix #376 --- changelog/376.feature.rst | 3 +++ xdist/remote.py | 19 +++++++++++-------- xdist/workermanage.py | 4 +++- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 changelog/376.feature.rst diff --git a/changelog/376.feature.rst b/changelog/376.feature.rst new file mode 100644 index 0000000..7dbbb01 --- /dev/null +++ b/changelog/376.feature.rst @@ -0,0 +1,3 @@ +The current directory is no longer added ``sys.path`` for local workers, only for remote connections. + +This behavior is surprising because it makes xdist runs and non-xdist runs to potentially behave differently. diff --git a/xdist/remote.py b/xdist/remote.py index b0092e0..58744d0 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -251,17 +251,20 @@ def remote_initconfig(option_dict, args): if __name__ == "__channelexec__": + import py + channel = channel # noqa - workerinput, args, option_dict = channel.receive() - importpath = os.getcwd() - sys.path.insert(0, importpath) # XXX only for remote situations - os.environ["PYTHONPATH"] = ( - importpath + os.pathsep + os.environ.get("PYTHONPATH", "") - ) + workerinput, args, option_dict, change_sys_path = channel.receive() + + if change_sys_path: + importpath = os.getcwd() + sys.path.insert(0, importpath) + os.environ["PYTHONPATH"] = ( + importpath + os.pathsep + os.environ.get("PYTHONPATH", "") + ) + os.environ["PYTEST_XDIST_WORKER"] = workerinput["workerid"] os.environ["PYTEST_XDIST_WORKER_COUNT"] = str(workerinput["workercount"]) - # os.environ['PYTHONPATH'] = importpath - import py config = remote_initconfig(option_dict, args) config._parser.prog = os.path.basename(workerinput["mainargv"][0]) diff --git a/xdist/workermanage.py b/xdist/workermanage.py index 111b86f..75465d0 100644 --- a/xdist/workermanage.py +++ b/xdist/workermanage.py @@ -245,7 +245,9 @@ class WorkerController(object): option_dict["basetemp"] = str(basetemp.join(name)) self.config.hook.pytest_configure_node(node=self) self.channel = self.gateway.remote_exec(xdist.remote) - self.channel.send((self.workerinput, args, option_dict)) + # change sys.path only for remote workers + change_sys_path = not self.gateway.spec.popen + self.channel.send((self.workerinput, args, option_dict, change_sys_path)) if self.putevent: self.channel.setcallback(self.process_from_remote, endmarker=self.ENDMARK) From 0ee219dc485fb7fd2d8aa10779577b975a8590cc Mon Sep 17 00:00:00 2001 From: Alex Adamson Date: Thu, 10 Jan 2019 15:45:48 -0500 Subject: [PATCH 23/35] Address comments --- changelog/379.bugfix.rst | 4 ++-- testing/acceptance_test.py | 3 +-- xdist/remote.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/changelog/379.bugfix.rst b/changelog/379.bugfix.rst index f77ad12..d569ce1 100644 --- a/changelog/379.bugfix.rst +++ b/changelog/379.bugfix.rst @@ -1,2 +1,2 @@ -Attributes of _WARNING_DETAILS are checked to make sure they can be dumped -prior to serializing the warning for submission to the master node. +Warning attributes are checked to make sure they can be dumped prior to +serializing the warning for submission to the master node. diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 84c3bbe..f462ecd 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -825,9 +825,8 @@ class TestWarnings: # The socket itself will end up attached as a value in # _WARNING_DETAIL. We need to test that it is not serialized # (it can't be, so the test will fail if we try to). + @pytest.mark.filterwarnings('always') def test_func(tmpdir): - warnings.resetwarnings() - warnings.simplefilter('always', ResourceWarning) abuse_socket() gc.collect() """ diff --git a/xdist/remote.py b/xdist/remote.py index 1faf3b2..2e97675 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -224,7 +224,7 @@ def serialize_warning_message(warning_message): try: dumps(attr) except DumpError: - result[attr_name] = None + result[attr_name] = repr(attr) else: result[attr_name] = attr return result From 242c00986629180057497c33637d8cf013364bf4 Mon Sep 17 00:00:00 2001 From: Alex Adamson Date: Thu, 10 Jan 2019 15:50:25 -0500 Subject: [PATCH 24/35] Remove trailing whitespace --- testing/acceptance_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index f462ecd..27f2c65 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -825,7 +825,7 @@ class TestWarnings: # The socket itself will end up attached as a value in # _WARNING_DETAIL. We need to test that it is not serialized # (it can't be, so the test will fail if we try to). - @pytest.mark.filterwarnings('always') + @pytest.mark.filterwarnings('always') def test_func(tmpdir): abuse_socket() gc.collect() From b9423d894c24937d280b688ab8d366a9c4e4cd80 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 10 Jan 2019 19:19:34 -0200 Subject: [PATCH 25/35] Fix linting --- testing/acceptance_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 27f2c65..e0d4770 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -825,7 +825,7 @@ class TestWarnings: # The socket itself will end up attached as a value in # _WARNING_DETAIL. We need to test that it is not serialized # (it can't be, so the test will fail if we try to). - @pytest.mark.filterwarnings('always') + @pytest.mark.filterwarnings('always') def test_func(tmpdir): abuse_socket() gc.collect() From 45ddc221efceb18de27af93c55510190b6f3fb53 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 11 Jan 2019 15:19:37 -0200 Subject: [PATCH 26/35] Release 1.26.0 --- CHANGELOG.rst | 18 ++++++++++++++++++ changelog/376.feature.rst | 3 --- changelog/379.bugfix.rst | 2 -- 3 files changed, 18 insertions(+), 5 deletions(-) delete mode 100644 changelog/376.feature.rst delete mode 100644 changelog/379.bugfix.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a375432..d8e230a 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,21 @@ +pytest-xdist 1.26.0 (2019-01-11) +================================ + +Features +-------- + +- `#376 `_: The current directory is no longer added ``sys.path`` for local workers, only for remote connections. + + This behavior is surprising because it makes xdist runs and non-xdist runs to potentially behave differently. + + +Bug Fixes +--------- + +- `#379 `_: Warning attributes are checked to make sure they can be dumped prior to + serializing the warning for submission to the master node. + + pytest-xdist 1.25.0 (2018-12-12) ================================ diff --git a/changelog/376.feature.rst b/changelog/376.feature.rst deleted file mode 100644 index 7dbbb01..0000000 --- a/changelog/376.feature.rst +++ /dev/null @@ -1,3 +0,0 @@ -The current directory is no longer added ``sys.path`` for local workers, only for remote connections. - -This behavior is surprising because it makes xdist runs and non-xdist runs to potentially behave differently. diff --git a/changelog/379.bugfix.rst b/changelog/379.bugfix.rst deleted file mode 100644 index d569ce1..0000000 --- a/changelog/379.bugfix.rst +++ /dev/null @@ -1,2 +0,0 @@ -Warning attributes are checked to make sure they can be dumped prior to -serializing the warning for submission to the master node. From 1276df4cfa4c0ee819827d1a7f01d28398173051 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 11 Jan 2019 21:59:33 -0200 Subject: [PATCH 27/35] Add docs for sys.argv access from workers --- README.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.rst b/README.rst index a863421..072e5b0 100644 --- a/README.rst +++ b/README.rst @@ -223,6 +223,12 @@ defined: The information about the worker_id in a test is stored in the ``TestReport`` as well, under the ``worker_id`` attribute. +Acessing ``sys.argv`` from the master node in workers +----------------------------------------------------- + +To access the ``sys.argv`` passed to the command-line of the master node, use +``request.config.workerinput["mainargv"]``. + Specifying test exec environments in an ini file ------------------------------------------------ From f6ecaa9b7f33031d571cca44efa74a02e00dcff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= Date: Mon, 14 Jan 2019 22:59:33 +0100 Subject: [PATCH 28/35] Fix ResourceWarning: unclosed file in setup.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also uniformize the usage of the 'with' context manager. Signed-off-by: Mickaƫl Schoentgen --- setup.py | 5 ++++- testing/acceptance_test.py | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index b830492..03ee47a 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,15 @@ from setuptools import setup, find_packages install_requires = ["execnet>=1.1", "pytest>=3.6.0", "pytest-forked", "six"] +with open("README.rst") as f: + long_description = f.read() + setup( name="pytest-xdist", use_scm_version={"write_to": "xdist/_version.py"}, description="pytest xdist plugin for distributed testing" " and loop-on-failing modes", - long_description=open("README.rst").read(), + long_description=long_description, license="MIT", author="holger krekel and contributors", author_email="pytest-dev@python.org,holger@merlinux.eu", diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index e0d4770..9a8e42b 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -490,9 +490,8 @@ def test_session_hooks(testdir): name = "worker" else: name = "master" - f = open(name, "w") - f.write("xy") - f.close() + with open(name, "w") as f: + f.write("xy") # let's fail on the worker if name == "worker": raise ValueError(42) From 1dec9dc246628af9934af5bfd64de299719d712d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 14 Jan 2019 21:59:05 -0200 Subject: [PATCH 29/35] ReprEntry objects no longer have the `localssep` attribute The attribute was not used anywhere and has been removed in pytest-dev/pytest#4615 --- testing/test_remote.py | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index 42b28a7..649739f 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -153,7 +153,6 @@ class TestReportSerialization: for i in range(len(a_entries)): assert isinstance(rep_entries[i], ReprEntry) assert rep_entries[i].lines == a_entries[i].lines - assert rep_entries[i].localssep == a_entries[i].localssep assert rep_entries[i].reprfileloc.lineno == a_entries[i].reprfileloc.lineno assert ( rep_entries[i].reprfileloc.message == a_entries[i].reprfileloc.message From c5f65b39ecb4992feef28adfc7186912f398a0f7 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 28 Jan 2019 18:05:41 -0200 Subject: [PATCH 30/35] Do not implement pytest_logwarning in pytest versions where it is deprecated Fix #406 --- changelog/406.bugfix.rst | 1 + xdist/remote.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelog/406.bugfix.rst diff --git a/changelog/406.bugfix.rst b/changelog/406.bugfix.rst new file mode 100644 index 0000000..0f5e41a --- /dev/null +++ b/changelog/406.bugfix.rst @@ -0,0 +1 @@ +Do not implement deprecated ``pytest_logwarning`` hook in pytest versions where it is deprecated. diff --git a/xdist/remote.py b/xdist/remote.py index 1cde135..1ea8898 100644 --- a/xdist/remote.py +++ b/xdist/remote.py @@ -115,8 +115,10 @@ class WorkerInteractor(object): data = serialize_report(report) self.sendevent("collectreport", data=data) - # the pytest_logwarning hook was removed in pytest 4.1 - if hasattr(_pytest.hookspec, "pytest_logwarning"): + # the pytest_logwarning hook was deprecated since pytest 4.0 + if hasattr( + _pytest.hookspec, "pytest_logwarning" + ) and not _pytest.hookspec.pytest_logwarning.pytest_spec.get("warn_on_impl"): def pytest_logwarning(self, message, code, nodeid, fslocation): self.sendevent( From 6fc02bb04a96a46c1e692155e181db5ac254a59e Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 28 Jan 2019 18:07:36 -0200 Subject: [PATCH 31/35] Release 1.26.1 --- CHANGELOG.rst | 9 +++++++++ changelog/406.bugfix.rst | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) delete mode 100644 changelog/406.bugfix.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d8e230a..32b77e6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,12 @@ +pytest-xdist 1.26.1 (2019-01-28) +================================ + +Bug Fixes +--------- + +- `#406 `_: Do not implement deprecated ``pytest_logwarning`` hook in pytest versions where it is deprecated. + + pytest-xdist 1.26.0 (2019-01-11) ================================ diff --git a/changelog/406.bugfix.rst b/changelog/406.bugfix.rst deleted file mode 100644 index 0f5e41a..0000000 --- a/changelog/406.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Do not implement deprecated ``pytest_logwarning`` hook in pytest versions where it is deprecated. From d8a794bc842d3ba8dcf4294c39287f5822ec0078 Mon Sep 17 00:00:00 2001 From: Jiri Kuncar Date: Tue, 12 Feb 2019 14:36:19 +0100 Subject: [PATCH 32/35] Improve behavior of -n=auto with --pdb option --- changelog/415.feature | 1 + testing/test_plugin.py | 6 ++++++ xdist/plugin.py | 17 ++++++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 changelog/415.feature diff --git a/changelog/415.feature b/changelog/415.feature new file mode 100644 index 0000000..bb63455 --- /dev/null +++ b/changelog/415.feature @@ -0,0 +1 @@ +Improve behavior of ``--numprocesses=auto`` to work well with ``--pdb`` option. diff --git a/testing/test_plugin.py b/testing/test_plugin.py index 0ea5b74..dc0fc51 100644 --- a/testing/test_plugin.py +++ b/testing/test_plugin.py @@ -36,6 +36,7 @@ def test_dist_options(testdir): def test_auto_detect_cpus(testdir, monkeypatch): import os + from xdist.plugin import pytest_cmdline_main as check_options if hasattr(os, "sched_getaffinity"): monkeypatch.setattr(os, "sched_getaffinity", lambda _pid: set(range(99))) @@ -52,6 +53,11 @@ def test_auto_detect_cpus(testdir, monkeypatch): config = testdir.parseconfigure("-nauto") assert config.getoption("numprocesses") == 99 + config = testdir.parseconfigure("-nauto", "--pdb") + check_options(config) + assert config.getoption("usepdb") + assert config.getoption("numprocesses") == 0 + monkeypatch.delattr(os, "sched_getaffinity", raising=False) monkeypatch.setenv("TRAVIS", "true") config = testdir.parseconfigure("-nauto") diff --git a/xdist/plugin.py b/xdist/plugin.py index 3cff561..c727594 100644 --- a/xdist/plugin.py +++ b/xdist/plugin.py @@ -27,10 +27,14 @@ def auto_detect_cpus(): return n if n else 1 +class AutoInt(int): + """Mark value as auto-detected.""" + + def parse_numprocesses(s): if s == "auto": - return auto_detect_cpus() - else: + return AutoInt(auto_detect_cpus()) + elif s is not None: return int(s) @@ -45,7 +49,7 @@ def pytest_addoption(parser): type=parse_numprocesses, help="shortcut for '--dist=load --tx=NUM*popen', " "you can use 'auto' here for auto detection CPUs number on " - "host system", + "host system and it will be 0 when used with --pdb", ) group.addoption( "--maxprocesses", @@ -177,6 +181,10 @@ def pytest_configure(config): @pytest.mark.tryfirst def pytest_cmdline_main(config): + usepdb = config.getoption("usepdb") # a core option + if isinstance(config.option.numprocesses, AutoInt): + config.option.numprocesses = 0 if usepdb else int(config.option.numprocesses) + if config.option.numprocesses: if config.option.dist == "no": config.option.dist = "load" @@ -188,11 +196,10 @@ def pytest_cmdline_main(config): config.option.dist = "load" val = config.getvalue if not val("collectonly"): - usepdb = config.getoption("usepdb") # a core option if val("dist") != "no": if usepdb: raise pytest.UsageError( - "--pdb is incompatible with distributing tests; try using -n0." + "--pdb is incompatible with distributing tests; try using -n0 or -nauto." ) # noqa: E501 From ca58e5e7ed453ce41e9dfef71881cb15612cba10 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 13 Feb 2019 15:20:32 -0200 Subject: [PATCH 33/35] Fix test_remote_usage_prog after changes in pytest features branch --- testing/test_remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index 649739f..f17e21e 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -458,5 +458,5 @@ def test_remote_usage_prog(testdir, request): result = testdir.runpytest_subprocess("-n1") assert result.ret == 1 result.stdout.fnmatch_lines( - ["usage: pytest.py *", "pytest.py: error: my_usage_error"] + ["*usage: pytest.py *", "pytest.py: error: my_usage_error"] ) From 93780dcccc5463920ebfc2090c1e42ac588c1091 Mon Sep 17 00:00:00 2001 From: Jiri Kuncar Date: Fri, 15 Feb 2019 10:54:18 +0100 Subject: [PATCH 34/35] Simpler usage error in test_remote_usage_prog --- testing/test_remote.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index f17e21e..65ff6ac 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -458,5 +458,5 @@ def test_remote_usage_prog(testdir, request): result = testdir.runpytest_subprocess("-n1") assert result.ret == 1 result.stdout.fnmatch_lines( - ["*usage: pytest.py *", "pytest.py: error: my_usage_error"] + ["*usage: *", "*error: my_usage_error"] ) From 6d544cef9acc0c7ed378e4795a877e716f9cd72c Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Fri, 15 Feb 2019 08:37:57 -0200 Subject: [PATCH 35/35] Fix linting --- testing/test_remote.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/testing/test_remote.py b/testing/test_remote.py index 65ff6ac..c134a9e 100644 --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -457,6 +457,4 @@ def test_remote_usage_prog(testdir, request): result = testdir.runpytest_subprocess("-n1") assert result.ret == 1 - result.stdout.fnmatch_lines( - ["*usage: *", "*error: my_usage_error"] - ) + result.stdout.fnmatch_lines(["*usage: *", "*error: my_usage_error"])