diff --git a/noxfile.py b/noxfile.py index 38f10bb6c33..160e823e9f1 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,8 +26,6 @@ } REQUIREMENTS = { "docs": "docs/requirements.txt", - "tests": "tests/requirements.txt", - "common-wheels": "tests/requirements-common_wheels.txt", } AUTHORS_FILE = "AUTHORS.txt" @@ -54,10 +52,10 @@ def should_update_common_wheels() -> bool: if not os.path.exists(LOCATIONS["common-wheels"]): return True - # If the requirements was updated after cache, we'll repopulate it. + # If the pyproject.toml was updated after cache, we'll repopulate it. cache_last_populated_at = os.path.getmtime(LOCATIONS["common-wheels"]) - requirements_updated_at = os.path.getmtime(REQUIREMENTS["common-wheels"]) - need_to_repopulate = requirements_updated_at > cache_last_populated_at + pyproject_updated_at = os.path.getmtime("pyproject.toml") + need_to_repopulate = pyproject_updated_at > cache_last_populated_at # Clear the stale cache. if need_to_repopulate: @@ -78,7 +76,7 @@ def test(session: nox.Session) -> None: session, "wheel", "-w", LOCATIONS["common-wheels"], - "-r", REQUIREMENTS["common-wheels"], + "--group", "test-common-wheels", ) # fmt: on else: @@ -115,7 +113,7 @@ def test(session: nox.Session) -> None: run_with_protected_pip(session, "install", generated_sdist) # Install test dependencies - run_with_protected_pip(session, "install", "-r", REQUIREMENTS["tests"]) + run_with_protected_pip(session, "install", "--group", "test") # Parallelize tests as much as possible, by default. arguments = session.posargs or ["-n", "auto"] diff --git a/pyproject.toml b/pyproject.toml index cc420de957f..90f04307f47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -48,6 +48,36 @@ Changelog = "https://pip.pypa.io/en/stable/news/" requires = ["setuptools>=77"] build-backend = "setuptools.build_meta" +[dependency-groups] +test = [ + "cryptography", + "freezegun", + "installer", + "pytest", + "pytest-cov", + "pytest-rerunfailures", + "pytest-xdist", + "scripttest", + "setuptools", + # macOS (darwin) arm64 always uses virtualenv >= 20.0 + # for other platforms, it depends on python version + "virtualenv < 20.0 ; python_version < '3.10' and (sys_platform != 'darwin' or platform_machine != 'arm64')", + "virtualenv >= 20.0 ; python_version >= '3.10' or (sys_platform == 'darwin' and platform_machine == 'arm64')", + "werkzeug", + "wheel", + "tomli-w", + "proxy.py", +] + +test-common-wheels = [ + # We pin setuptools<80 because our test suite currently + # depends on setup.py develop to generate egg-link files. + "setuptools >= 40.8.0, != 60.6.0, <80", + "wheel", + # As required by pytest-cov. + "coverage >= 4.4", +] + [tool.setuptools] package-dir = {"" = "src"} include-package-data = false diff --git a/tests/requirements-common_wheels.txt b/tests/requirements-common_wheels.txt deleted file mode 100644 index 31450a0e861..00000000000 --- a/tests/requirements-common_wheels.txt +++ /dev/null @@ -1,13 +0,0 @@ -# Create local setuptools wheel files for testing by: -# 1. Cloning setuptools and checking out the branch of interest -# 2. Running `python3 bootstrap.py` in that directory -# 3. Running `python3 -m pip wheel --no-cache -w /tmp/setuptools_build_meta_legacy/ .` -# 4. Replacing the `setuptools` entry below with a `file:///...` URL -# (Adjust artifact directory used based on preference and operating system) - -# We pin setuptools<80 because our test suite currently -# depends on setup.py develop to generate egg-link files. -setuptools >= 40.8.0, != 60.6.0, <80 -wheel -# As required by pytest-cov. -coverage >= 4.4 diff --git a/tests/requirements.txt b/tests/requirements.txt deleted file mode 100644 index 0568aea5178..00000000000 --- a/tests/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -cryptography -freezegun -installer -pytest -pytest-cov -pytest-rerunfailures -pytest-xdist -scripttest -setuptools -# macOS (darwin) arm64 always uses virtualenv >= 20.0 -# for other platforms, it depends on python version -virtualenv < 20.0 ; python_version < '3.10' and (sys_platform != 'darwin' or platform_machine != 'arm64') -virtualenv >= 20.0 ; python_version >= '3.10' or (sys_platform == 'darwin' and platform_machine == 'arm64') -werkzeug -wheel -tomli-w -proxy.py