psf / black

The uncompromising Python code formatter
https://black.readthedocs.io/en/stable/
MIT License
38.94k stars 2.46k forks source link

Unit tests locally failing with 'DeprecationWarning: The --rsyncdir command...' #3805

Open tadeja opened 1 year ago

tadeja commented 1 year ago

The same error as reported before in closed #3357 still happens when running unit tests locally now with pytest-cov==4.1.0 pytest-xdist==3.3.1

To Reproduce Run unit tests

(.venv) % tox -e py
...
...
Successfully built black
Installing collected packages: typing-extensions, pathspec, mypy-extensions, multidict, idna, frozenlist, click, charset-normalizer, attrs, async-timeout, yarl, black, aiosignal, aiohttp
Successfully installed aiohttp-3.8.5 aiosignal-1.3.1 async-timeout-4.0.2 attrs-23.1.0 black-23.7.1.dev13+g0b301f8.d20230722 charset-normalizer-3.2.0 click-8.1.6 frozenlist-1.4.0 idna-3.4 multidict-6.0.4 mypy-extensions-1.0.0 pathspec-0.11.1 typing-extensions-4.7.1 yarl-1.9.2
py: commands[1]> coverage erase
py: commands[2]> pytest tests --run-optional no_jupyter --numprocesses auto --cov
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/_pytest/main.py", line 266, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1054, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/pluggy/_hooks.py", line 452, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self._hookimpls, kwargs, False)
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/pluggy/_manager.py", line 112, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/pluggy/_callers.py", line 116, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/pluggy/_callers.py", line 80, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/site-packages/xdist/plugin.py", line 252, in pytest_configure
INTERNALERROR>     config.issue_config_time_warning(warning, 2)
INTERNALERROR>   File "/Users/user/Documents/black/.tox/py/lib/python3.9/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.
py: exit 3 (0.50 seconds) /Users/user/Documents/black> pytest tests --run-optional no_jupyter --numprocesses auto --cov pid=48636
  py: FAIL code 3 (9.34=setup[4.63]+cmd[3.73,0.49,0.50] seconds)
  evaluation failed :( (9.39 seconds)

Environment Black's version: main OS and Python version: macOS/Python 3.11.4 and Python 3.9.6

Additional context A temporary work-around as suggested here https://github.com/pytest-dev/pytest-xdist/issues/825#issuecomment-1292450429 could be to add the filter to pyproject.toml:

filterwarnings = [
    "error",
...,
    '''ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning'''
]

Also: Fixed by not running PyPy with coverage Originally posted by @hauntsaninja in https://github.com/psf/black/issues/3772#issuecomment-1629518322

jnhyperion commented 1 year ago

same error, try this tox -e ci-py39 -- -v --color=yes run against a certain python version.