From d90b37adfee3e8116d9a10ff505e5cdfc8a5ef75 Mon Sep 17 00:00:00 2001 From: YeLinAung <40236753+b14cknc0d3@users.noreply.github.com> Date: Sun, 9 Nov 2025 09:23:32 +0630 Subject: [PATCH] fix: Suppress route conflict warnings in tutorial tests --- .../test_bigger_applications/test_main.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test_tutorial/test_bigger_applications/test_main.py b/tests/test_tutorial/test_bigger_applications/test_main.py index fe40fad7d..3b395be7a 100644 --- a/tests/test_tutorial/test_bigger_applications/test_main.py +++ b/tests/test_tutorial/test_bigger_applications/test_main.py @@ -1,4 +1,5 @@ import importlib +import warnings import pytest from dirty_equals import IsDict @@ -16,9 +17,21 @@ from ...utils import needs_py39 ], ) def get_client(request: pytest.FixtureRequest): - mod = importlib.import_module(f"docs_src.bigger_applications.{request.param}") - - client = TestClient(mod.app) + # Suppress route conflict warnings. + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", + message="Route .* may shadow existing route .*", + category=UserWarning, + ) + warnings.filterwarnings( + "ignore", + message="Route .* may be shadowed by existing route .*", + category=UserWarning, + ) + mod = importlib.import_module(f"docs_src.bigger_applications.{request.param}") + + client = TestClient(mod.app) return client