-
Notifications
You must be signed in to change notification settings - Fork 5
/
noxfile.py
58 lines (48 loc) · 1.41 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
import os
import nox
# default sessions that shall be run
nox.options.sessions = ["test", "lint_pylint", "lint_flake8"]
EDITABLE_TESTS = True
PYTHON_VERSIONS = None
if "GITHUB_ACTIONS" in os.environ:
PYTHON_VERSIONS = ["3.10"]
EDITABLE_TESTS = False
@nox.session
def lint_flake8(session):
session.install("-e", ".[lint_flake8]")
session.run("flake8", "clinguin", "tests")
@nox.session
def lint_pylint(session):
session.install("-e", ".[lint_pylint]")
session.run("pylint", "clinguin")
@nox.session
def format(session):
session.install("-e", ".[format]")
check = "check" in session.posargs
autoflake_args = [
"--in-place",
"--imports=fillname",
"--ignore-init-module-imports",
"--remove-unused-variables",
"-r",
"clinguin",
"tests",
]
if check:
autoflake_args.remove("--in-place")
session.run("autoflake", *autoflake_args)
isort_args = ["--profile", "black", "clinguin", "tests"]
if check:
isort_args.insert(0, "--check")
isort_args.insert(1, "--diff")
session.run("isort", *isort_args)
black_args = ["clinguin", "tests"]
if check:
black_args.insert(0, "--check")
black_args.insert(1, "--diff")
session.run("black", *black_args)
@nox.session(python=PYTHON_VERSIONS)
def test(session):
session.install("pytest")
session.install(".")
session.run("pytest")