Skip to content

Testing

This projects provides a few different tests and checks.

In general, we have two files which define all the tests:

To run the pre-commit hooks manually, use:

pre-commit run --all-files

Running the GitLab CI locally is a bit more complicated. Is also requires Node.js as well as Docker installed and configured.

npm exec gitlab-ci-local
# or run a single job, e.g. pre-commit
npm exec gitlab-ci-local -- pre-commit

Python Code Tests

Feature tests as well as test coverage:

# run tests
python -m coverage run -m unittest discover --start-directory tests

# create html coverage report
python -m coverage html --directory "./build/htmlcov"
# serve html coverage report
python -m http.server -d build/htmlcov

Static code checks using ruff:

# linter
python -m ruff check md_multiline_table
python -m ruff check tests
# formatter
python -m ruff format --diff md_multiline_table
python -m ruff format --diff tests

To run automatic static code fixes, use:

# linter
python -m ruff check --fix md_multiline_table
python -m ruff check --fix tests
# formatter
python -m ruff format md_multiline_table
python -m ruff format tests

Static type checks using mypy:

python -m mypy md_multiline_table
python -m mypy tests

Markdown Checks

Verify documentation (markdown) compliance w.r.t. markdown linting rules further specified inside the .markdownlint-cli2.jsonc configuration file.

npm exec markdownlint-cli2 -- "./docs/**/*.md" "./README.md"

License Checks

python -m licensecheck
python -m reuse lint

Vulnerability Checks

python -m tox --recreate -e vulnerability