-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoxfile.py
More file actions
103 lines (85 loc) · 2.98 KB
/
noxfile.py
File metadata and controls
103 lines (85 loc) · 2.98 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
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
import nox
from nox_uv import session
if TYPE_CHECKING:
from nox import Session
SUPPORTED_PYTHON_VERSIONS = ["3.10", "3.11", "3.12", "3.13", "3.14"]
COMMON_PYTEST_OPTIONS = ["-n=2", "--showlocals", "-vv"]
here = Path(__file__).parent
nox.options.default_venv_backend = "uv"
nox.options.error_on_external_run = True
nox.options.error_on_missing_interpreters = True
@session(
name="unit",
python=SUPPORTED_PYTHON_VERSIONS,
tags=["tests", "unit", "ci"],
uv_groups=["test"],
uv_all_extras=True,
uv_sync_locked=False,
)
def unit_tests(session: Session) -> None:
(here / ".coverage").unlink(missing_ok=True)
args: list[str] = ["-m=not integration", "tests/unit", *session.posargs]
session.run("pytest", *COMMON_PYTEST_OPTIONS, *args)
@session(
name="unit-no-extras",
python=SUPPORTED_PYTHON_VERSIONS,
tags=["tests", "unit", "ci"],
uv_groups=["test"],
uv_all_extras=False,
uv_sync_locked=False,
)
def unit_tests_no_extras(session: Session) -> None:
(here / ".coverage").unlink(missing_ok=True)
args: list[str] = ["-m=not integration", "tests/unit", *session.posargs]
session.run("pytest", *COMMON_PYTEST_OPTIONS, *args)
@session(
name="integration",
python=SUPPORTED_PYTHON_VERSIONS,
tags=["tests", "docker", "integration"],
uv_groups=["test"],
uv_all_extras=True,
uv_sync_locked=False,
)
def integration_tests(session: Session) -> None:
(here / ".coverage").unlink(missing_ok=True)
args: list[str] = ["-m=integration", *session.posargs]
session.run("pytest", *COMMON_PYTEST_OPTIONS, *args)
@session(
name="integration-postgres",
python=SUPPORTED_PYTHON_VERSIONS,
tags=["tests", "docker", "integration", "ci", "postgres"],
uv_groups=["test"],
uv_all_extras=True,
uv_sync_locked=False,
)
def integration_postgres_tests(session: Session) -> None:
(here / ".coverage").unlink(missing_ok=True)
args: list[str] = ["-m=asyncpg or psycopg_async or psycopg_sync", *session.posargs]
session.run("pytest", *COMMON_PYTEST_OPTIONS, *args)
@session(
name="integration-mysql",
python=SUPPORTED_PYTHON_VERSIONS,
tags=["tests", "docker", "integration", "ci", "mysql"],
uv_groups=["test"],
uv_all_extras=True,
uv_sync_locked=False,
)
def integration_mysql_tests(session: Session) -> None:
(here / ".coverage").unlink(missing_ok=True)
args: list[str] = ["-m=asyncmy", *session.posargs]
session.run("pytest", *COMMON_PYTEST_OPTIONS, *args)
@session(
name="integration-sqlite",
python=SUPPORTED_PYTHON_VERSIONS,
tags=["tests", "docker", "integration", "ci", "sqlite"],
uv_groups=["test"],
uv_all_extras=True,
uv_sync_locked=False,
)
def integration_sqlite_tests(session: Session) -> None:
(here / ".coverage").unlink(missing_ok=True)
args: list[str] = ["-m aiosqlite or sqlite", *session.posargs]
session.run("pytest", *COMMON_PYTEST_OPTIONS, *args)