Use coverage in GPF testsΒΆ

Note

You need to have a configured GPF development environment as described in Setup GPF development environment and production data

Let us say you want to inspect test coverage for a specific GPF package and let us say that this package is dae.backends.cnv.

First enter into dae directory of the GPF project:

cd gpf/dae

To run GPF tests for this package only and to collect the test coverage info you can use following:

py.test --cov-config ../coveragerc  \
    --cov dae/backends/cnv \
    --cov-report=html \
    --cov-branch \
    dae/backends/cnv/tests/

The meaning of the arguments is following:

  • --cov-config ../coveragerc - use the file coveragerc from the root gpf folder as a converage configuration;

  • --cov dae/backends/cnv - collect coverage only for the specified module

  • --cov-repot=html - generate an HTML report for code coverage

  • --cov-branch - colect data for branch coverage

  • dae/backends/cnv/tests/ - run only tests located inside the specified directory.

The resulting coverage report will be stored into directory named htmlcov. You can use:

browse htmlcov/index.html

to open the report into your default browser.