-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
52 lines (44 loc) · 1.07 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
import nox
import tempfile
import os
# override default sessions
nox.options.sessions = ["lint", "tests"]
@nox.session
def lint(session):
"""Highlight syntactical and stylistic problems in the code."""
session.install("flake8")
session.run(
"flake8",
"plugin/",
"--count",
"--select=E9,F63,F7,F82",
"--show-source",
"--statistics",
)
session.run(
"flake8",
"plugin/",
"--count",
"--per-file-ignores=__init__.py:F401",
"--exit-zero",
"--max-complexity=10",
"--max-line-length=127",
"--statistics",
)
@nox.session
def tests(session):
"""Run test suite."""
# install dependencies
req_path = os.path.join(tempfile.gettempdir(), 'requirements.txt')
session.install("poetry")
session.run(
"poetry",
"export",
"--with=dev",
"--format=requirements.txt",
f"--output={req_path}",
external=True,
)
session.install("-r", req_path)
# run tests
session.run("pytest", "-s", "tests")