MCPcopy Index your code
hub / github.com/python/cpython / test_get_config

Method test_get_config

Lib/test/test_interpreters/test_api.py:2243–2274  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2241 self.interp_exists(interpid))
2242
2243 def test_get_config(self):
2244 # This test overlaps with
2245 # test.test_capi.test_misc.InterpreterConfigTests.
2246
2247 with self.subTest('main'):
2248 expected = _interpreters.new_config('legacy')
2249 expected.gil = 'own'
2250 if Py_GIL_DISABLED:
2251 expected.check_multi_interp_extensions = False
2252 interpid, *_ = _interpreters.get_main()
2253 config = _interpreters.get_config(interpid)
2254 self.assert_ns_equal(config, expected)
2255
2256 with self.subTest('isolated'):
2257 expected = _interpreters.new_config('isolated')
2258 interpid = _interpreters.create('isolated')
2259 config = _interpreters.get_config(interpid)
2260 self.assert_ns_equal(config, expected)
2261
2262 with self.subTest('legacy'):
2263 expected = _interpreters.new_config('legacy')
2264 interpid = _interpreters.create('legacy')
2265 config = _interpreters.get_config(interpid)
2266 self.assert_ns_equal(config, expected)
2267
2268 with self.subTest('from C-API'):
2269 orig = _interpreters.new_config('isolated')
2270 with self.interpreter_from_capi(orig) as interpid:
2271 with self.assertRaisesRegex(InterpreterError, 'unrecognized'):
2272 _interpreters.get_config(interpid, restrict=True)
2273 config = _interpreters.get_config(interpid)
2274 self.assert_ns_equal(config, orig)
2275
2276 @requires_test_modules
2277 def test_whence(self):

Callers

nothing calls this directly

Calls 6

new_configMethod · 0.80
interpreter_from_capiMethod · 0.80
assertRaisesRegexMethod · 0.80
subTestMethod · 0.45
assert_ns_equalMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected