-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
70 lines (55 loc) · 1.33 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
import webbrowser
from pathlib import Path
import nox
from nox_poetry import session
src_path = 'src'
code_paths = [src_path, 'test', 'noxfile.py']
nox.options.sessions = [
'blue',
'isort',
'flake8',
'mypy',
'pytest',
'coverage',
]
@session
def blue(session):
session.install('blue')
session.run('blue', *code_paths)
@session
def isort(session):
session.install('isort')
session.run('isort', *code_paths)
@session
def flake8(session):
session.install('flake8')
session.run('flake8', *code_paths)
@session
def mypy(session):
session.install('mypy', '.')
session.run('mypy', src_path)
@session(python=['3.10', '3.11'])
def pytest(session):
session.install('pytest', 'pytest-mock', '.')
session.run('pytest')
@session
def coverage(session):
session.install('pytest', 'pytest-mock', 'coverage', '.')
session.run(
'coverage',
'run',
'--source',
'pyarch',
'-m',
'pytest',
'test/integration',
'test/unit',
)
try:
session.run(
'coverage', 'report', '--fail-under', '100', '--show-missing'
)
finally:
if 'html' in session.posargs:
session.run('coverage', 'html', '--skip-covered')
webbrowser.open((Path.cwd() / 'htmlcov' / 'index.html').as_uri())