-
Notifications
You must be signed in to change notification settings - Fork 57
/
noxfile.py
66 lines (52 loc) · 1.65 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
import nox # type: ignore
from pathlib import Path
nox.options.sessions = ["tests", "lint", "build"]
python = ["3.9"]
lint_dependencies = [
"-e",
".",
"black",
"flake8",
"flake8-bugbear",
"mypy",
"check-manifest",
]
@nox.session(python=python)
def tests(session):
session.install("-e", ".", "pytest", "pytest-cov")
tests = session.posargs or ["tests"]
session.run(
"pytest", "--cov=upwork", "--cov-config", ".coveragerc", "--cov-report=", *tests
)
session.notify("cover")
@nox.session
def cover(session):
"""Coverage analysis"""
session.install("coverage")
session.run("coverage", "report", "--show-missing", "--fail-under=0")
session.run("coverage", "erase")
@nox.session(python="3.9")
def lint(session):
session.install(*lint_dependencies)
files = ["tests"] + [str(p) for p in Path(".").glob("*.py")]
session.run("black", "--check", *files)
session.run("flake8", *files)
session.run("mypy", *files)
session.run("python", "setup.py", "check", "--metadata", "--strict")
if "--skip_manifest_check" in session.posargs:
pass
else:
session.run("check-manifest")
@nox.session(python="3.9")
def build(session):
session.install("setuptools")
session.install("wheel")
session.install("twine")
session.install("types-requests")
session.run("rm", "-rf", "dist", "build", external=True)
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
@nox.session(python="3.9")
def publish(session):
build(session)
print("REMINDER: Has the changelog been updated?")
session.run("python", "-m", "twine", "upload", "dist/*")