From ed65e888cf977befd8a2c83574aa124fb6976185 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 24 Oct 2022 08:56:27 -0300 Subject: [PATCH 1/2] Deprecate rsync support Fix #825 --- docs/index.rst | 2 +- docs/remote.rst | 11 +++++++++++ src/xdist/newhooks.py | 8 ++++++-- src/xdist/plugin.py | 7 +++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index b7b8d139..78555b7e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -34,7 +34,7 @@ Features * ``--looponfail``: run your tests repeatedly in a subprocess. After each run pytest waits until a file in your project changes and then re-runs the previously failing tests. This is repeated until all tests pass - after which again a full run is performed. + after which again a full run is performed (DEPRECATED). * :ref:`Multi-Platform` coverage: you can specify different Python interpreters or different platforms and run tests in parallel on all of them. diff --git a/docs/remote.rst b/docs/remote.rst index 997bef37..a0d7b434 100644 --- a/docs/remote.rst +++ b/docs/remote.rst @@ -5,6 +5,17 @@ Sending tests to remote SSH accounts ==================================== +.. deprecated:: 3.0 + +.. warning:: + + This feature is deprecated because the support for ``rsync`` is faulty + in terms of reproducing the development environment in the remote + worker, and there is no clear solution moving forward. + + This feature is scheduled to be removed in release 4.0, to let the team + focus on a smaller set of features. + Suppose you have a package ``mypkg`` which contains some tests that you can successfully run locally. And you have a ssh-reachable machine ``myhost``. Then diff --git a/src/xdist/newhooks.py b/src/xdist/newhooks.py index 77766244..384cde7e 100644 --- a/src/xdist/newhooks.py +++ b/src/xdist/newhooks.py @@ -24,12 +24,16 @@ def pytest_xdist_newgateway(gateway): """called on new raw gateway creation.""" -@pytest.hookspec() +@pytest.hookspec( + warn_on_impl="rsync feature is deprecated and will be removed in pytest-xdist 4.0" +) def pytest_xdist_rsyncstart(source, gateways): """called before rsyncing a directory to remote gateways takes place.""" -@pytest.hookspec() +@pytest.hookspec( + warn_on_impl="rsync feature is deprecated and will be removed in pytest-xdist 4.0" +) def pytest_xdist_rsyncfinish(source, gateways): """called after rsyncing a directory to remote gateways takes place.""" diff --git a/src/xdist/plugin.py b/src/xdist/plugin.py index 09301cc9..a4e92846 100644 --- a/src/xdist/plugin.py +++ b/src/xdist/plugin.py @@ -204,6 +204,13 @@ def pytest_configure(config): ) config.issue_config_time_warning(warning, 2) + if config.getoption("rsyncdir", None) or config.getini("rsyncdirs"): + warning = DeprecationWarning( + "The --rsyncdir command line argument and rsyncdirs config variable are deprecated.\n" + "The rsync feature will be removed in pytest-xdist 4.0." + ) + config.issue_config_time_warning(warning, 2) + config_line = ( "xdist_group: specify group for tests should run in same session." "in relation to one another. " + "Provided by pytest-xdist." From 1e9f6a7c3c6c037e9e345daa740a3562f47d247d Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 24 Oct 2022 12:02:42 -0300 Subject: [PATCH 2/2] Fix type annotation for pytest 6.2 --- src/xdist/looponfail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/xdist/looponfail.py b/src/xdist/looponfail.py index 7f3ea92b..77eff04f 100644 --- a/src/xdist/looponfail.py +++ b/src/xdist/looponfail.py @@ -44,7 +44,7 @@ def pytest_cmdline_main(config): return 2 # looponfail only can get stop with ctrl-C anyway -def looponfail_main(config: pytest.Config) -> None: +def looponfail_main(config: "pytest.Config") -> None: remotecontrol = RemoteControl(config) config_roots = config.getini("looponfailroots") if not config_roots: