generated from github/codespaces-blank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
48 lines (37 loc) · 1.02 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
import tempfile
nox.options.sessions = ["lint", "test", "scan"]
@nox.session
def lint(session):
session.install("ruff", "black")
session.run("ruff check .")
session.run("black .")
@nox.session
def test(session):
session.install("pytest", "pytest-mock")
session.run("pytest")
session.notify("coverage")
@nox.session
def coverage(session):
session.install("coverage")
session.run("coverage")
@nox.session
def scan(session):
session.install("bandit", "radon")
session.run("bandit")
session.run("radon")
session.notify("safety")
@nox.session
def safety(session):
with tempfile.NamedTemporaryFile() as requirements:
session.run(
"poetry",
"export",
"--dev",
"--format=requirements.txt",
"--without-hashes",
f"--output={requirements.name}",
external=True,
)
session.install("safety")
session.run("safety", "check", f"--file={requirements.name}", "--full-report")