From 9d215added2511dbf377a8d5480bdfa1c0b61bff Mon Sep 17 00:00:00 2001 From: lokidev Date: Tue, 13 Feb 2024 21:38:44 +0100 Subject: [PATCH] Make pytest ignore py312 files for older py --- tests/conftest.py | 4 ++++ ...t_dependency_pep695.py => test_dependency_pep695_py312.py} | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 tests/conftest.py rename tests/{test_dependency_pep695.py => test_dependency_pep695_py312.py} (89%) diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 000000000..521e9f0f7 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,4 @@ +import sys + +if sys.version_info < (3, 12): + collect_ignore_glob = ["*_py312.py"] diff --git a/tests/test_dependency_pep695.py b/tests/test_dependency_pep695_py312.py similarity index 89% rename from tests/test_dependency_pep695.py rename to tests/test_dependency_pep695_py312.py index 675c6a7d1..378c9d3ee 100644 --- a/tests/test_dependency_pep695.py +++ b/tests/test_dependency_pep695_py312.py @@ -4,6 +4,7 @@ from typing import Annotated from fastapi import Depends, FastAPI from fastapi.testclient import TestClient + from .utils import needs_py312 @@ -19,7 +20,7 @@ def test_pep695_type_dependencies(): app = FastAPI() @app.get("/") - async def get_with_dep(value: DependedValue) -> str: + async def get_with_dep(value: DependedValue) -> str: # noqa return f"value: {value}" client = TestClient(app)