-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnoxfile.py
More file actions
63 lines (47 loc) · 1.87 KB
/
noxfile.py
File metadata and controls
63 lines (47 loc) · 1.87 KB
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
"""Nox sessions for Answer Architect project."""
import nox
PYTHON_VERSIONS = ["3.11"]
LOCATIONS = ["src", "tests", "tools", "scripts", "infra"]
@nox.session(python=PYTHON_VERSIONS)
def lint(session):
"""Run code linting with ruff."""
session.install("ruff", "black", "mypy")
session.run("ruff", "check", *LOCATIONS)
session.run("black", "--check", "--diff", *LOCATIONS)
session.run("mypy", *LOCATIONS)
@nox.session(python=PYTHON_VERSIONS)
def format_code(session):
"""Format code with black and ruff."""
session.install("ruff", "black")
session.run("black", *LOCATIONS)
session.run("ruff", "check", "--fix", *LOCATIONS)
@nox.session(python=PYTHON_VERSIONS)
def tests(session):
"""Run unit tests with pytest."""
session.install("poetry")
session.run("poetry", "install", "--with", "dev")
session.run("poetry", "run", "pytest", "-v", "--cov=src", "--cov-report=term-missing")
@nox.session(python=PYTHON_VERSIONS)
def e2e_latency(session):
"""Run end-to-end latency tests."""
session.install("poetry")
session.run("poetry", "install", "--with", "dev")
# Mock E2E test with latency check
session.run("poetry", "run", "pytest", "tests/e2e/", "-v", "-m", "latency")
@nox.session(python=PYTHON_VERSIONS)
def package(session):
"""Build and package the application."""
session.install("poetry")
session.run("poetry", "build")
@nox.session(python=PYTHON_VERSIONS)
def cdk_synth(session):
"""Synthesize CDK templates."""
session.install("poetry")
session.run("poetry", "install")
session.run("poetry", "run", "python", "-m", "scripts.deploy", "--dry-run")
@nox.session(python=PYTHON_VERSIONS)
def teardown(session):
"""Teardown development resources."""
session.install("poetry")
session.run("poetry", "install")
session.run("poetry", "run", "python", "-m", "scripts.deploy", "--teardown")