diff --git a/noxfile.py b/noxfile.py index 2fbc2d6..8221486 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,3 +1,4 @@ +import os import pathlib import shutil import sys @@ -11,10 +12,19 @@ @nox.session(name="test-with-pip", python=["3.10", "3.11", "3.12"]) def test_with_pip(session: nox.Session) -> None: """Run the tests.""" + first_arg = session.posargs[0] if session.posargs else None + session.install("-r", "requirements-testing.in") if sys.platform.startswith("win"): session.install("ecmwflibs") - session.install(".") + + if first_arg: + if os.path.isfile(first_arg): + session.install(first_arg) + else: + session.error("path must be a source distribution") + else: + session.install(".") session.run("pytest", "--cov=src/bmi_wavewatch3", "-vvv") session.run("coverage", "report", "--ignore-errors", "--show-missing") @@ -26,9 +36,18 @@ def test_with_pip(session: nox.Session) -> None: ) def test_with_conda(session: nox.Session) -> None: """Run the tests.""" + first_arg = session.posargs[0] if session.posargs else None + session.conda_install("--file=requirements-testing.in") session.conda_install("--file=requirements-conda.in") - session.install(".", "--no-deps") + + if first_arg: + if os.path.isfile(first_arg): + session.install(first_arg, "--no-deps") + else: + session.error("path must be a source distribution") + else: + session.install(".", "--no-deps") session.run("pytest", "--cov=src/bmi_wavewatch3", "-vvv") session.run("coverage", "report", "--ignore-errors", "--show-missing")