generated from potassco/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
56 lines (42 loc) · 1.35 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
import os
import nox
nox.options.sessions = "lint_flake8", "lint_pylint", "test"
PYTHON_VERSIONS = ["3.9"] if "GITHUB_ACTIONS" in os.environ else None
@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",
"fclingo",
"tests",
]
if check:
autoflake_args.remove("--in-place")
session.run("autoflake", *autoflake_args)
isort_args = ["--profile", "black", "fclingo", "tests"]
if check:
isort_args.insert(0, "--check")
isort_args.insert(1, "--diff")
session.run("isort", *isort_args)
black_args = ["fclingo", "tests"]
if check:
black_args.insert(0, "--check")
black_args.insert(1, "--diff")
session.run("black", *black_args)
@nox.session
def lint_flake8(session):
session.install("flake8", "flake8-black", "flake8-isort")
session.run("flake8", "fclingo")
@nox.session
def lint_pylint(session):
session.install("-r", f"requirements.txt", "pylint")
session.run("pylint", "fclingo")
@nox.session(python=PYTHON_VERSIONS)
def test(session):
session.install("-r", f"requirements.txt")
session.run("python", "-m", "unittest", "discover", "-v")