-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathnoxfile.py
More file actions
107 lines (86 loc) · 2.18 KB
/
Copy pathnoxfile.py
File metadata and controls
107 lines (86 loc) · 2.18 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import nox
from nox_poetry import Session, session
nox.options.reuse_existing_virtualenvs = True
nox.options.error_on_external_run = True
PYTHON_VERSIONS = ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
COMMON_PYTEST_OPTIONS = [
"--cov=.",
"--cov-append",
"--cov-report=xml",
"-n",
"auto",
"--showlocals",
"-vv",
]
def poetry_install_run_always(session: Session) -> None:
session.run_always("poetry", "install", external=True)
@session(python=PYTHON_VERSIONS, name="SQLAlchemy 2.0 Tests", tags=["tests"])
def tests_sqlalchemy_latest(session: Session) -> None:
session.run_always(
"poetry",
"run",
"pip",
"install",
"--upgrade",
"pip",
"setuptools",
"wheel",
external=True,
)
poetry_install_run_always(session)
session.run(
"pytest",
*COMMON_PYTEST_OPTIONS,
)
# No need for now to run 1.4 against all 5 python versions.
@session(python="3.11", name="Sqlalchemy 1.4 Tests", tags=["tests"])
def tests_sqlalchemy_1_4(session: Session) -> None:
session.run_always(
"poetry",
"run",
"pip",
"install",
"--upgrade",
"pip",
"setuptools",
"wheel",
external=True,
)
poetry_install_run_always(session)
session._session.install("sqlalchemy~=1.4")
session.run(
"pytest",
*COMMON_PYTEST_OPTIONS,
)
@session(name="Mypy", tags=["lint"])
def mypy(session: Session) -> None:
poetry_install_run_always(session)
session.run(
"mypy",
"--install-types",
"--non-interactive",
"--cache-dir=.mypy_cache/",
"--config-file",
"mypy.ini",
)
@session(name="Ruff Lint", tags=["lint"])
def ruff_lint(session: Session) -> None:
poetry_install_run_always(session)
session.run(
"ruff",
"check",
"--no-fix",
".",
silent=False,
)
@session(name="Ruff Format", tags=["format"])
def ruff_format(session: Session) -> None:
poetry_install_run_always(session)
session.run(
"ruff",
"format",
"--check",
"--diff",
".",
silent=False,
)