-
Notifications
You must be signed in to change notification settings - Fork 2
/
noxfile.py
28 lines (21 loc) · 1.08 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""Configuration file for the Nox test runner.
This instantiates the specified sessions in isolated environments and runs the tests.
This allows for locally mirroring the testing occuring with GitHub-actions.
Be careful that the general setup of tests is left to pyproject.toml.
"""
import nox
# set the test parameters
nox.options.stop_on_first_error = True
nox.options.error_on_missing_interpreters = True
@nox.session
def lint(session: nox.Session) -> None:
"""Ensure the code is formatted as expected."""
session.install("ruff")
session.run("ruff", "check", "--output-format=github", "--config=pyproject.toml", ".")
# @nox.session # uncomment this line to only run on the current python interpreter
@nox.session(python=["3.9", "3.10", "3.11", "3.12"]) # missing versions can be installed with `pyenv install ...`
# do not forget check / set the versions with `pyenv global`, or `pyenv local` in case of virtual environment
def tests(session: nox.Session) -> None:
"""Run the tests for the specified Python versions."""
session.install(".[test]")
session.run("pytest")