forked from nsidc/earthaccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
60 lines (45 loc) · 1.54 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from __future__ import annotations
import os
import shutil
from pathlib import Path
import nox
DIR = Path(__file__).parent.resolve()
nox.needs_version = ">=2024.3.2"
nox.options.sessions = ["typecheck", "tests"]
nox.options.default_venv_backend = "uv|virtualenv"
@nox.session
def typecheck(session: nox.Session) -> None:
"""Typecheck with mypy."""
session.install("--editable", ".[test]")
session.run("mypy")
@nox.session
def tests(session: nox.Session) -> None:
"""Run the unit tests."""
session.install("--editable", ".[test]")
session.run("pytest", "tests/unit", *session.posargs)
@nox.session(name="integration-tests")
def integration_tests(session: nox.Session) -> None:
"""Run the integration tests."""
session.install("--editable", ".[test]")
session.run(
"scripts/integration-test.sh",
*session.posargs,
env=dict(
EARTHDATA_USERNAME=os.environ["EARTHDATA_USERNAME"],
EARTHDATA_PASSWORD=os.environ["EARTHDATA_PASSWORD"],
),
external=True,
)
@nox.session
def build_pkg(session: nox.Session) -> None:
"""Build a source distribution and binary distribution (wheel)."""
build_path = DIR.joinpath("build")
if build_path.exists():
shutil.rmtree(build_path)
session.install("build")
session.run("python", "-m", "build")
@nox.session
def serve_docs(session: nox.Session) -> None:
"""Build the documentation and serve it."""
session.install("--editable", ".[docs]")
session.run("mkdocs", "serve", *session.posargs)