-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
63 lines (51 loc) · 1.28 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
import nox
import os
import shutil
@nox.session()
def test(session: nox.Session):
"""Run tests under coverage"""
session.install(
'.',
'coverage'
)
session.run(
'coverage', 'run', '-m', 'unittest', 'discover'
)
@nox.session()
def cov(session: nox.Session):
"""Compile coverage to an XML file"""
session.install('coverage')
session.run('coverage', 'xml', '-i')
@nox.session
def lint(session: nox.Session):
"""Run the linter"""
session.install('flake8')
session.run('flake8')
@nox.session()
def whl(session: nox.Session):
"""Build the wheel"""
session.install(
'wheel',
'setuptools',
'.'
)
session.run('python', '-m', 'setup', 'bdist_wheel')
@nox.session()
def send(session: nox.Session):
"""Send wheel to PyPi"""
session.install('twine')
session.run('twine', 'upload', 'dist/*.whl')
@nox.session()
def clean(session: nox.Session):
"""Remove files that aren't needed anymore"""
delete = [
".coverage",
"build",
"dist"
]
for p in delete:
if os.path.exists(p):
if os.path.isdir(p):
shutil.rmtree(p)
else:
os.remove(p)