Can't use "coverage run -m unittest discover" if tests are in a "test" directory · Issue #155 · nedbat/coveragepy (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@nedbat

Description

@nedbat

Although "python -m unittest discover" will properly run tests in a "test" directory, "coverage run -m unittest discover" will not. This is because "coverage run -m" will put the unittest directory into the sys,path, and that directory has a "test" subdirectory. The tests are discovered in the product's test directory, but when the time comes to import them, the unittest "test" directory is examined for them instead, where they do not exist, and the import fails.