forked from eli64s/readme-ai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoxfile.py
62 lines (52 loc) · 1.37 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
60
61
62
"""Nox file for running tests against multiple Python versions."""
import nox
def install(session, groups=None, extras=None, root=True):
"""Install the project for the current session using Poetry."""
groups = groups or []
extras = extras or []
if root and "main" not in groups:
groups.insert(0, "main")
only_arg = []
if groups:
only_arg = [f"--only={','.join(groups)}"]
extras_args = []
if extras:
for extra in extras:
extras_args.extend(["--extras", extra])
session.run_always(
"poetry",
"install",
"--no-root",
"--sync",
*only_arg,
*extras_args,
external=True,
)
if root:
session.install(".")
@nox.session(python=["3.9", "3.10", "3.11", "3.12"])
def tests(session):
"""Run test suite against Python versions 3.9, 3.10, 3.11, and 3.12."""
install(
session,
groups=["test"],
extras=["anthropic", "google-generativeai"],
)
session.install(
"pytest",
"pytest-asyncio",
"pytest-cov",
"pytest-mock",
"pytest-pretty",
"pytest-randomly",
"pytest-sugar",
"pytest-xdist",
)
session.run(
"poetry",
"run",
"pytest",
"--config-file=pyproject.toml",
"--cov-config=pyproject.toml",
external=True,
)