forked from velodrome-finance/bots
-
Notifications
You must be signed in to change notification settings - Fork 6
/
noxfile.py
41 lines (32 loc) · 1.05 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
import nox
import tempfile
locations = ["bots", "tests", "noxfile.py"]
nox.options.sessions = "lint", "safety", "tests"
@nox.session(python=["3.10"])
def tests(session):
session.run("poetry", "install", external=True)
session.run("pytest")
@nox.session(python=["3.10"])
def lint(session):
args = session.posargs or locations
session.install("flake8", "flake8-bandit", "flake8-black", "flake8-bugbear")
session.run("flake8", *args)
@nox.session(python="3.10")
def black(session):
args = session.posargs or locations
session.install("black")
session.run("black", *args)
@nox.session(python="3.10")
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")