Skip to content

Commit 0e62347

Browse files
Bordacarmocca
authored andcommitted
improve debug failing warning test (#18271)
Co-authored-by: Carlos Mocholí <[email protected]> (cherry picked from commit 3ac550f)
1 parent 28e0bdd commit 0e62347

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

tests/tests_fabric/utilities/test_warnings.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,19 @@
4040
cache.deprecation("test7")
4141

4242
output = stderr.getvalue()
43-
assert "test_warnings.py:30: UserWarning: test1" in output
44-
assert "test_warnings.py:31: DeprecationWarning: test2" in output
45-
46-
assert "test_warnings.py:33: UserWarning: test3" in output
47-
assert "test_warnings.py:34: DeprecationWarning: test4" in output
48-
49-
assert "test_warnings.py:36: LightningDeprecationWarning: test5" in output
50-
51-
assert "test_warnings.py:39: UserWarning: test6" in output
52-
assert "test_warnings.py:40: LightningDeprecationWarning: test7" in output
43+
base_line = 30
44+
expected_lines = [
45+
f"test_warnings.py:{base_line}: UserWarning: test1",
46+
f"test_warnings.py:{base_line+1}: DeprecationWarning: test2",
47+
f"test_warnings.py:{base_line+3}: UserWarning: test3",
48+
f"test_warnings.py:{base_line+4}: DeprecationWarning: test4",
49+
f"test_warnings.py:{base_line+6}: LightningDeprecationWarning: test5",
50+
f"test_warnings.py:{base_line+9}: UserWarning: test6",
51+
f"test_warnings.py:{base_line+10}: LightningDeprecationWarning: test7",
52+
]
53+
54+
for ln in expected_lines:
55+
assert ln in output, f"Missing line {ln!r} in:\n{output}"
5356

5457
# check that logging is properly configured
5558
import logging

0 commit comments

Comments
 (0)