kevlened / pytest-parallel

A pytest plugin for parallel and concurrent testing
https://github.com/browsertron/pytest-parallel/issues/104#issuecomment-1293941066
MIT License
313 stars 59 forks source link

Latest pytest (7.2.0) breaks pytest-parallel. #118

Open huntzhan opened 1 year ago

huntzhan commented 1 year ago

pytest just release a new version (7.1.3 -> 7.2.0) that breaks pytest-parallel. Error log:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/_pytest/main.py", line 266, in wrap_session
INTERNALERROR>     config._do_configure()
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1037, in _do_configure
INTERNALERROR>     self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/pluggy/_hooks.py", line 277, in call_historic
INTERNALERROR>     res = self._hookexec(self.name, self.get_hookimpls(), kwargs, False)
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/opt/_internal/cpython-3.9.15/lib/python3.9/site-packages/pytest_parallel/__init__.py", line [11](https://github.com/vkit-x/vkit/actions/runs/3319272786/jobs/5484223267#step:8:12)1, in pytest_configure
INTERNALERROR>     config.pluginmanager.register(ParallelRunner(config), 'parallelrunner')
INTERNALERROR>   File "/opt/_internal/cpython-3.9.[15](https://github.com/vkit-x/vkit/actions/runs/3319272786/jobs/5484223267#step:8:16)/lib/python3.9/site-packages/pytest_parallel/__init__.py", line [19](https://github.com/vkit-x/vkit/actions/runs/3319272786/jobs/5484223267#step:8:20)6, in __init__
INTERNALERROR>     self._log = py.log.Producer('pytest-parallel')
INTERNALERROR> AttributeError: module 'py' has no attribute 'log'
The-Compiler commented 1 year ago

See https://github.com/pytest-dev/pytest/issues/10420#issuecomment-1290373344 for a similar issue. If pytest-parallel needs things in pylib outside of py.path, it should declare py as a dependency properly, which it currently does not.

huntzhan commented 1 year ago

got it, thx

The-Compiler commented 1 year ago

@huntzhan Huh? This is a bug in pytest-parallel, so this shouldn't be closed until it's fixed here.

huntzhan commented 1 year ago

@huntzhan Huh? This is a bug in pytest-parallel, so this shouldn't be closed until it's fixed here.

Oh, I thought there's another issue to track the similar issue. Reopen again.

The-Compiler commented 1 year ago

Note the immediate fix for this is for pytest-parallel to add the missing py dependency. As a workaround, you can install py yourself and things should start working.

In the long run, however, pytest-parallel should stop depending on pylib entirely, since we (pytest/pylib maintainers) want to sunset it. It's only used for logging. I'm not too familiar with py.log, but the Python stdlib logging might be a suitable replacement?

huntzhan commented 1 year ago

@The-Compiler Thanks for your instruction!

kevlened commented 1 year ago

Please see https://github.com/kevlened/pytest-parallel/pull/119#issuecomment-1294035423

Unfortunately, I recommend version pinning to pytest 7.1.3 while planning a move to pytest-xdist

The-Compiler commented 1 year ago

No need to pin, just add py to your dependencies manually.