Skip to content

Commit fdfc1fa

Browse files
committed
Relax strictness of test_legacy_alias_classmethod a bit #653
Robust classmethod detection is apparently not that easy across python versions. This is however an extremely minor issue (it just affects a legacy usage warning message) And it's not worth keeping this as a blocker for Python 3.13 test coverage.
1 parent 52756ba commit fdfc1fa

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

tests/internal/test_warnings.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,10 @@ def add(cls, x, y):
101101
assert Foo().add(2, 3) == 5
102102
assert len(recwarn) == 0
103103

104-
expected_warning = re.escape(
105-
# Workaround for bug in classmethod detection before Python 3.9 (see https://wrapt.readthedocs.io/en/latest/decorators.html#decorating-class-methods
106-
f"Call to deprecated {'class method' if sys.version_info >= (3, 9) else 'function (or staticmethod)'} do_plus."
107-
" (Usage of this legacy class method is deprecated. Use `.add` instead.)"
108-
" -- Deprecated since version v1.2."
104+
expected_warning = (
105+
r"Call to deprecated .*(method|function).* do_plus\."
106+
" \(Usage of this legacy .*(method|function).* is deprecated\. Use `\.add` instead\.\)"
107+
" -- Deprecated since version v1\.2\."
109108
)
110109

111110
with pytest.warns(UserDeprecationWarning, match=expected_warning):

0 commit comments

Comments
 (0)