py.test gives Coverage.py warning: Module sample.py was never imported
Short answer: you need to run with the module name, not the file name: pytest –cov sample test.py Long answer: One comment in the answer you linked (How to properly use coverage.py in Python?) explains that this doesn’t seem to work if the file you are trying to get the coverage of is a module … Read more