Pytest ignoring Meson subprojects

Meson projects may contain Python code, including Meson subprojects. However, the Meson subproject code may not be relevant to the top-level Meson project Python code. Then, Pytest Python test suites may fail when the subprojects/ directory tree is searched and unwanted tests are run.

Ignore directories with Pytest

While this example is for Meson subprojects, it is obviously applicable to many other Python projects.

Add to file “pyproject.toml” in project top-level directory (where setup.cfg is):

[tool.pytest.ini_options]
addopts = "-ra -v"
norecursedirs = subprojects .* build dist CVS _darcs {arch} *.egg venv