-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathnoxfile.py
37 lines (28 loc) · 843 Bytes
/
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
import nox
import pathlib
import shutil
import nox
DIR = pathlib.Path(__file__).parent.resolve()
VENV_DIR = pathlib.Path("./.venv").resolve()
nox.options.sessions = ["test", "coverage"]
@nox.session
def build(session: nox.Session) -> None:
"""
Build an SDist and wheel with ``flit``.
"""
dist_dir = DIR.joinpath("dist")
if dist_dir.exists():
shutil.rmtree(dist_dir)
session.install(".[dev]")
session.run("flit", "build")
@nox.session(python=["3.8", "3.10"], venv_backend="conda")
def test(session):
session.install(".[test]")
session.run("pytest")
@nox.session
def coverage(session) -> None:
"""
Run the unit and regular tests, and save coverage report
"""
session.install(".[test]", "pytest-cov")
session.run("pytest", "--cov=./", "--cov-report=xml", *session.posargs)