digaws/noxfile.py

36 lines
1.0 KiB
Python
Raw Permalink Normal View History

2020-12-25 20:36:41 +00:00
import nox
2024-06-08 11:43:41 +00:00
nox.options.sessions = ["lint", "typing", "tests"]
locations = ["noxfile.py", "setup.py", "digaws/", "tests/"]
2021-07-01 17:29:38 +00:00
2024-06-08 11:43:41 +00:00
lint_common_args = ["--max-line-length", "100"]
black_args = ["--line-length", "100"]
mypy_args = ["--ignore-missing-imports", "--install-types", "--non-interactive"]
2020-12-25 20:36:41 +00:00
2024-06-08 11:43:41 +00:00
pytest_args = ["--cov=digaws", "--cov-report=", "tests/"]
coverage_args = ["report", "--show-missing", "--fail-under=80"]
2020-12-25 20:36:41 +00:00
@nox.session()
def lint(session):
args = session.posargs or locations
2024-06-08 11:43:41 +00:00
session.install("pycodestyle", "flake8", "black")
session.run("pycodestyle", *(lint_common_args + args))
session.run("flake8", *(lint_common_args + args))
session.run("black", "--check", *(black_args + args))
2020-12-25 20:36:41 +00:00
@nox.session()
def typing(session):
args = session.posargs or locations
2024-06-08 11:43:41 +00:00
session.install("mypy")
session.run("mypy", *(mypy_args + args))
2020-12-25 20:36:41 +00:00
@nox.session()
def tests(session):
args = session.posargs
2024-06-08 11:43:41 +00:00
session.install("-r", "requirements_test.txt")
session.run("pytest", *(pytest_args + args))
session.run("coverage", *coverage_args)