-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
74 lines (63 loc) · 1.74 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
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",
"modeltestsdk/",
"--count",
"--select=E9,F63,F7,F82",
"--show-source",
"--statistics",
)
session.run(
"flake8",
"modeltestsdk/",
"--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", "tests", "--api=http://127.0.0.1:8000",
"--cov=modeltestsdk", "--cov-report=term-missing", "--cov-fail-under=95")
@nox.session
def tests_github(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", "tests", "--api=build",
"--cov=modeltestsdk", "--cov-report=term-missing", "--cov-fail-under=95")