forked from cruxinformatics/crux-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
57 lines (44 loc) · 1.34 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
52
53
54
55
56
57
"""
Nox config for running tests.
"""
import multiprocessing
import nox
cpu_count = multiprocessing.cpu_count()
if cpu_count > 4:
cpu_count = 4
elif cpu_count > 2 and cpu_count < 4:
cpu_count = 2
else:
cpu_count = 1
@nox.session(python=["3.7"])
def lint(session):
"""Run linters."""
session.install("flake8", "flake8-import-order")
session.install("pylint")
session.install("-r", "requirements.txt")
session.run("flake8", ".")
session.run("pylint", "crux")
@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
def unit(session):
"""Run unit tests."""
session.install("pytest")
session.install("-r", "requirements.txt")
session.run("python", "-m", "pytest", "tests/unit")
@nox.session(python=["2.7", "3.5", "3.6", "3.7"])
def integration(session):
"""Run integration tests."""
session.install("pytest")
session.install("pytest-xdist")
session.install("-r", "requirements.txt")
session.run("python", "-m", "pytest", "-n", str(cpu_count), "tests/integration")
@nox.session(python=["3.7"])
def format_check(session):
"""Run all tests."""
session.install("black")
session.run("black", "--check", ".")
@nox.session(python=["3.7"])
def type_check(session):
"""Run type checks."""
session.install("-r", "requirements.txt")
session.install("mypy")
session.run("mypy", "crux")