Teemu / pytest-sugar

a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)
Other
1.32k stars 74 forks source link

Don't work any more with pytest 7.2.0 #243

Closed Alcolo47 closed 2 years ago

Alcolo47 commented 2 years ago

When reporting an issue, include a way to reproduce the bug. For example:

Command used to run pytest

$ pip install pytest==7.2.0 pytest-sugar==0.9.5
$ pytest
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/_pytest/main.py", line 268, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/steph/GIT/time_server/venv/lib/python3.10/site-packages/pytest_sugar.py", line 242, in pytest_sessionstart
INTERNALERROR>     self._sessionstarttime = py.std.time.time()
INTERNALERROR> AttributeError: module 'py' has no attribute 'std'
(
Alcolo47 commented 2 years ago

Probably related to #242

alexcjohnson commented 2 years ago

@Alcolo47 duplicate of #241?

0x78f1935 commented 2 years ago

Same here

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\_pytest\main.py", line 268, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\pluggy\_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\pluggy\_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\pluggy\_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\pluggy\_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\pluggy\_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "d:\private\some-project\venv\lib\site-packages\pytest_sugar.py", line 242, in pytest_sessionstart
INTERNALERROR>     self._sessionstarttime = py.std.time.time()
INTERNALERROR> AttributeError: module 'py' has no attribute 'std'

If you need a quick-fix: add py>==1.11.0 to your pytest requirements.

Apparently, the module py has been removed as dependency from pytest>7

tobiasmcnulty commented 2 years ago

We are having the same issue (AttributeError: module 'py' has no attribute 'std'); installing the py package manually fixes it. But I imagine pytest-sugar should depend on py directly now or vendor the applicable code (as pytest did in 7.2.0: https://docs.pytest.org/en/7.2.x/changelog.html#deprecations).

alexcjohnson commented 2 years ago

@tobiasmcnulty see #241 - py has a known vulnerability so the ideal solution would avoid it entirely - hence #242

tobiasmcnulty commented 2 years ago

@tobiasmcnulty see #241 - py has a known vulnerability so the ideal solution would avoid it entirely - hence #242

Even better! 🎉

Teemu commented 2 years ago

A new version was released.