Skip to content

Commit 6826ebf

Browse files
authored
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.
1 parent 60655cd commit 6826ebf

File tree

2 files changed

+0
-54
lines changed

2 files changed

+0
-54
lines changed

Lib/test/test_embed.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,21 +1232,6 @@ def test_init_dont_configure_locale(self):
12321232
self.check_all_configs("test_init_dont_configure_locale", {}, preconfig,
12331233
api=API_PYTHON)
12341234

1235-
@unittest.skip('as of 3.11 this test no longer works because '
1236-
'path calculations do not occur on read')
1237-
def test_init_read_set(self):
1238-
config = {
1239-
'program_name': './init_read_set',
1240-
'executable': 'my_executable',
1241-
'base_executable': 'my_executable',
1242-
}
1243-
def modify_path(path):
1244-
path.insert(1, "test_path_insert1")
1245-
path.append("test_path_append")
1246-
self.check_all_configs("test_init_read_set", config,
1247-
api=API_PYTHON,
1248-
modify_path_cb=modify_path)
1249-
12501235
def test_init_sys_add(self):
12511236
config = {
12521237
'faulthandler': 1,

Programs/_testembed.c

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,44 +1506,6 @@ static int test_audit_run_stdin(void)
15061506
return run_audit_run_test(Py_ARRAY_LENGTH(argv), argv, &test);
15071507
}
15081508

1509-
static int test_init_read_set(void)
1510-
{
1511-
PyStatus status;
1512-
PyConfig config;
1513-
PyConfig_InitPythonConfig(&config);
1514-
1515-
config_set_string(&config, &config.program_name, L"./init_read_set");
1516-
1517-
status = PyConfig_Read(&config);
1518-
if (PyStatus_Exception(status)) {
1519-
goto fail;
1520-
}
1521-
1522-
status = PyWideStringList_Insert(&config.module_search_paths,
1523-
1, L"test_path_insert1");
1524-
if (PyStatus_Exception(status)) {
1525-
goto fail;
1526-
}
1527-
1528-
status = PyWideStringList_Append(&config.module_search_paths,
1529-
L"test_path_append");
1530-
if (PyStatus_Exception(status)) {
1531-
goto fail;
1532-
}
1533-
1534-
/* override executable computed by PyConfig_Read() */
1535-
config_set_string(&config, &config.executable, L"my_executable");
1536-
init_from_config_clear(&config);
1537-
1538-
dump_config();
1539-
Py_Finalize();
1540-
return 0;
1541-
1542-
fail:
1543-
PyConfig_Clear(&config);
1544-
Py_ExitStatusException(status);
1545-
}
1546-
15471509

15481510
static int test_init_sys_add(void)
15491511
{
@@ -2398,7 +2360,6 @@ static struct TestCase TestCases[] = {
23982360
{"test_preinit_isolated2", test_preinit_isolated2},
23992361
{"test_preinit_parse_argv", test_preinit_parse_argv},
24002362
{"test_preinit_dont_parse_argv", test_preinit_dont_parse_argv},
2401-
{"test_init_read_set", test_init_read_set},
24022363
{"test_init_run_main", test_init_run_main},
24032364
{"test_init_sys_add", test_init_sys_add},
24042365
{"test_init_setpath", test_init_setpath},

0 commit comments

Comments
 (0)