-
Notifications
You must be signed in to change notification settings - Fork 3
/
noxfile.py
95 lines (75 loc) · 2.43 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import nox
import nox_poetry
LINT_PATHS = ["sending", "noxfile.py", "tests"]
nox.options.reuse_existing_virtualenv = True
nox.options.sessions = ["lint", "test"]
@nox_poetry.session(python=["3.8", "3.9", "3.10"])
def test(session: nox_poetry.Session):
session.run_always("poetry", "install", "-E", "all", external=True)
session.run(
"pytest",
"-v",
"--cov=sending",
"--timeout=30",
env={"SENDING__ENABLE_LOGGING": "True"},
)
@nox_poetry.session(python=["3.9"])
def devtest(session: nox_poetry.Session):
session.run_always("poetry", "install", "-E", "all", external=True)
session.run(
"pytest",
"-vv",
"--cov=sending",
"tests/test_inmemory_backend.py",
env={"SENDING__ENABLE_LOGGING": "True"},
)
session.run(
"pytest",
"-vv",
"--cov=sending",
"tests/test_jupyter_backend.py",
env={"SENDING__ENABLE_LOGGING": "True"},
)
session.run(
"pytest",
"-vv",
"--cov=sending",
"tests/test_redis_backend.py",
env={"SENDING__ENABLE_LOGGING": "True"},
)
session.run(
"pytest",
"-vv",
"--cov=sending",
"tests/test_websocket_backend.py",
env={"SENDING__ENABLE_LOGGING": "True"},
)
@nox_poetry.session(python="3.9")
def lint(session: nox_poetry.Session):
session.notify("black_check")
session.notify("flake8")
session.notify("isort_check")
@nox_poetry.session(python="3.9")
def flake8(session: nox_poetry.Session):
session.install("flake8")
session.run("flake8", *LINT_PATHS, "--count", "--show-source", "--statistics", "--benchmark")
@nox_poetry.session(python="3.9")
def black_check(session: nox_poetry.Session):
session.install("black")
session.run("black", "--check", *LINT_PATHS)
@nox_poetry.session(python="3.9")
def isort_check(session: nox_poetry.Session):
session.install("isort")
session.run("isort", "--diff", "--check", *LINT_PATHS)
@nox_poetry.session(python="3.9")
def blacken(session: nox_poetry.Session):
session.install("black")
session.run("black", *LINT_PATHS)
@nox_poetry.session(python="3.9")
def isort_apply(session: nox_poetry.Session):
session.install("isort")
session.run("isort", *LINT_PATHS)
@nox_poetry.session(python="3.9")
def generate_coverage_xml(session: nox_poetry.Session):
session.install("coverage[toml]")
session.run("coverage", "xml")