From: Victor Stinner Date: Thu, 2 Oct 2025 14:52:10 +0000 (+0200) Subject: gh-89745: Remove test_embed.test_init_read_set() (#139500) X-Git-Tag: v3.15.0a1~159 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6826ebf9866b860367e4763b3e4651950614c5aa;p=thirdparty%2FPython%2Fcpython.git gh-89745: Remove test_embed.test_init_read_set() (#139500) Since Python 3.11, it's no longer possible to call PyConfig_Read() to get the path configuration, and then modify the path configuration. --- diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 22dfdb6bb6f1..1933f691a78b 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -1232,21 +1232,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): self.check_all_configs("test_init_dont_configure_locale", {}, preconfig, api=API_PYTHON) - @unittest.skip('as of 3.11 this test no longer works because ' - 'path calculations do not occur on read') - def test_init_read_set(self): - config = { - 'program_name': './init_read_set', - 'executable': 'my_executable', - 'base_executable': 'my_executable', - } - def modify_path(path): - path.insert(1, "test_path_insert1") - path.append("test_path_append") - self.check_all_configs("test_init_read_set", config, - api=API_PYTHON, - modify_path_cb=modify_path) - def test_init_sys_add(self): config = { 'faulthandler': 1, diff --git a/Programs/_testembed.c b/Programs/_testembed.c index 76c61efeb50a..d3600fecbe27 100644 --- a/Programs/_testembed.c +++ b/Programs/_testembed.c @@ -1506,44 +1506,6 @@ static int test_audit_run_stdin(void) return run_audit_run_test(Py_ARRAY_LENGTH(argv), argv, &test); } -static int test_init_read_set(void) -{ - PyStatus status; - PyConfig config; - PyConfig_InitPythonConfig(&config); - - config_set_string(&config, &config.program_name, L"./init_read_set"); - - status = PyConfig_Read(&config); - if (PyStatus_Exception(status)) { - goto fail; - } - - status = PyWideStringList_Insert(&config.module_search_paths, - 1, L"test_path_insert1"); - if (PyStatus_Exception(status)) { - goto fail; - } - - status = PyWideStringList_Append(&config.module_search_paths, - L"test_path_append"); - if (PyStatus_Exception(status)) { - goto fail; - } - - /* override executable computed by PyConfig_Read() */ - config_set_string(&config, &config.executable, L"my_executable"); - init_from_config_clear(&config); - - dump_config(); - Py_Finalize(); - return 0; - -fail: - PyConfig_Clear(&config); - Py_ExitStatusException(status); -} - static int test_init_sys_add(void) { @@ -2398,7 +2360,6 @@ static struct TestCase TestCases[] = { {"test_preinit_isolated2", test_preinit_isolated2}, {"test_preinit_parse_argv", test_preinit_parse_argv}, {"test_preinit_dont_parse_argv", test_preinit_dont_parse_argv}, - {"test_init_read_set", test_init_read_set}, {"test_init_run_main", test_init_run_main}, {"test_init_sys_add", test_init_sys_add}, {"test_init_setpath", test_init_setpath},