Skip to content

pytest-cov causes pytest to hang after completing all tests #261

@BoPeng

Description

@BoPeng

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,

  1. With coverage-cov 2.6 installed, our test would hang after pytest exits.
  2. The problem appears even if we use normal python test.py when pytest is not used.
  3. pytest exits normally with pytest-cov uninstalled.
  4. 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

  1. What has caused the tests to hang after pytest exits?
  2. Why pytest-cov affects normal python unit tests when they are not triggered by pytest?

Edit:

To reproduce the problem

  1. Install python 3.6+, then pip install sos
  2. Save the test script here in a file, say, test.py.
  3. Run python test.py or pytest test.py should pass
  4. Install pytest-cov
  5. python test.py or pytest test.py will hang

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions