From 038a59eebcde364c7bdee22fd584e67af0c52bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionel=20Cristian=20M=C4=83rie=C8=99?= Date: Fri, 20 Dec 2019 02:00:02 +0200 Subject: [PATCH 1/3] =?UTF-8?q?Fix=20regression=20with=20custom=20argument?= =?UTF-8?q?s=20being=20dropped=20in=20non-local=E2=80=A6=20(#491)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * No idea what I'm doing. * Extend integration test to cover ac3f6a78c7401aba9b62c2c67f280a129ae84eaf. * Remove useless output to stop failing other tests. * Reformat. * Upgrade virtualenv to see if it fixes py34 builds * Add CHANGELOG entry * Make foobarplugin part of the test only * Fix language_version in pre-commit for rst * Fix test in Python 2 Co-authored-by: Bruno Oliveira --- .appveyor.yml | 2 +- .pre-commit-config.yaml | 2 +- changelog/{486.feature => 486.feature.rst} | 0 changelog/491.bugfix.rst | 1 + src/xdist/workermanage.py | 1 + testing/acceptance_test.py | 35 ++++++++++++++++++++-- 6 files changed, 37 insertions(+), 4 deletions(-) rename changelog/{486.feature => 486.feature.rst} (100%) create mode 100644 changelog/491.bugfix.rst diff --git a/.appveyor.yml b/.appveyor.yml index ea522dc..8ece168 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,7 +10,7 @@ environment: - TOXENV: "py38-pytestfeatures" install: - - C:\Python38\python -m pip install -U pip setuptools + - C:\Python38\python -m pip install -U pip setuptools virtualenv - C:\Python38\python -m pip install -U tox setuptools_scm build: false # Not a C# project, build stuff at the test step instead. diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04f86d5..9bd71da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,4 +21,4 @@ repos: files: ^(CHANGELOG.rst|HOWTORELEASE.rst|README.rst|changelog/.*)$ language: python additional_dependencies: [pygments, restructuredtext_lint] - python_version: python3.7 + language_version: python3.7 diff --git a/changelog/486.feature b/changelog/486.feature.rst similarity index 100% rename from changelog/486.feature rename to changelog/486.feature.rst diff --git a/changelog/491.bugfix.rst b/changelog/491.bugfix.rst new file mode 100644 index 0000000..4f70423 --- /dev/null +++ b/changelog/491.bugfix.rst @@ -0,0 +1 @@ +Fix regression that caused custom plugin command-line arguments to be discarded when using ``--tx`` mode. diff --git a/src/xdist/workermanage.py b/src/xdist/workermanage.py index d95b481..5f30edf 100644 --- a/src/xdist/workermanage.py +++ b/src/xdist/workermanage.py @@ -190,6 +190,7 @@ def make_reltoroot(roots, args): parts = arg.split(splitcode) fspath = py.path.local(parts[0]) if not fspath.exists(): + result.append(arg) continue for root in roots: x = fspath.relto(root) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 4537fd0..d93f08e 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -186,16 +186,46 @@ class TestDistribution: ) assert result.ret == 1 - def test_distribution_rsyncdirs_example(self, testdir): + def test_distribution_rsyncdirs_example(self, testdir, monkeypatch): + # use a custom plugin that has a custom command-line option to ensure + # this is propagated to workers (see #491) + testdir.makepyfile( + **{ + "myplugin/src/foobarplugin.py": """ + from __future__ import print_function + + import os + import sys + import pytest + + def pytest_addoption(parser): + parser.addoption("--foobar", action="store", dest="foobar_opt") + + @pytest.mark.tryfirst + def pytest_load_initial_conftests(early_config): + opt = early_config.known_args_namespace.foobar_opt + print("--foobar=%s active! [%s]" % (opt, os.getpid()), file=sys.stderr) + """ + } + ) + assert (testdir.tmpdir / "myplugin/src/foobarplugin.py").check(file=1) + monkeypatch.setenv( + "PYTHONPATH", str(testdir.tmpdir / "myplugin/src"), prepend=os.pathsep + ) + source = testdir.mkdir("source") dest = testdir.mkdir("dest") subdir = source.mkdir("example_pkg") subdir.ensure("__init__.py") p = subdir.join("test_one.py") p.write("def test_5():\n assert not __file__.startswith(%r)" % str(p)) - result = testdir.runpytest( + result = testdir.runpytest_subprocess( "-v", "-d", + "-s", + "-pfoobarplugin", + "--foobar=123", + "--dist=load", "--rsyncdir=%(subdir)s" % locals(), "--tx=popen//chdir=%(dest)s" % locals(), p, @@ -209,6 +239,7 @@ class TestDistribution: "*1 passed*", ] ) + result.stderr.fnmatch_lines(["--foobar=123 active! *"]) assert dest.join(subdir.basename).check(dir=1) def test_backward_compatibility_worker_terminology(self, testdir): From 1e284d31d03304bba5ac5dc92ddfb82e88fd2cf0 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 19 Dec 2019 22:25:42 -0300 Subject: [PATCH 2/3] Move 1.30.0 changelog to the top (by mistake?) --- CHANGELOG.rst | 66 +++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ff35bfe..d58f3a3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,36 @@ +.. + You should *NOT* be adding new change log entries to this file, this + file is managed by towncrier. You *may* edit previous change logs to + fix problems like typo corrections or such. + To add a new change log entry, please see + https://pip.pypa.io/en/latest/development/#adding-a-news-entry + We named the news folder ``changelog`` + +.. towncrier release notes start + +pytest-xdist 1.30.0 (2019-10-01) +================================ + +Features +-------- + +- `#448 `_: Initialization between workers and master nodes is now more consistent, which fixes a number of + long-standing issues related to startup with the ``-c`` option. + + Issues: + + * `#6 `__: Poor interaction between ``-n#`` and ``-c X.cfg`` + * `#445 `__: pytest-xdist is not reporting the same nodeid as pytest does + + This however only works with **pytest 5.1 or later**, as it required changes in pytest itself. + + +Bug Fixes +--------- + +- `#467 `_: Fix crash issues related to running xdist with the terminal plugin disabled. + + pytest-xdist 1.29.0 (2019-06-14) ================================ @@ -401,39 +434,6 @@ Improved Documentation - Added ``HOWTORELEASE`` documentation. (#155) -.. - You should *NOT* be adding new change log entries to this file, this - file is managed by towncrier. You *may* edit previous change logs to - fix problems like typo corrections or such. - To add a new change log entry, please see - https://pip.pypa.io/en/latest/development/#adding-a-news-entry - We named the news folder ``changelog`` - -.. towncrier release notes start - -pytest-xdist 1.30.0 (2019-10-01) -================================ - -Features --------- - -- `#448 `_: Initialization between workers and master nodes is now more consistent, which fixes a number of - long-standing issues related to startup with the ``-c`` option. - - Issues: - - * `#6 `__: Poor interaction between ``-n#`` and ``-c X.cfg`` - * `#445 `__: pytest-xdist is not reporting the same nodeid as pytest does - - This however only works with **pytest 5.1 or later**, as it required changes in pytest itself. - - -Bug Fixes ---------- - -- `#467 `_: Fix crash issues related to running xdist with the terminal plugin disabled. - - 1.17.0 ------ From 1f139a85d702e18dde3682e862c608f7261767ed Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 19 Dec 2019 22:28:21 -0300 Subject: [PATCH 3/3] Release 1.31.0 --- CHANGELOG.rst | 22 ++++++++++++++-------- changelog/486.feature.rst | 1 - changelog/491.bugfix.rst | 1 - 3 files changed, 14 insertions(+), 10 deletions(-) delete mode 100644 changelog/486.feature.rst delete mode 100644 changelog/491.bugfix.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d58f3a3..e6ac0c0 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,12 +1,18 @@ -.. - You should *NOT* be adding new change log entries to this file, this - file is managed by towncrier. You *may* edit previous change logs to - fix problems like typo corrections or such. - To add a new change log entry, please see - https://pip.pypa.io/en/latest/development/#adding-a-news-entry - We named the news folder ``changelog`` +pytest-xdist 1.31.0 (2019-12-19) +================================ + +Features +-------- + +- `#486 `_: Add support for Python 3.8. + + +Bug Fixes +--------- + +- `#491 `_: Fix regression that caused custom plugin command-line arguments to be discarded when using ``--tx`` mode. + -.. towncrier release notes start pytest-xdist 1.30.0 (2019-10-01) ================================ diff --git a/changelog/486.feature.rst b/changelog/486.feature.rst deleted file mode 100644 index 746bc5f..0000000 --- a/changelog/486.feature.rst +++ /dev/null @@ -1 +0,0 @@ -Add support for Python 3.8. diff --git a/changelog/491.bugfix.rst b/changelog/491.bugfix.rst deleted file mode 100644 index 4f70423..0000000 --- a/changelog/491.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Fix regression that caused custom plugin command-line arguments to be discarded when using ``--tx`` mode.