Skip to content

Commit 7f4a191

Browse files
committed
Fix brittle way of checking warning messages
Which was causing a type error.
1 parent aee7078 commit 7f4a191

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/deprecation/test_attributes.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_util_alias_access_warns() -> None:
5151
git.util
5252

5353
assert len(ctx) == 1
54-
message = ctx[0].message.args[0]
54+
message = str(ctx[0].message)
5555
assert "git.util" in message
5656
assert "git.index.util" in message
5757
assert "should not be relied on" in message
@@ -61,7 +61,7 @@ def test_util_alias_import_warns() -> None:
6161
with pytest.deprecated_call() as ctx:
6262
from git import util # noqa: F401
6363

64-
message = ctx[0].message.args[0]
64+
message = str(ctx[0].message)
6565
assert "git.util" in message
6666
assert "git.index.util" in message
6767
assert "should not be relied on" in message
@@ -114,10 +114,12 @@ def test_private_module_alias_access_warns(self, name: str, fullname: str) -> No
114114
getattr(git, name)
115115

116116
assert len(ctx) == 1
117-
assert ctx[0].message.args[0].endswith(f"Use {fullname} instead.")
117+
message = str(ctx[0].message)
118+
assert message.endswith(f"Use {fullname} instead.")
118119

119120
def test_private_module_alias_import_warns(self, name: str, fullname: str) -> None:
120121
with pytest.deprecated_call() as ctx:
121122
exec(f"from git import {name}")
122123

123-
assert ctx[0].message.args[0].endswith(f"Use {fullname} instead.")
124+
message = str(ctx[0].message)
125+
assert message.endswith(f"Use {fullname} instead.")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy