We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4f9a2d commit 7eebeb8Copy full SHA for 7eebeb8
Lib/test/test_warnings/__init__.py
@@ -727,10 +727,15 @@ def test_showwarnmsg_missing(self):
727
text = 'del _showwarnmsg test'
728
with original_warnings.catch_warnings(module=self.module):
729
self.module.filterwarnings("always", category=UserWarning)
730
- del self.module._showwarnmsg
731
- with support.captured_output('stderr') as stream:
732
- self.module.warn(text)
733
- result = stream.getvalue()
+
+ show = self.module._showwarnmsg
+ try:
+ del self.module._showwarnmsg
734
+ with support.captured_output('stderr') as stream:
735
+ self.module.warn(text)
736
+ result = stream.getvalue()
737
+ finally:
738
+ self.module._showwarnmsg = show
739
self.assertIn(text, result)
740
741
def test_showwarning_not_callable(self):
0 commit comments