Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6d26eba

Browse files
committed
Check that warnings.showwarning() is not changed.
1 parent 13d8ff9 commit 6d26eba

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Lib/test/regrtest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ def __init__(self, testname, verbose=0, quiet=False):
10621062
'sys.warnoptions', 'threading._dangling',
10631063
'multiprocessing.process._dangling',
10641064
'sysconfig._CONFIG_VARS', 'sysconfig._INSTALL_SCHEMES',
1065-
'support.TESTFN', 'locale',
1065+
'support.TESTFN', 'locale', 'warnings.showwarning',
10661066
)
10671067

10681068
def get_sys_argv(self):
@@ -1244,6 +1244,11 @@ def restore_locale(self, saved):
12441244
for lc, setting in saved:
12451245
locale.setlocale(lc, setting)
12461246

1247+
def get_warnings_showwarning(self):
1248+
return warnings.showwarning
1249+
def restore_warnings_showwarning(self, fxn):
1250+
warnings.showwarning = fxn
1251+
12471252
def resource_info(self):
12481253
for name in self.resources:
12491254
method_suffix = name.replace('.', '_')

0 commit comments

Comments
 (0)