From 0d512f07d87b9e21940eba9e65c33cadf3761544 Mon Sep 17 00:00:00 2001 From: Alex Barcelo Date: Mon, 10 Feb 2025 16:59:02 +0100 Subject: [PATCH] better docker generation to validate each python version in each nox session --- noxfile.py | 3 ++- pyproject.toml | 3 ++- tests/functional/conftest.py | 10 ++++++++-- tests/proxy/proxy_non_owner/conftest.py | 12 ++++++++---- tests/proxy/proxy_owner/conftest.py | 12 ++++++++---- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/noxfile.py b/noxfile.py index 009d19d..c8894c9 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,7 +1,8 @@ import nox # Define which Python versions to test with -PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] +PYPROJECT = nox.project.load_toml("pyproject.toml") +PYTHON_VERSIONS = nox.project.python_versions(PYPROJECT) LATEST_PYTHON_VERSION = PYTHON_VERSIONS[-1] # Default sessions (these will be executed in Github Actions) diff --git a/pyproject.toml b/pyproject.toml index 5aca882..2475bb5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,9 +22,10 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3 :: Only", ] -requires-python = ">=3.9" +requires-python = ">=3.9,<3.14" dependencies = [ "aiorwlock>=1.4.0", "bcrypt>=4.1.1", diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 0dd1ee0..e258571 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -1,4 +1,5 @@ import os +import sys import grpc import pytest @@ -7,8 +8,13 @@ @pytest.fixture(scope="session") -def docker_compose_command(): - return "docker compose" +def python_version(): + return f"{sys.version_info.major}.{sys.version_info.minor}" + + +@pytest.fixture(scope="session") +def docker_setup(python_version): + return [f"build --build-arg PYTHON_VERSION={python_version}-bookworm", "up -d"] @pytest.fixture(scope="session") diff --git a/tests/proxy/proxy_non_owner/conftest.py b/tests/proxy/proxy_non_owner/conftest.py index c88eb81..ccc585c 100644 --- a/tests/proxy/proxy_non_owner/conftest.py +++ b/tests/proxy/proxy_non_owner/conftest.py @@ -1,6 +1,5 @@ import os -import subprocess -import time +import sys import grpc import pytest @@ -9,8 +8,13 @@ @pytest.fixture(scope="session") -def docker_compose_command(): - return "docker compose" +def python_version(): + return f"{sys.version_info.major}.{sys.version_info.minor}" + + +@pytest.fixture(scope="session") +def docker_setup(python_version): + return [f"build --build-arg PYTHON_VERSION={python_version}-bookworm", "up -d"] @pytest.fixture(scope="session") diff --git a/tests/proxy/proxy_owner/conftest.py b/tests/proxy/proxy_owner/conftest.py index 515b041..5aea46a 100644 --- a/tests/proxy/proxy_owner/conftest.py +++ b/tests/proxy/proxy_owner/conftest.py @@ -1,6 +1,5 @@ import os -import subprocess -import time +import sys import grpc import pytest @@ -9,8 +8,13 @@ @pytest.fixture(scope="session") -def docker_compose_command(): - return "docker compose" +def python_version(): + return f"{sys.version_info.major}.{sys.version_info.minor}" + + +@pytest.fixture(scope="session") +def docker_setup(python_version): + return [f"build --build-arg PYTHON_VERSION={python_version}-bookworm", "up -d"] @pytest.fixture(scope="session")