Closed ca-scribner closed 2 years ago
from @r-f-g, the problem appears to be traceable to these lines of code. Removing them seems to fix the issue
It appears that pip install -e my/local/version
always results in a working venv, and that building a whl of pytest-operator locally then installing that whl (python setup.py sdist bdist_wheel; pip install ./dist/pytest_operator-0.14.0-py3-none-any.whl
) fails at least sometimes (2 failures in 2 attempts)
Typically, we expect that
pip install pytest-operator
will also installpytest-asyncio
, andpytest-asyncio
adds a command line argument to pytest for--asyncio-mode
(eg:pytest --asyncio-mode=auto
should be a valid command). However, after commitcfef8ea9927e4cc07ff69d042239e2612d1cfc84
, this command sometimes works. For example, running the following in an empty dir:Will result in 10 new venvs, some of which can successfully execute the
pytest --asyncio-mode=auto
command and some of which give the following error:This intermittent error is linked to the venv, not to execution of the pytest command. For example, if you create a venv and then execute
pytest --asyncio-mode=auto
multiple times, all executions will have the same result (either pass or fail). But if you then create multiple venvs and repeat this test, some venvs will pass and some will fail.An example of installs that all work can be generated by using the previous commit:
Workarounds
Specifying the
asyncio_mode
via a pytest.ini or pyproject.toml appears to work consistently. For example, in pyproject.toml this always works: