Pytest cov doesn't recognize option

123 views Asked by At

I'm running pytest with pytest-cov with the following command line:

python -m pytest Mytools\tests --junitxml test_reports\unittest_result.xml --cov . --cov-branch --cov-report xml:test_reports\unittest_coverage.xml --cov-config=scripts\.coveragerc || exit /b 1

however I get this error:

CoverageWarning: Unrecognized option '[report] exclude_also=' in config file scripts\.coveragerc

My .coveragerc file looks like this:

[report]
exclude_also =
    if __name__ == .__main__.:

Any idea on how to fix it? many thanks

1

There are 1 answers

2
Ned Batchelder On

Check your version of coverage.py: exclude_also was introduced in version 7.2.0.