diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73977370b4..3724922fbc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -183,6 +183,11 @@ If you want to check integration tests as well as unit tests, type ```bash nox -s tests ``` +or, alternatively, you can use posargs to pass the path to the test to `nox`. For example: + +```bash +nox -s tests -- tests/unit/test_plotting/test_quick_plot.py::TestQuickPlot::test_simple_ode_model +``` When you commit anything to PyBaMM, these checks will also be run automatically (see [infrastructure](#infrastructure)). diff --git a/noxfile.py b/noxfile.py index 0e9ebc1776..a34d6e81f4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -266,7 +266,10 @@ def run_tests(session): set_environment_variables(PYBAMM_ENV, session=session) session.install("setuptools", silent=False) session.install("-e", ".[all,dev,jax]", silent=False) - session.run("python", "-m", "pytest", "-m", "unit or integration") + specific_test_files = session.posargs if session.posargs else [] + session.run( + "python", "-m", "pytest", *specific_test_files, "-m", "unit or integration" + ) @nox.session(name="docs")