forked from thebigmunch/tbm-utils
-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
59 lines (46 loc) · 993 Bytes
/
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
import os
import shutil
import nox
ON_GITHUB = 'GITHUB_ACTIONS' in os.environ
py36 = '3.6'
py37 = '3.7'
py38 = '3.8'
py39 = '3.9'
nox.options.reuse_existing_virtualenvs = True
nox.options.sessions = [
'lint',
'doc',
'test'
]
@nox.session
def lint(session):
session.install('-U', '.[lint]')
session.run('flake8', 'src/', 'tests/')
@nox.session
def doc(session):
shutil.rmtree('docs/_build', ignore_errors=True)
session.install('-U', '.[doc]')
session.cd('docs')
session.run(
'sphinx-build',
'-b',
'html',
'-W',
'-d',
'_build/doctrees',
'.',
'_build/html'
)
@nox.session(python=[py36, py37, py38, py39])
def test(session):
session.install('-U', '.[test]')
session.run('coverage', 'run', '-m', 'pytest', *session.posargs)
session.notify('report')
@nox.session
def report(session):
session.install('-U', 'coverage[toml]')
if ON_GITHUB:
session.run('coverage', 'xml')
else:
session.run('coverage', 'report', '-m')
session.run('coverage', 'erase')