summaryrefslogtreecommitdiff
path: root/Programs
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-14 18:58:01 +0100
committerGitHub <noreply@github.com>2018-11-14 18:58:01 +0100
commit9ee1d42f019ac827f73479ce241e95733d050e67 (patch)
treee1c14bbdec2da830506875867064e5e50411ff5c /Programs
parent9053d2f2e09f9583473fb3c1960cba9bda8f3be1 (diff)
downloadcpython-git-9ee1d42f019ac827f73479ce241e95733d050e67.tar.gz
bpo-35233: InitConfigTests tests more config vars (GH-10541) (GH-10546)
test_embed.InitConfigTests tests more configuration variables. Changes: * InitConfigTests tests more core configuration variables: * base_exec_prefix * base_prefix * exec_prefix * home * module_search_path_env * prefix * "_testembed init_from_config" tests more variables: * argv * warnoptions * xoptions * Py_HasFileSystemDefaultEncoding value is no longer tested since it depends on the LC_CTYPE locale and the platform. * InitConfigTests: add check_global_config(), check_core_config() and check_main_config() subfunctions to cleanup the code. Move also constants at the class level (ex: COPY_MAIN_CONFIG). * Use more macros in _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict() to reduce code duplication. * Other minor cleanups. (cherry picked from commit 01de89cb59107d4f889aa503a1c0350dae4aebaf)
Diffstat (limited to 'Programs')
-rw-r--r--Programs/_testembed.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/Programs/_testembed.c b/Programs/_testembed.c
index b198962db3..20b853e98d 100644
--- a/Programs/_testembed.c
+++ b/Programs/_testembed.c
@@ -467,10 +467,30 @@ static int test_init_from_config(void)
Py_SetProgramName(L"./globalvar");
config.program_name = L"./conf_program_name";
- /* FIXME: test argc/argv */
+ static wchar_t* argv[2] = {
+ L"-c",
+ L"pass",
+ };
+ config.argc = Py_ARRAY_LENGTH(argv);
+ config.argv = argv;
+
config.program = L"conf_program";
- /* FIXME: test xoptions */
- /* FIXME: test warnoptions */
+
+ static wchar_t* xoptions[3] = {
+ L"core_xoption1=3",
+ L"core_xoption2=",
+ L"core_xoption3",
+ };
+ config.nxoption = Py_ARRAY_LENGTH(xoptions);
+ config.xoptions = xoptions;
+
+ static wchar_t* warnoptions[2] = {
+ L"default",
+ L"error::ResourceWarning",
+ };
+ config.nwarnoption = Py_ARRAY_LENGTH(warnoptions);
+ config.warnoptions = warnoptions;
+
/* FIXME: test module_search_path_env */
/* FIXME: test home */
/* FIXME: test path config: module_search_path .. dll_path */