|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -import os |
6 | | -import sys |
7 | | -from textwrap import dedent |
| 5 | +from pathlib import Path |
8 | 6 |
|
9 | 7 | import nox |
10 | 8 |
|
11 | | -try: |
12 | | - from nox_poetry import Session, session |
13 | | -except ImportError: |
14 | | - message = f"""\ |
15 | | - Nox failed to import the 'nox-poetry' package. |
16 | | - Please install it using the following command: |
17 | | - {sys.executable} -m pip install nox-poetry""" |
18 | | - raise SystemExit(dedent(message)) from None |
| 9 | +nox.needs_version = ">=2025.2.9" |
| 10 | +nox.options.default_venv_backend = "uv" |
| 11 | +nox.options.reuse_venv = "yes" |
19 | 12 |
|
20 | 13 | package = "tap-pulumi-cloud" |
21 | 14 | src_dir = "tap_pulumi_cloud" |
22 | 15 | tests_dir = "tests" |
23 | 16 |
|
24 | | -python_versions = [ |
25 | | - "3.14", |
26 | | - "3.13", |
27 | | - "3.12", |
28 | | - "3.11", |
29 | | - "3.10", |
30 | | -] |
31 | | -main_python_version = "3.13" |
| 17 | +PYPROJECT = nox.project.load_toml() |
| 18 | +python_versions = nox.project.python_versions(PYPROJECT) |
| 19 | +main_python = Path(".python-version").read_text(encoding="utf-8").rstrip() |
32 | 20 | locations = src_dir, tests_dir, "noxfile.py" |
33 | 21 | nox.options.sessions = ("tests",) |
34 | 22 |
|
35 | 23 |
|
36 | | -@session(python=python_versions) |
37 | | -def tests(session: Session) -> None: |
| 24 | +@nox.session(python=python_versions) |
| 25 | +def tests(session: nox.Session) -> None: |
38 | 26 | """Execute pytest tests and compute coverage.""" |
39 | | - deps = ["pytest", "pytest-durations"] |
40 | | - if "GITHUB_ACTIONS" in os.environ: |
41 | | - deps.append("pytest-github-actions-annotate-failures") |
| 27 | + session.run_install( |
| 28 | + "uv", |
| 29 | + "sync", |
| 30 | + "--locked", |
| 31 | + "--no-dev", |
| 32 | + "--group=test", |
| 33 | + env={ |
| 34 | + "UV_PROJECT_ENVIRONMENT": session.virtualenv.location, |
| 35 | + "UV_PYTHON": session.python, |
| 36 | + }, |
| 37 | + ) |
42 | 38 |
|
43 | | - session.install(".") |
44 | | - session.install(*deps) |
45 | 39 | session.run("pytest", *session.posargs) |
0 commit comments