pytest-cov

Strip tox path from pytest-cov output

Strip tox path from pytest-cov output Question: When using pytest and pytest-cov with tox. My tox.ini is [tox] envlist = py3 [testenv] deps = pytest pytest-codeblocks pytest-cov commands = pytest {tty:–color=yes} {posargs} –cov=mypackagename The output will contain the full tox path of the files, e.g.: ———- coverage: platform linux, python 3.11.1-final-0 ———– Name Stmts Miss …

Total answers: 1

pytest-cov showing no coverage

pytest-cov showing no coverage Question: I have a python library named CorGE with the following structure CorGE src __init__.py CorGE __init__.py collect.py command.py tests __init__.py test_collect.py and I’m trying to produce a coverage report with pytest-cov. Every example/doc I’ve seen has been something like this pytest CorGE/tests/ –cov CorGE/ or this python -m coverage run …

Total answers: 2

What is pytest result mean?

What is pytest result mean? Question: I’m learning about testing in Python, and now I’m using pytest-cov. I try to run this command: pytest –cov=myProj tests/ –cov-report term-missing after the testing done I got the report like this: ———– coverage: platform linux, python 3.6.7-final-0 ———– Name Stmts Miss Cover Missing ———————————————————————————————- myProject/__init__.py 0 0 100% …

Total answers: 2

import file mismatch in pytest

import file mismatch in pytest Question: I’ve got a file in the package with ‘test’ in its name and when I run pytest I got an error import file mismatch: imported module ‘my_project.my_file_test’ has this __file__ attribute: /my_project/src/my_project/build/lib/python2.7/site-packages/foo/my_file_test.py which is not the same as the test file we want to collect: /my_project/src/my_project/build/private/python2.7/lib/foo/my_file_test.py HINT: remove __pycache__ …

Total answers: 4