diff --git a/MANIFEST.in b/MANIFEST.in index 16645f08..cc13c0a2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -20,6 +20,7 @@ recursive-exclude wasmtime/bindgen/generated *.py *.wasm include .flake8 include CONTRIBUTING.md include mypy.ini +include noxfile.py include pytest.ini include VERSION diff --git a/noxfile.py b/noxfile.py new file mode 100644 index 00000000..1c952822 --- /dev/null +++ b/noxfile.py @@ -0,0 +1,18 @@ +import nox + +PYPROJECT = nox.project.load_toml('pyproject.toml') + +PYTHONS = [ + # Reads versions from Trove classifiers + *nox.project.python_versions(PYPROJECT), +] + +# Prefer uv to create virtual environments, fall back to virtualenv. +# Overriden by $NOX_DEFAULT_VENV_BACKEND=... or nox --default-venv-backend ... +# https://nox.thea.codes/en/stable/usage.html#changing-the-sessions-default-backend +nox.options.default_venv_backend = 'uv|virtualenv' + +@nox.session(python=PYTHONS, tags=["test"]) +def tests(session): + session.install('.[testing]') + session.run('coverage', 'run', '-m', 'pytest') diff --git a/pytest.ini b/pytest.ini index 11f60732..7e11eb77 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,13 @@ [pytest] -addopts = --doctest-modules --mypy --ignore-glob=tests/bindgen/*/app.py +addopts = + --doctest-modules + --ignore-glob=tests/bindgen/*/app.py + --ignore-glob=noxfile.py + --mypy norecursedirs = + .* + *.egg + build ci/_custom_build + dist tests/bindgen/generated/*