-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnoxfile.py
48 lines (39 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
import nox
nox.options.sessions = "black", "lint", "safety", "tests"
code_locations = "operationsgateway_api", "test", "noxfile.py", "util"
@nox.session(python=False)
def black(session):
# Use Poetry’s existing virtual environment
session.env["POETRY_VIRTUALENVS_CREATE"] = "false"
# The dependencies should already be installed,
# but explicitly setting in case they're not
session.run("poetry", "install", "--without", "simulated-data", external=True)
args = session.posargs
session.run("poetry", "run", "black", *code_locations, *args, external=True)
@nox.session(python=False)
def lint(session):
args = session.posargs or code_locations
session.env["POETRY_VIRTUALENVS_CREATE"] = "false"
session.run("poetry", "install", "--without", "simulated-data", external=True)
session.run("poetry", "run", "flake8", *args, external=True)
@nox.session(python=False)
def safety(session):
session.env["POETRY_VIRTUALENVS_CREATE"] = "false"
session.run("poetry", "install", "--without", "simulated-data", external=True)
# Can't fix 70790 because epac data sim uses it
session.run(
"poetry",
"run",
"safety",
"check",
"--full-report",
"--ignore",
"70790",
external=True,
)
@nox.session(python=False)
def tests(session):
args = session.posargs
session.env["POETRY_VIRTUALENVS_CREATE"] = "false"
session.run("poetry", "install", "--without", "simulated-data", external=True)
session.run("poetry", "run", "pytest", *args, external=True)