Skip to content

Commit

Permalink
add argument for noxfile to install from an sdist
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Oct 10, 2024
1 parent b7f5521 commit 232d74b
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import pathlib
import shutil
import sys
Expand All @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 232d74b

Please sign in to comment.