Skip to content

Commit ce736ec

Browse files
committed
Add requires_subinterpreters decorator
1 parent 16ca044 commit ce736ec

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Lib/test/test_capi/test_misc.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2137,6 +2137,7 @@ def test_py_config_isoloated_per_interpreter(self):
21372137
# test fails, assume that the environment in this process may
21382138
# be altered and suspect.
21392139

2140+
@requires_subinterpreters
21402141
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")
21412142
def test_configured_settings(self):
21422143
"""
@@ -2215,17 +2216,16 @@ def test_configured_settings(self):
22152216
self.assertEqual(settings, expected)
22162217

22172218
# expected to fail
2218-
if _interpreters is not None:
2219-
for config in expected_to_fail:
2220-
kwargs = dict(zip(kwlist, config))
2221-
with self.subTest(config):
2222-
script = textwrap.dedent(f'''
2223-
import _testinternalcapi
2224-
_testinternalcapi.get_interp_settings()
2225-
raise NotImplementedError('unreachable')
2226-
''')
2227-
with self.assertRaises(_interpreters.InterpreterError):
2228-
support.run_in_subinterp_with_config(script, **kwargs)
2219+
for config in expected_to_fail:
2220+
kwargs = dict(zip(kwlist, config))
2221+
with self.subTest(config):
2222+
script = textwrap.dedent(f'''
2223+
import _testinternalcapi
2224+
_testinternalcapi.get_interp_settings()
2225+
raise NotImplementedError('unreachable')
2226+
''')
2227+
with self.assertRaises(_interpreters.InterpreterError):
2228+
support.run_in_subinterp_with_config(script, **kwargs)
22292229

22302230
@unittest.skipIf(_testsinglephase is None, "test requires _testsinglephase module")
22312231
@unittest.skipUnless(hasattr(os, "pipe"), "requires os.pipe()")

0 commit comments

Comments
 (0)