forked from reactive-python/reactpy-router
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
74 lines (51 loc) · 1.83 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from pathlib import Path
from nox import Session, session
ROOT = Path(".")
REQUIREMENTS_DIR = ROOT / "requirements"
@session
def format(session: Session) -> None:
install_requirements(session, "check-style")
session.run("black", ".")
session.run("isort", ".")
@session
def docs(session: Session) -> None:
setup_docs(session)
session.run("mkdocs", "serve")
@session
def docs_build(session: Session) -> None:
setup_docs(session)
session.run("mkdocs", "build")
@session(tags=["test"])
def test_style(session: Session) -> None:
install_requirements(session, "check-style")
session.run("black", "--check", ".")
session.run("isort", "--check", ".")
session.run("flake8", ".")
@session(tags=["test"])
def test_types(session: Session) -> None:
install_requirements(session, "check-types")
session.run("mypy", "--strict", "reactpy_router")
@session(tags=["test"])
def test_suite(session: Session) -> None:
install_requirements(session, "test-env")
session.run("playwright", "install", "chromium")
posargs = session.posargs[:]
if "--no-cov" in session.posargs:
posargs.remove("--no-cov")
session.log("Coverage won't be checked")
session.install(".")
else:
posargs += ["--cov=reactpy_router", "--cov-report=term"]
session.install("-e", ".")
session.run("pytest", "tests", *posargs)
@session(tags=["test"])
def test_javascript(session: Session) -> None:
session.chdir(ROOT / "js")
session.run("npm", "install", external=True)
session.run("npm", "run", "check")
def setup_docs(session: Session) -> None:
install_requirements(session, "build-docs")
session.install("-e", ".")
session.chdir("docs")
def install_requirements(session: Session, name: str) -> None:
session.install("-r", str(REQUIREMENTS_DIR / f"{name}.txt"))