diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index 71f6a300341..87f929f3147 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -447,6 +447,7 @@ def test_exec_filename(self): "warnings.warn('hello', UserWarning)"), filename, "exec") with original_warnings.catch_warnings(record=True) as w: + self.module.simplefilter("always", category=UserWarning) exec(codeobj) self.assertEqual(w[0].filename, filename)