Skip to content

Commit 7e84118

Browse files
committed
Handle warnings in unittest marker
1 parent 78c0cab commit 7e84118

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Lib/test/support/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,12 @@ def check_bolt_optimized():
877877
return '--enable-bolt' in config_args
878878

879879

880+
with warnings.catch_warnings():
881+
# ignore DeprecationWarning on sys.abiflags change on Windows
882+
warnings.simplefilter('ignore', DeprecationWarning)
883+
HAS_SYS_ABIFLAGS = hasattr(sys, 'abiflags') # equal to `not sys.platform.startswith('win')`
884+
885+
880886
Py_GIL_DISABLED = bool(sysconfig.get_config_var('Py_GIL_DISABLED'))
881887

882888
def requires_gil_enabled(msg="needs the GIL enabled"):

Lib/test/test_sys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ def test_pystats(self):
13551355
sys._stats_dump()
13561356

13571357
@test.support.cpython_only
1358-
@unittest.skipUnless(hasattr(sys, 'abiflags'), 'need sys.abiflags')
1358+
@unittest.skipUnless(support.HAS_SYS_ABIFLAGS, 'need sys.abiflags')
13591359
def test_disable_gil_abi(self):
13601360
self.assertEqual('t' in sys.abiflags, support.Py_GIL_DISABLED)
13611361

0 commit comments

Comments
 (0)