Skip to content

Commit d4ffc4c

Browse files
tests: mark trailing slash test as xfail
Pydantic's AnyUrl incorrectly adds trailing slashes to base URLs without paths. This behavior is being fixed in pydantic-core PR #1719 and will be available in Pydantic 2.12+. Instead of working around the issue, mark the test as expected to fail. This documents the known bug and will automatically alert when Pydantic fixes it (the test will XPASS with xfail_strict=true in pyproject.toml). Ref: pydantic/pydantic-core#1719
1 parent 91722aa commit d4ffc4c

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tests/client/test_auth.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -836,16 +836,20 @@ async def test_token_exchange_error_basic(self, oauth_provider, oauth_client_inf
836836
"revocation_endpoint",
837837
),
838838
(
839-
# TODO(Marcelo): Since we are using `AnyUrl`, the trailing slash is always added.
840-
# pytest.param(
841-
# "https://auth.example.com",
842-
# "https://auth.example.com/docs",
843-
# "https://auth.example.com/authorize",
844-
# "https://auth.example.com/token",
845-
# "https://auth.example.com/register",
846-
# "https://auth.example.com/revoke",
847-
# id="simple-url",
848-
# ),
839+
# Pydantic's AnyUrl incorrectly adds trailing slash to base URLs
840+
# This is being fixed in https://github.com/pydantic/pydantic-core/pull/1719 (Pydantic 2.12+)
841+
pytest.param(
842+
"https://auth.example.com",
843+
"https://auth.example.com/docs",
844+
"https://auth.example.com/authorize",
845+
"https://auth.example.com/token",
846+
"https://auth.example.com/register",
847+
"https://auth.example.com/revoke",
848+
id="simple-url",
849+
marks=pytest.mark.xfail(
850+
reason="Pydantic AnyUrl adds trailing slash to base URLs - fixed in Pydantic 2.12+"
851+
),
852+
),
849853
pytest.param(
850854
"https://auth.example.com/",
851855
"https://auth.example.com/docs",

0 commit comments

Comments
 (0)