Skip to content

Commit 299cec6

Browse files
committed
Update tests
1 parent 5689c1f commit 299cec6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Lib/test/test_sysconfig.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ def test_always_set_py_gil_disabled(self):
611611
self.assertEqual(Py_GIL_DISABLED, support.Py_GIL_DISABLED)
612612

613613
def test_abiflags(self):
614-
# XXX: If this test fails on some platforms, maintainers should add/update
614+
# If this test fails on some platforms, maintainers should add/update
615615
# the definition of the ABIFLAGS variable and make this test pass.
616616
abiflags = sysconfig.get_config_var('abiflags')
617617
ABIFLAGS = sysconfig.get_config_var('ABIFLAGS')
@@ -620,10 +620,17 @@ def test_abiflags(self):
620620
self.assertIsInstance(ABIFLAGS, str)
621621
self.assertIn(abiflags, ABIFLAGS)
622622

623+
# Check all flags are alphabetic
623624
if os.name == 'nt':
624625
self.assertEqual(abiflags, '')
625626
# Example values: '', 't', 't_d', '_d'
626-
self.assertTrue(ABIFLAGS.count('_d') == 1 or '_' not in ABIFLAGS, ABIFLAGS)
627+
# '_' can only exist if 'd' is present
628+
if '_' in ABIFLAGS:
629+
# '_' is followed by 'd'
630+
self.assertTrue(ABIFLAGS.count('_d') == 1, ABIFLAGS)
631+
self.assertTrue(ABIFLAGS.count('_') == 1, ABIFLAGS)
632+
else:
633+
self.assertNotIn('d', ABIFLAGS)
627634
else:
628635
# Example values: '', 't', 'td', 'd'
629636
self.assertNotIn('_', ABIFLAGS)

0 commit comments

Comments
 (0)