After a great deal of detective work, we figured out why our tests fail to exit after they appear to be completed on travis. In summary,
- With
coverage-cov 2.6 installed, our test would hang after pytest exits.
- The problem appears even if we use normal
python test.py when pytest is not used.
- pytest exits normally with
pytest-cov uninstalled.
- The problem was found in travis VM but we could reproduce it locally after installing
pytest-cov.
The program being tested uses multiprocessing, but the processes exit normally. I am reporting the problem here and try to figure out
- What has caused the tests to hang after pytest exits?
- Why
pytest-cov affects normal python unit tests when they are not triggered by pytest?
Edit:
To reproduce the problem
- Install python 3.6+, then
pip install sos
- Save the test script
here in a file, say, test.py.
- Run
python test.py or pytest test.py should pass
- Install
pytest-cov
python test.py or pytest test.py will hang
After a great deal of detective work, we figured out why our tests fail to exit after they appear to be completed on travis. In summary,
coverage-cov2.6 installed, our test would hang afterpytestexits.python test.pywhenpytestis not used.pytest-covuninstalled.pytest-cov.The program being tested uses multiprocessing, but the processes exit normally. I am reporting the problem here and try to figure out
pytest-covaffects normal python unit tests when they are not triggered bypytest?Edit:
To reproduce the problem
pip install sosherein a file, say,test.py.python test.pyorpytest test.pyshould passpytest-covpython test.pyorpytest test.pywill hang