Pytest-timeout is sometimes crashing pytest tests with the following exception:
File "C:\j\venv\lib\site-packages\pytest_timeout.py", line 400, in timeout_timer
write_title("Timeout", sep="+")
File "C:\j\venv\lib\site-packages\pytest_timeout.py", line 447, in write_title
width = py.io.get_terminal_width()
AttributeError: module 'py' has no attribute 'io'
pip freeze does not list any entry for py. I do not believe py is installed. However, site-packages does have a file called py.py, which I believe is what is getting mistakenly imported by pytest_timeout.py.
import py
print(py.__file__)
prints C:\\Users\\<me>\\Documents\\<myproj>\\venv\\lib\\site-packages\\py.py
However, after running pip install py==1.11.0,
import py
print(py.__file__)
prints C:\\Users\\<me>\\Documents\\<myproj>\\venv\\lib\\site-packages\\py\\__init__.py
If pytest-timeout has a dependency on py, then installing pytest-timeout should also install py. Please add it to your install_requires in your setup.cfg.
2.1.0 changed how the terminal width is retrieved. py was previously guaranteed to be available by pytest itself. please check the versions and changelog before reporting issues on old versions.
Pytest-timeout is sometimes crashing pytest tests with the following exception:
My environment is:
pip freeze
does not list any entry forpy
. I do not believepy
is installed. However,site-packages
does have a file calledpy.py
, which I believe is what is getting mistakenly imported bypytest_timeout.py
.prints
C:\\Users\\<me>\\Documents\\<myproj>\\venv\\lib\\site-packages\\py.py
However, after running
pip install py==1.11.0
,prints
C:\\Users\\<me>\\Documents\\<myproj>\\venv\\lib\\site-packages\\py\\__init__.py
If
pytest-timeout
has a dependency onpy
, then installingpytest-timeout
should also installpy
. Please add it to yourinstall_requires
in yoursetup.cfg
.