build: skip dev when running nox by default

This commit is contained in:
Anand Balakrishnan 2023-09-07 13:23:27 -07:00
parent daf1936d2b
commit f00fe25c58
No known key found for this signature in database
2 changed files with 37 additions and 23 deletions

View file

@ -14,3 +14,6 @@ repos:
entry: nox -t fix style lint entry: nox -t fix style lint
language: system language: system
pass_filenames: false pass_filenames: false
types:
- rust
- python

View file

@ -1,6 +1,7 @@
from pathlib import Path from pathlib import Path
import nox import nox
import nox.registry
nox.options.default_venv_backend = "mamba" nox.options.default_venv_backend = "mamba"
nox.options.reuse_existing_virtualenvs = True nox.options.reuse_existing_virtualenvs = True
@ -71,6 +72,7 @@ def ruff(session: nox.Session):
@nox.session(tags=["lint"]) @nox.session(tags=["lint"])
def mypy(session: nox.Session): def mypy(session: nox.Session):
session.conda_install("mypy", "typing-extensions", "pytest", "hypothesis") session.conda_install("mypy", "typing-extensions", "pytest", "hypothesis")
session.env.update(ENV)
with session.chdir(CURRENT_DIR / "pyargus"): with session.chdir(CURRENT_DIR / "pyargus"):
session.install("-e", ".") session.install("-e", ".")
session.run("mypy", ".") session.run("mypy", ".")
@ -130,7 +132,20 @@ def coverage(session: nox.Session):
session.run("cargo", "+nightly", "test", external=True, silent=True) session.run("cargo", "+nightly", "test", external=True, silent=True)
except Exception: except Exception:
... ...
finally:
try:
session.run(
"coverage",
"run",
"--source",
"pyargus/argus,pyargus/src",
"-m",
"pytest",
silent=True,
)
except Exception:
...
session.run( session.run(
"grcov", "grcov",
".", ".",
@ -150,14 +165,6 @@ def coverage(session: nox.Session):
"rust.lcov", "rust.lcov",
external=True, external=True,
) )
try:
session.run(
"coverage", "run", "--source", "pyargus/argus", "-m", "pytest", silent=True
)
except Exception:
...
finally:
session.run("coverage", "lcov", "-o", "python.lcov") session.run("coverage", "lcov", "-o", "python.lcov")
session.run( session.run(
@ -171,3 +178,7 @@ def coverage(session: nox.Session):
"htmlcov/", "htmlcov/",
*map(str, CURRENT_DIR.glob("*.lcov")), *map(str, CURRENT_DIR.glob("*.lcov")),
) )
skip = {"dev"}
nox.options.sessions = [key for key in nox.registry.get() if key not in skip]