-
Notifications
You must be signed in to change notification settings - Fork 0
/
noxfile.py
59 lines (44 loc) · 1.65 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
# Copyright (c) 2022 Zubax
# This software is distributed under the terms of the MIT License.
# Author: Silver Valdvee
# type: ignore
import sys
from pathlib import Path
import platform
import nox
ROOT_DIR = Path(__file__).resolve().parent
PYTHONS = ["3.10"]
"""The newest supported Python shall be listed last."""
nox.options.error_on_external_run = True
compiled_dir = Path.cwd().resolve() / ".compiled"
src_dirs = [
ROOT_DIR / "yukon",
ROOT_DIR / "tests",
]
if platform.system() == "Windows":
separator = ";"
else:
separator = ":"
@nox.session(reuse_venv=True)
def black(session):
session.run("pip", "install", "black == 22.*")
# black yukon
session.run("black", "--check", "yukon", "tests")
@nox.session(reuse_venv=True)
def mypy(session):
session.run("pip", "install", "-r", "dev-requirements.txt")
session.run("pip", "install", "mypy==0.961")
session.run("mypy", "yukon")
@nox.session(reuse_venv=True)
def pylint(session):
session.run("pip", "install", "pylint==2.*")
session.run("pylint", *map(str, src_dirs), env={"PYTHONPATH": str(compiled_dir)})
session.run("pylint", "build_exe.py", env={"PYTHONPATH": str(compiled_dir)})
@nox.session(reuse_venv=True)
def pytest(session):
session.run("pip", "install", "-r", "dev-requirements.txt")
session.run("pip", "install", "-r", "requirements.txt")
if platform.system() != "Windows":
session.run("sudo", "setcap", "cap_net_raw+eip", str(Path(sys.executable).resolve()), external=True)
session.run("pytest", "tests/src/necessary/test_api.py",
env={"PYTHONPATH": str(Path(str(compiled_dir) + separator + str(ROOT_DIR)).absolute())})