Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using posargs to pass tests as arguments to tests nox session #4334

Merged
merged 6 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).

Expand Down
5 changes: 4 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading