pyo3/pytests/noxfile.py

29 lines
905 B
Python
Raw Normal View History

2022-01-16 16:12:40 +00:00
import nox
2024-01-15 15:57:42 +00:00
import sys
from nox.command import CommandFailed
2022-01-16 16:12:40 +00:00
2022-01-22 23:15:36 +00:00
nox.options.sessions = ["test"]
@nox.session
def test(session: nox.Session):
2023-12-05 05:01:02 +00:00
session.env["MATURIN_PEP517_ARGS"] = "--profile=dev"
session.run_always("python", "-m", "pip", "install", "-v", ".[dev]")
try:
session.install("--only-binary=numpy", "numpy>=1.16")
except CommandFailed:
# No binary wheel for numpy available on this platform
pass
2024-01-15 15:57:42 +00:00
ignored_paths = []
if sys.version_info < (3, 10):
# Match syntax is only available in Python >= 3.10
ignored_paths.append("tests/test_enums_match.py")
ignore_args = [f"--ignore={path}" for path in ignored_paths]
session.run("pytest", *ignore_args, *session.posargs)
2022-01-22 23:15:36 +00:00
2022-01-16 16:12:40 +00:00
@nox.session
def bench(session: nox.Session):
2023-12-04 19:03:56 +00:00
session.install(".[dev]")
session.run("pytest", "--benchmark-enable", "--benchmark-only", *session.posargs)