-
Notifications
You must be signed in to change notification settings - Fork 287
/
noxfile.py
52 lines (33 loc) · 1.61 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
"""
Nox sessions.
This file is used by `nox` to run tests and examples against multiple Python versions.
See: http://nox.thea.codes
"""
from __future__ import annotations
import nox # type: ignore
PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12"]
@nox.session(python=PYTHON_VERSIONS)
def tests(session: nox.Session) -> None:
"""Run the Python test suite."""
session.install("./rerun_py")
session.run("pixi", "run", "py-test", external=True)
@nox.session(python=PYTHON_VERSIONS)
def run_all(session: nox.Session) -> None:
"""Run all examples through the run_all.py script (pass args with: "-- <args>")."""
# Note: the run_all.py scripts installs all dependencies itself. In particular, we can install from
# examples/python/requirements.txt because it includes pyrealsense2, which is not available for mac.
session.run("python", "scripts/run_all.py", "--install-requirements", *session.posargs)
roundtrip_cpp_built = False
@nox.session(python=PYTHON_VERSIONS)
def roundtrips(session: nox.Session) -> None:
"""Run all roundtrip tests (C++ will be built only once / skip with: "-- --no-cpp-build")."""
global roundtrip_cpp_built
session.install("opencv-python")
session.install("./rerun_py")
extra_args = []
if roundtrip_cpp_built and "--no-cpp-build" not in session.posargs:
extra_args.append("--no-cpp-build")
extra_args.extend(session.posargs)
session.run("python", "tests/roundtrips.py", "--no-py-build", *extra_args)
session.run("python", "docs/snippets/compare_snippet_output.py", "--no-py-build", *extra_args)
roundtrip_cpp_built = True