mirror of
https://github.com/python/cpython.git
synced 2025-11-03 15:11:34 +00:00
gh-76785: Add More Tests to test_interpreters.test_api (gh-117662)
In addition to the increase test coverage, this is a precursor to sorting out how we handle interpreters created directly via the C-API.
This commit is contained in:
parent
0cc71bde00
commit
993c3cca16
18 changed files with 2015 additions and 421 deletions
|
|
@ -2065,7 +2065,7 @@ def test_configured_settings(self):
|
|||
_testinternalcapi.get_interp_settings()
|
||||
raise NotImplementedError('unreachable')
|
||||
''')
|
||||
with self.assertRaises(RuntimeError):
|
||||
with self.assertRaises(_interpreters.InterpreterError):
|
||||
support.run_in_subinterp_with_config(script, **kwargs)
|
||||
|
||||
@unittest.skipIf(_testsinglephase is None, "test requires _testsinglephase module")
|
||||
|
|
@ -2403,7 +2403,7 @@ def check(config):
|
|||
continue
|
||||
if match(config, invalid):
|
||||
with self.subTest(f'invalid: {config}'):
|
||||
with self.assertRaises(RuntimeError):
|
||||
with self.assertRaises(_interpreters.InterpreterError):
|
||||
check(config)
|
||||
elif match(config, questionable):
|
||||
with self.subTest(f'questionable: {config}'):
|
||||
|
|
@ -2427,7 +2427,7 @@ def new_interp(config):
|
|||
with self.subTest('main'):
|
||||
expected = _interpreters.new_config('legacy')
|
||||
expected.gil = 'own'
|
||||
interpid = _interpreters.get_main()
|
||||
interpid, *_ = _interpreters.get_main()
|
||||
config = _interpreters.get_config(interpid)
|
||||
self.assert_ns_equal(config, expected)
|
||||
|
||||
|
|
@ -2579,7 +2579,7 @@ def test_linked_lifecycle_does_not_exist(self):
|
|||
|
||||
def test_linked_lifecycle_initial(self):
|
||||
is_linked = _testinternalcapi.interpreter_refcount_linked
|
||||
get_refcount = _testinternalcapi.get_interpreter_refcount
|
||||
get_refcount, _, _ = self.get_refcount_helpers()
|
||||
|
||||
# A new interpreter will start out not linked, with a refcount of 0.
|
||||
interpid = self.new_interpreter()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue