You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_exc() helper in test_format.py doesn't fail if exception message unexpected #119949
changed the title [-]test_exc() helper in test_format.py doesn't fail if exception messages unexpected[/-][+]test_exc() helper in test_format.py doesn't fail if exception message unexpected[/+]on Jun 2, 2024
We should use standard TestCase methods assertRaises()/assertRaisesRegex() to handle expected errors and subTest() to add more context and allow multiple failures per test.
Activity
[-]test_exc() helper in test_format.py doesn't fail if exception messages unexpected[/-][+]test_exc() helper in test_format.py doesn't fail if exception message unexpected[/+]vstinner commentedon Jun 3, 2024
Do you want to propose a fix?
skirpichev commentedon Jun 3, 2024
First, I think that raise statement from mentioned PR was a right quick fix. Code seems quite old (9f8ad3f) and that part could be easily backported.
serhiy-storchaka commentedon Jun 4, 2024
We should use standard TestCase methods
assertRaises()/assertRaisesRegex()to handle expected errors andsubTest()to add more context and allow multiple failures per test.skirpichev commentedon Jun 4, 2024
Should we keep old helper interfaces, i.e. test_exc()?
vstinner commentedon Jun 4, 2024
test_exc() can be kept, right.
serhiy-storchaka commentedon Jun 4, 2024
It should be kept if it is used.
pythongh-119949: refactor test_exc() helper in test_format.py
gh-119949: Refactor test_exc() helper in test_format.py (GH-135452)
[3.15] gh-119949: Refactor test_exc() helper in test_format.py (GH-13…
skirpichev commentedon Jul 8, 2026
Ah, this is fixed.