Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of deprecated rsyncdir, which will be removed in pytest-xdist 4.0 #621

Open
parthea opened this issue Nov 28, 2023 · 2 comments

Comments

@parthea
Copy link

parthea commented Nov 28, 2023

Summary

This issue is related to #557 which is closed.

The rsyncdir argument is deprecated and will be removed in pytest-xdist 4.0. It's currently used in the line below:

self.config.option.rsyncdir.append(self.cov_config)

See other usage here:
https://github.com/search?q=repo%3Apytest-dev%2Fpytest-cov%20rsyncdir&type=code

Expected vs actual result

When using pytest-cov I didn't expect to see warnings. A warning appears due to usage of rsyncdir which is deprecated.

py.test -n=auto --cov=test
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/_pytest/main.py", line 267, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1053, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/pluggy/_hooks.py", line 514, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls, kwargs, False)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/pluggy/_callers.py", line 113, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/xdist/plugin.py", line 252, in pytest_configure
INTERNALERROR>     config.issue_config_time_warning(warning, 2)
INTERNALERROR>   File "/usr/local/google/home/partheniou/.pyenv/versions/3.12.0/envs/testpycov/lib/python3.12/site-packages/_pytest/config/__init__.py", line 1465, in issue_config_time_warning
INTERNALERROR>     warnings.warn(warning, stacklevel=stacklevel)
INTERNALERROR> DeprecationWarning: The --rsyncdir command line argument and rsyncdirs config variable are deprecated.
INTERNALERROR> The rsync feature will be removed in pytest-xdist 4.0.

Reproducer

Create a pytest.ini file to treat warnings as errors

[pytest]
filterwarnings =
    # treat all warnings as errors
    error
pip install pytest-cov
pip install pytest-xdist
py.test -n=auto --cov=test

Versions

Output of relevant packages pip list, python --version, pytest --version etc.

(testpycov) partheniou@partheniou-vm-3:~/git/python-bigquery-storage$ pip list
Package      Version
------------ -------
coverage     7.3.2
execnet      2.0.2
iniconfig    2.0.0
packaging    23.2
pip          23.2.1
pluggy       1.3.0
pytest       7.4.3
pytest-cov   4.1.0
pytest-xdist 3.5.0
(testpycov) partheniou@partheniou-vm-3:~/git/python-bigquery-storage$ python --version
Python 3.12.0
(testpycov) partheniou@partheniou-vm-3:~/git/python-bigquery-storage$ pytest --version
pytest 7.4.3

Make sure you include complete output of tox if you use it (it will show versions of various things).

Config

Include your tox.ini, pytest.ini, .coveragerc, setup.cfg or any relevant configuration.

pytest.ini

[pytest]
filterwarnings =
    # treat all warnings as errors
    error

.coveragerc

[run]
branch = True
omit =
  gapic/cli/*.py
  *_pb2.py

[report]
fail_under = 100
show_missing = True
exclude_lines =
    # Re-enable the standard pragma
    pragma: NO COVER
    # Enable an English version.
    Impossible; skip coverage checks.
    # Ignore debug-only repr
    def __repr__
    # Abstract methods by definition are not invoked
    @abstractmethod
    @abc.abstractmethod
    

Code

Link to your repository, gist, pastebin or just paste raw code that illustrates the issue.
I tested this in https://github.com/googleapis/python-bigquery-storage but I can produce the issue in other repositories as well.

If you paste raw code make sure you quote it, eg:

def foobar():
    pass
@f0uriest
Copy link

f0uriest commented Mar 8, 2024

Has anyone found a workaround for this until it's properly fixed?

@ionelmc
Copy link
Member

ionelmc commented Mar 17, 2024

In master now, will cut a release soon (need to sort out the tests).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants