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

Method test_new_config

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

Source from the content-addressed store, hash-verified

1936 # mostly shouldn't matter as much.
1937
1938 def test_new_config(self):
1939 # This test overlaps with
1940 # test.test_capi.test_misc.InterpreterConfigTests.
1941
1942 default = _interpreters.new_config('isolated')
1943 with self.subTest('no arg'):
1944 config = _interpreters.new_config()
1945 self.assert_ns_equal(config, default)
1946 self.assertIsNot(config, default)
1947
1948 with self.subTest('default'):
1949 config1 = _interpreters.new_config('default')
1950 self.assert_ns_equal(config1, default)
1951 self.assertIsNot(config1, default)
1952
1953 config2 = _interpreters.new_config('default')
1954 self.assert_ns_equal(config2, config1)
1955 self.assertIsNot(config2, config1)
1956
1957 for arg in ['', 'default']:
1958 with self.subTest(f'default ({arg!r})'):
1959 config = _interpreters.new_config(arg)
1960 self.assert_ns_equal(config, default)
1961 self.assertIsNot(config, default)
1962
1963 supported = {
1964 'isolated': types.SimpleNamespace(
1965 use_main_obmalloc=False,
1966 allow_fork=False,
1967 allow_exec=False,
1968 allow_threads=True,
1969 allow_daemon_threads=False,
1970 check_multi_interp_extensions=True,
1971 gil='own',
1972 ),
1973 'legacy': types.SimpleNamespace(
1974 use_main_obmalloc=True,
1975 allow_fork=True,
1976 allow_exec=True,
1977 allow_threads=True,
1978 allow_daemon_threads=True,
1979 check_multi_interp_extensions=bool(Py_GIL_DISABLED),
1980 gil='shared',
1981 ),
1982 'empty': types.SimpleNamespace(
1983 use_main_obmalloc=False,
1984 allow_fork=False,
1985 allow_exec=False,
1986 allow_threads=False,
1987 allow_daemon_threads=False,
1988 check_multi_interp_extensions=False,
1989 gil='default',
1990 ),
1991 }
1992 gil_supported = ['default', 'shared', 'own']
1993
1994 for name, vanilla in supported.items():
1995 with self.subTest(f'supported ({name})'):

Callers

nothing calls this directly

Calls 6

new_configMethod · 0.80
assertIsNotMethod · 0.80
subTestMethod · 0.45
assert_ns_equalMethod · 0.45
itemsMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected