Skip to content

Refactoring how tests are run and coverage reports are generated

Koala Yeung requested to merge refactor/tests into main

Problems trying to solve:

  • Previously test is run with a "run_test.in" generated script.
  • It is not obvious how to run the tests without meson.
  • Extra add-in files just to make test working with meson.
  • Unit tests are not very readable.

Obstacles:

  • Test files should not be copied to the build folder because they are not to be distributed.
  • Test should run against the files either in the source folder (src), or files to be distributed.
  • Debian have different executable path for running Python3's coverage package.

Solution:

  • "coverage" can simply be run as a python module (i.e. python3 -m coverage) and even support testing another package (i.e. `python3 -m
  • meson's test() accepts a workdir parameter. So we can simply run command in the root directory without an extra script in builddir.
  • Rewrite the "run_test.in" to be a "main.py" in the test folder to make it easier to run (python3 -m tests to run it) coverage run -m PACKAGE_NAME`). This will remove the need for an extra fix-up script for path.
  • Running with colour_runner will group the tests in a more humanly readable way.

Merge request reports

Loading