|
| 1 | +"""Nox sessions for cellpy. |
| 2 | +
|
| 3 | +Installs the project and its extras/dev group from ``pyproject.toml`` |
| 4 | +""" |
| 5 | + |
1 | 6 | import nox |
2 | 7 |
|
3 | | -from yaml import safe_load |
4 | | -from pathlib import Path |
| 8 | +PYTHON_VERSIONS = ["3.13", "3.14"] |
| 9 | + |
5 | 10 |
|
6 | | -CONDA_ENV = "github_actions_environment.yml" |
7 | | -PYTHON_VERSIONS = ["3.13","3.14"] |
| 11 | +def _install_project(session: nox.Session) -> None: |
| 12 | + """Editable install with optional extras + ``[dependency-groups].dev``.""" |
| 13 | + session.install("-e", ".[all]", "--group", "dev") |
8 | 14 |
|
9 | 15 |
|
10 | 16 | @nox.session(python=PYTHON_VERSIONS) |
11 | | -def tests(session): |
12 | | - """Run the test suite.""" |
13 | | - session.install("-r", "requirements_dev.txt") |
14 | | - session.run("pytest") |
| 17 | +def tests(session: nox.Session) -> None: |
| 18 | + """Run the test suite in a virtualenv.""" |
| 19 | + _install_project(session) |
| 20 | + session.run("pytest", *session.posargs) |
15 | 21 |
|
16 | 22 |
|
17 | 23 | @nox.session(python=PYTHON_VERSIONS, venv_backend="conda") |
18 | | -def conda_tests(session): |
19 | | - """Run the test suite.""" |
20 | | - environment = safe_load(Path(CONDA_ENV).read_text()) |
21 | | - conda = environment.get("dependencies") |
22 | | - requirements = conda.pop(-1).get("pip") |
23 | | - |
24 | | - for package in conda: |
25 | | - session.conda_install(package) |
26 | | - for requirement in requirements: |
27 | | - session.install(requirement) |
28 | | - session.run("pytest") |
| 24 | +def conda_tests(session: nox.Session) -> None: |
| 25 | + """Run the test suite in a conda-backed env (same pyproject deps).""" |
| 26 | + _install_project(session) |
| 27 | + session.run("pytest", *session.posargs) |
0 commit comments