pytest-sugar: Breaks when py is not installed

pytest 7.2.0, released just now, makes py an optional dependency (https://docs.pytest.org/en/stable/changelog.html#pytest-7-2-0-2022-10-23), but pytest-sugar still relies on it, leading to a crash if py is not installed:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/_pytest/main.py", line 268, in wrap_session
INTERNALERROR>     config.hook.pytest_sessionstart(session=session)
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/jelle/ans/venv3.9/lib/python3.9/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'

(Invoking pytest in a env with pytest-sugar but not py installed.)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 14
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

Released 0.9.6

@thewchan: As the maintainer and person who merged the fix, @Teemu is presumably well-aware that folks can’t take advantage of said fix until it has been published to PyPI. So let’s not pester @Teemu and instead wait patiently for the package to be published.

@ygworldr with the fix merged, can we expect a release on PyPI soon?

The fix is pretty simple - @Teemu does #242 look OK?

This looks good to me. My apologies for the earlier confusion!