This repository has been archived by the owner on Aug 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnoxfile.py
69 lines (55 loc) · 1.72 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
import nox # type: ignore
from pathlib import Path
nox.options.sessions = ["tests", "lint", "build"]
python = ["3.8"]
lint_dependencies = [
"-e",
".",
"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=directory_schema",
"--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.8")
def lint(session):
session.install(*lint_dependencies)
files = ["tests"] + [str(p) for p in Path(".").glob("*.py")]
session.run("flake8", *files)
session.run("mypy", "--ignore-missing-imports", *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.8")
def build(session):
session.install("setuptools")
session.install("wheel")
session.install("twine")
session.run("rm", "-rf", "dist", "build", external=True)
session.run("python", "setup.py", "--quiet", "sdist", "bdist_wheel")
session.run("bash", "tests/test_all_fixtures.sh") # Causes warning: bash is not in venv.
@nox.session(python="3.8")
def publish(session):
build(session)
print("REMINDER: Has the changelog been updated?")
session.run("python", "-m", "twine", "upload", "dist/*")