-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
76 lines (67 loc) · 2.31 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
71
72
73
74
75
76
from __future__ import annotations
import os
import subprocess
import nox
from nox.sessions import Session
@nox.session(reuse_venv=True)
def format(session: Session) -> None:
"""Run automatic code formatters"""
session.run("poetry", "install", external=True)
session.run("black", ".")
session.run("isort", ".")
session.run("autoflake", "--in-place", ".")
@nox.session(reuse_venv=True)
def test_suite(session: Session) -> None:
"""Run the Python-based test suite"""
session.run("poetry", "install", external=True)
session.run(
"pytest",
"--showlocals",
"--reruns",
"3",
"--reruns-delay",
"5",
"--cov-report",
"xml",
"--cov-report",
"term-missing",
"-vv",
)
@nox.session(reuse_venv=True)
def test_types(session: Session) -> None:
"""Check that typing is working as expected"""
session.run("poetry", "install", external=True)
session.run("mypy", "--show-error-codes", ".")
@nox.session(reuse_venv=True)
def test_style(session: Session) -> None:
"""Check that style guidelines are being followed"""
session.run("poetry", "install", external=True)
session.run("flake8", ".")
session.run(
"black",
".",
"--check",
)
session.run("isort", ".", "--check-only")
session.run("autoflake", "-r", ".")
session.run("interrogate", ".")
session.run("darglint","--verbosity", "2", "tidal_gauge_api")
@nox.session(reuse_venv=True)
def safety(session: Session) -> None:
"""Release a new version of the package"""
pypi_password = session.posargs[0]
session.run("poetry", "install", external=True)
session.run("safety", "check", "--full-report")
session.run("bandit", "-ll", "--recursive", "tidal_gauge_api")
@nox.session(reuse_venv=True)
def release(session: Session) -> None:
"""Release a new version of the package"""
pypi_password = session.posargs[0]
session.run("poetry", "install", external=True)
session.run("poetry", "build", external=True)
session.run("poetry", "publish", "-u", "__token__", "-p", pypi_password)
@nox.session(reuse_venv=True)
def docs(session: Session) -> None:
"""Create local copy of docs for testing"""
session.run("poetry", "install", external=True)
session.run("sphinx-build", "sphinx-docs", "build")