a 5dg)@sddlmZddlZddlmZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ejdkZe jdkZdZdZdZdZdZdZd Zd d Zd d ZGdddZGdddeejZGdddeejZGdddeejZe dkre!dS))supportN) namedtuplentdarwincCs.tj|}tj|d}|dS)Nr_d)ospathbasenamesplitextcasefoldendswith)Zprogramnamer+/usr/local/lib/python3.9/test/test_embed.py debug_build"s rcCs,ttj}t|D]}|dr||=q|S)NZPYTHON)dictr environlist startswith)envkeyrrrremove_python_envvars(s    rc@s:eZdZddZddZdddddddd Zd d ZdS) EmbeddingTestsMixincCstjt}tjtjtj|}d}tr^ttjr>dndd}||7}tjtj}ntj |d}tj |||_ }tj |s| d|t |_t|dS)N _testembedr z.exeZProgramsz%r doesn't exist)r r abspath__file__dirname MS_WINDOWSrsys executablejointest_exeexistsZskipTestgetcwdoldcwdchdir)selfhereZbasepathZexenameextZexepathZexerrrsetUp2s   zEmbeddingTestsMixin.setUpcCst|jdSN)r r*r)r+rrrtearDownEszEmbeddingTestsMixin.tearDownNr)rtimeout returncodeinputcwdc Gs|jg}|||dur4tr4|}tjd|d<tj|tjtjd||d}z|j ||d\} } Wn| | Yn0|j |krt jrtd|dtd| td| td ||j |d |j | f| | fS) NZ SYSTEMROOTT)stdoutstderruniversal_newlinesrr5)r4r2z--- z failed ---zstdout: zstderr: z------zbad returncode %d, stderr is %r)r&extendr"copyr r subprocessPopenPIPE communicate terminatewaitr3rverboseprint assertEqual) r+rr2r3r4r5argscmdpouterrrrrrun_embedded_interpreterHs:   z,EmbeddingTestsMixin.run_embedded_interpreterc cs"|d\}}||dd}tdd}d}g}|D]}|d|krv|t|dtjdkrlt||d7}q8| t|d t ||}|dur| |||| } tjdkrt| || j|| j|| j|| t|d kr8|d} || | |Vg}q8dS) NZ&test_repeated_init_and_subinterpretersrzS^interp (\d+) <(0x[\dA-F]+)>, thread state <(0x[\dA-F]+)>: id\(modules\) = ([\d]+)$Interpzid interp tstate modulesrz--- Pass {} ---r)rIrCr splitlinesformatlenrrArBZ assertLessrematchZ assertRegexgroupsZ assertTrueinterptstatemodulesappend) r+rGrHZ interp_patrJZnumloopsZ current_runlinerPrRmainrrr%run_repeated_init_and_subinterpretersks:              z9EmbeddingTestsMixin.run_repeated_init_and_subinterpreters)__name__ __module__ __qualname__r.r1rIrXrrrrr1s #rc@sheZdZdZddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ ddZ ddZdS)EmbeddingTestsicCs(|D]}|d}||jdqdS)Nr0)rXrCid)r+runrWrrrtest_subinterps_mains z#EmbeddingTests.test_subinterps_maincCsT|D]F}|^}}}t|j}t|D]"\}}||jt||dq*qdS)Nr)rXintr^ enumeraterCstr)r+r_rWsubs_Zmainidisubrrrtest_subinterps_different_idss    z,EmbeddingTests.test_subinterps_different_idscCsj|D]\}|^}}}d|vr*td|D]4}||j|j||j|j||j|jq.qdS)NZ0x0zplatform prints pointers as 0x0)rXunittestZSkipTestZassertNotEqualrRrSrT)r+r_rWrdrergrrrtest_subinterps_distinct_states   z-EmbeddingTests.test_subinterps_distinct_statecCsP|d\}}||dddtdtdD}d|d}|||dS)Ntest_repeated_init_and_inittabrcSsg|]}d|dqS)z --- Pass z ---r).0rfrrr zAEmbeddingTests.test_repeated_init_and_inittab..r )rIrCrange INIT_LOOPSr%)r+rGrHlinesrrrrks  z-EmbeddingTests.test_repeated_init_and_inittabcCsttjdd}|jd|d\}}tjdkr@tt|t|d}d}dgd }|j|||d }d|_ | | |dS) Nzutf-8:surrogateescape)ZPYTHONIOENCODINGtest_forced_io_encodingrrutf-8surrogateescapero)z--- Use defaults ---Expected encoding: defaultExpected errors: defaultzstdin: {in_encoding}:{errors}zstdout: {out_encoding}:{errors}'stderr: {out_encoding}:backslashreplacez--- Set errors only ---rwzExpected errors: ignorezstdin: {in_encoding}:ignorezstdout: {out_encoding}:ignoreryz--- Set encoding only ---Expected encoding: iso8859-1rxzstdin: iso8859-1:{errors}zstdout: iso8859-1:{errors}"stderr: iso8859-1:backslashreplacez--- Set encoding and errors ---rzzExpected errors: replacezstdin: iso8859-1:replacezstdout: iso8859-1:replacer{)Z in_encodingZ out_encodingerrors) rr rrIrrArBr%rMmaxDiffrCstrip)r+rrGrHZexpected_stream_encodingZexpected_errorsexpected_outputrrrrss  z&EmbeddingTests.test_forced_io_encodingcCspttjtjtjd}|jd|d\}}tr6|j }ntjt d}d|d}| ||| |ddS)N) PYTHONPATHtest_pre_initialization_apirtZspamzsys.executable: ror) rr rpathsepr%r#r rIr"r&r(assertInrC)r+rrGrHZ expected_pathrrrrrs  z*EmbeddingTests.test_pre_initialization_apicCsJt}tjtj|d<|jd|d\}}d}|||||ddS)Nr#test_pre_initialization_sys_optionsrtzsys.warnoptions: ['once', 'module', 'default'] sys._xoptions: {'not_an_option': '1', 'also_not_an_option': '2'} warnings.filters[:3]: ['default', 'module', 'once'] r) rr rr%r#r rIrrC)r+rrGrHrrrrrs  z2EmbeddingTests.test_pre_initialization_sys_optionscCs*|d\}}||d||ddS)N test_bpo20891rrIrCr+rGrHrrrrs zEmbeddingTests.test_bpo20891cCs*|d\}}||d||ddS)Ntest_initialize_twicerrrrrrr!s z$EmbeddingTests.test_initialize_twicecCs.|d\}}||d||ddS)Ntest_initialize_pymainz6Py_Main() after Py_Initialize: sys.argv=['-c', 'arg2']rrIrCrstriprrrrr*sz%EmbeddingTests.test_initialize_pymaincCs.|d\}}||d||ddS)N test_run_mainz%Py_RunMain(): sys.argv=['-c', 'arg2']rrrrrrr2szEmbeddingTests.test_run_mainN)rYrZr[r}r`rhrjrkrsrrrrrrrrrrr\s+  r\c9@s"eZdZdZerdndZeZeZe e ddddddZ erJe ddie e edeedZe e eddddddd Zgd Ze dddddddddddddeed edd ggggd d eeeeeeeejddddddddddddeedd d d dd dddd8Zer e ddie eedddZe eedddddddddd ZerFded<ddddZdgZgdZerzededd ZeddZddZddZ ddZ!dxdd Z"d!d"Z#d#d$Z$d%d&Z%dyd d d'd d(d)d*Z&d+d,Z'd-d.Z(d/d0Z)d1d2Z*d3d4Z+d5d6Z,d7d8Z-d9d:Z.d;d<Z/d=d>Z0d?d@Z1dAdBZ2dCdDZ3dEdFZ4dGdHZ5dIdJZ6dKdLZ7dMdNZ8dOdPZ9dQdRZ:dSdTZ;dUdVZd[d\Z?d]d^Z@d_d`ZAdadbZBdcddZCdzdedfZDeEjFdgdhZGdidjZHdkdlZIeJKedmdndoZLdpdqZMdrdsZNdtduZOdvdwZPd S){InitConfigTestsi surrogatepassrvrr) _config_init allocator parse_argvconfigure_localecoerce_c_localeZcoerce_c_locale_warn utf8_modelegacy_windows_fs_encoding)rrrr)rrisolateduse_environmentrdev_moder)rrrNrdefault)8rrrr_use_peg_parserinstall_signal_handlers use_hash_seed hash_seed faulthandler tracemalloc import_timeshow_ref_countZ dump_refs malloc_statsfilesystem_encodingfilesystem_errorspycache_prefix program_namerargv _orig_argvxoptions warnoptionspythonpath_envhomer$base_executableprefix base_prefix exec_prefixbase_exec_prefixmodule_search_paths platlibdir site_import bytes_warninginspect interactiveoptimization_level parser_debugwrite_bytecoderAquietuser_site_directoryconfigure_c_stdiobuffered_stdiostdio_encoding stdio_errorsZskip_source_first_line run_commandZ run_module run_filenameZ_install_importlibcheck_hash_pycs_modepathconfig_warnings _init_main_isolated_interpreterlegacy_windows_stdio)rrr) rrrrrrrrrr)ZPy_HasFileSystemDefaultEncodingZPy_HashRandomizationFlagZ$_Py_HasFileSystemDefaultEncodeErrors)Z Py_UTF8Moder))ZPy_BytesWarningFlagr)Z Py_DebugFlagr)ZPy_DontWriteBytecodeFlagrT)Z Py_FileSystemDefaultEncodeErrorsr)ZPy_FileSystemDefaultEncodingr)Z Py_FrozenFlagrT)ZPy_IgnoreEnvironmentFlagrT)ZPy_InspectFlagr)ZPy_InteractiveFlagr)ZPy_IsolatedFlagr)Z Py_NoSiteFlagrT)ZPy_NoUserSiteDirectoryrT)ZPy_OptimizeFlagr)Z Py_QuietFlagr)ZPy_UnbufferedStdioFlagrT)ZPy_VerboseFlagrA))ZPy_LegacyWindowsFSEncodingFlagr))ZPy_LegacyWindowsStdioFlagrcCs d|_dSr/)EXPECTED_CONFIG)clsrrr tearDownClassszInitConfigTests.tearDownClasscCs<i}|D].}d|vr.|dd\}}|||<qd||<q|S)N=rT)split)r+Z xoptions_listroptrvaluerrr main_xoptionss  zInitConfigTests.main_xoptionscCst}td}tjdd|g}tj||tjtjd}|jrRt d|j d|j |j d}z t |WSt jy|d|Yn0dS) Na4 import json import sys import _testinternalcapi configs = _testinternalcapi.get_configs() data = json.dumps(configs) data = data.encode('utf-8') sys.stdout.buffer.write(data) sys.stdout.buffer.flush() z-S-c)rr6r7z)failed to get the default config: stdout=z stderr=rufail to decode stdout: )rtextwrapdedentr#r$r;r_r=r3 Exceptionr6r7decodejsonloadsJSONDecodeErrorfail)r+rcoderDprocr6rrr_get_expected_config_impls$   z)InitConfigTests._get_expected_config_implcCslt}|jdur||_i}|jD]@\}}i}|D]"\}}t|trT|}|||<q:|||<q&|Sr/)rrritems isinstancerr:)r+rconfigsZ config_keyZ config_valueconfigrrrrr_get_expected_configs     z$InitConfigTests._get_expected_configcCs(|j}|}|d}|D]\} } | |jur|| || <q|drN|tkrbdD]} |j|| <qR|dst|j|d<|ddkr|d|jurd|d<|d|jur|j|d<|d |jurd|d <|d |jurd |d <tr|j} n4|d |jurt j |d } nt j t d } |d|jur2| |d<|d|jurJ| |d<|d |jurbd|d <|d} |D]"\} } | |jurr| | || <qr|d|jur|d} | dur| t j j}g||d|d<|dur|d|d<||d|jD]} | |vr|| || <qdS)N pre_configr)rrrrrrrrurrrrvrrr$rz ./_testembedrrr) __class__rrGET_DEFAULT_CONFIG API_COMPAT IGNORE_CONFIGUTF8_MODE_ERRORSr"r&r r rr%r(rrr:COPY_PRE_CONFIG)r+expected_preconfigexpectedrapimodify_path_cbrrrrrZdefault_executablerrpathsrrrget_expected_config's\           z#InitConfigTests.get_expected_configcCsNt|d}t|D]$\}}||jur||d||=q|||dS)NrrrrrpoprC)r+rrrrrrrrcheck_pre_configgs    z InitConfigTests.check_pre_configcCsNt|d}t|D]$\}}||jur||d||=q|||dS)Nrr)r+rrrrrrrr check_configos    zInitConfigTests.check_configc Cs|d}|d}t|j}|jD]D}t|dkrP|\}}}||rFdnd||<q |\}}||||<q |jD]D}t|dkr|\}}}||rdnd||<ql|\}}||||<ql||d|dS)NrrrrrZ global_config)rDEFAULT_GLOBAL_CONFIGCOPY_GLOBAL_CONFIGrNCOPY_GLOBAL_PRE_CONFIGrC) r+rrrritemZ global_keyZcore_keyZoppositerrrcheck_global_configws        z#InitConfigTests.check_global_configF) preconfig_apir ignore_stderrr5cCsbt} |dur| || }|dur(|}|tkr8|j} n|tkrH|j} n|j} |durZi}t| fi|}|durvi}|tkr|j} n|tkr|j } n|j } t| fi|}| ||||||j ||| d\}}|dur|dsd}|dur| s| ||zt|}Wn&tjy:|d|Yn0|||||||||S)N)rr5rArr)rupdate API_ISOLATEDPRE_CONFIG_ISOLATED API_PYTHONPRE_CONFIG_PYTHONPRE_CONFIG_COMPATr CONFIG_PYTHONCONFIG_ISOLATED CONFIG_COMPATrrIrCrrrrrrrr)r+ZtestnameZexpected_configrrr7rrrrr5Znew_envZdefault_preconfigZdefault_configrGrHrrrrcheck_all_configssR     z!InitConfigTests.check_all_configscCs|jdtddS)NZtest_init_initialize_configrrrr0rrrtest_init_default_configsz(InitConfigTests.test_init_default_configcCs|jdtddS)Ntest_preinit_compat_configrrr0rrrrsz*InitConfigTests.test_preinit_compat_configcCs|jdtddS)Ntest_init_compat_configrrr0rrrrsz'InitConfigTests.test_init_compat_configcCs@ddi}ddddgdddddddddd }|jd||td dS) Nrrz ./globalvarrdefault::BytesWarningr) rrrrrrrrrArrrrtest_init_global_configrrr+ preconfigrrrrr s& z'InitConfigTests.test_init_global_configc$Cs~tdd}dddddddddddd d d ggd dgd gddddddddddddddd|jdddd#}|jd||tddS)Nrrrr{r iso8859-1replaceZconf_pycache_prefixz./conf_program_namerarg2)python3-Wcmdline_warnoption-Xcmdline_xoptionrpassr)zconfig_xoption1=3zconfig_xoption2=Zconfig_xoption3r)rr Zconfig_warnoptionpass Z my_platlibdiralways)#rrrrrrrrrrrrrrrrrrrrrrrrrArrrrrrrrrrtest_init_from_configrPYMEM_ALLOCATOR_MALLOCrrrr rrrrsT7 z%InitConfigTests.test_init_from_configcCsPdti}dddddddddddddd ddd gd |jdd }|jd ||tddS)Nrr*r/my/pathenv_pycache_prefixrrrEnvVarenv_platlibdirrrrrrrrrrrrArrrrrrrrrtest_init_compat_envrrr rrrr#s4 z$InitConfigTests.test_init_compat_envcCsRtdd}dddddddddddddd ddd gd |jdd }|jd ||tddS)Nrr rrrrrrrr r!r"test_init_python_envr)rrrrr rrrr$<s6 z$InitConfigTests.test_init_python_envcCs0ttd}tdddgd}|jd||tddS)Nrrrrrrtest_init_env_dev_moder)rPYMEM_ALLOCATOR_DEBUGrrr rrrr'Zs  z&InitConfigTests.test_init_env_dev_modecCs0ttd}tdddgd}|jd||tddS)Nr%rrr&test_init_env_dev_mode_allocr)rrrrr rrrr)bs  z,InitConfigTests.test_init_env_dev_mode_alloccCs,dti}dddgd}|jd||tddS)Nrrr)rrrtest_init_dev_moder)r(rrr rrrr*js z"InitConfigTests.test_init_dev_modecCsDdti}dggdtjddddgdgd}|jd||td dS) Nr script.py)rrdevr+rrr,)rrrrrrrtest_preinit_parse_argvr)r(r r rrrr rrrr-vs  z'InitConfigTests.test_preinit_parse_argvcCs2ddi}gd}||dd}|jd||tddS)Nrr)r-Ez-Irr,rutf8r+)rrrtest_preinit_dont_parse_argvrrr)r+r rrrrrr0s z,InitConfigTests.test_preinit_dont_parse_argvcCs dddd}|jd|tddS)Nrrrrrtest_init_isolated_flagrrrr+rrrrr3s z'InitConfigTests.test_init_isolated_flagcCs dddd}|jd|tddS)Nrrr2test_preinit_isolated1rrr5rrrr6s z&InitConfigTests.test_preinit_isolated1cCs dddd}|jd|tddS)Nrrr2test_preinit_isolated2rrr5rrrr7s z&InitConfigTests.test_preinit_isolated2cCs|jdtddS)Ntest_preinit_isolated_configrr1r0rrrr8sz,InitConfigTests.test_preinit_isolated_configcCs|jdtddS)Ntest_init_isolated_configrr1r0rrrr9sz)InitConfigTests.test_init_isolated_configcCs|jdtddS)Ntest_preinit_python_configrr4r0rrrr:sz*InitConfigTests.test_preinit_python_configcCs|jdtddS)Ntest_init_python_configrr4r0rrrr;sz'InitConfigTests.test_init_python_configcCs ddd}|jdi|tddS)Nr)rrtest_init_dont_configure_localerr4)r+r rrrr<s  z/InitConfigTests.test_init_dont_configure_localecCs(ddd}dd}|jd|t|ddS)Nz./init_read_setZ my_executable)rr$cSs|dd|ddS)NrZtest_path_insert1Ztest_path_append)insertrU)r rrr modify_paths z7InitConfigTests.test_init_read_set..modify_pathtest_init_read_set)rrr4)r+rr>rrrr?sz"InitConfigTests.test_init_read_setcCs.dgdgdgdd}|jd|tddS)Nr)Zconfig_xoptionrZsysadd_xoptionr)ignore:::cmdline_warnoptionzignore:::sysadd_warnoptionzignore:::config_warnoption)rrr@rr)rrrrtest_init_sys_addrr4r5rrrrAs z!InitConfigTests.test_init_sys_addcCs8d}ddgdd|dgd|ddd}|jd |td dS) NRimport _testinternalcapi, json; print(json.dumps(_testinternalcapi.get_configs()))rrr ./python3ror)rrrrrtest_init_run_mainrr4r+rrrrrrDs z"InitConfigTests.test_init_run_maincCs<d}ddgdd|dgd|dddd }|jd |td d dS) NrBrrrrCrorr)rrrrrrtest_init_mainz)Run Python code before _Py_InitializeMain)rr7r4rErrrrFs zInitConfigTests.test_init_maincCs.dgdgddddd}|jd|td dS) Nr)rarg1-varg3./argv0r.rrrGrHrIrKrr)rrrrrrtest_init_parse_argvrr4r5rrrrLsz$InitConfigTests.test_init_parse_argvcCs4ddi}dgdgddd}|jd||tddS)NrrrJrK)rrrrtest_init_dont_parse_argvrr4)r+rrrrrrMs z)InitConfigTests.test_init_dont_parse_argvcCsDtrd}|j}nd}tr |j}nt|p,d}||||ddS)Npythonrr)rrr$)r"r&MACOSshutilwhichr)r+rrr$rrrdefault_program_namesz$InitConfigTests.default_program_namecCsX|}|dd}|ddddd}||dtjj|i}|jd|t|dddS) Nrrr)rrrrrTESTPATHtest_init_setpathTrrr)rrRr r rr%rrr+rrrrrrrT.s  z!InitConfigTests.test_init_setpathc CsT|}|dd}|dddddddd}dtjj|i}|jd|t|d d dS) NrrrZconf_program_nameZconf_executable)rrrrrrrr$rStest_init_setpath_configTrU)rr r rr%rrrVrrrrWAs  z(InitConfigTests.test_init_setpath_configc Cs|}|dur|dd}|dur0|dd}tr@|ddStj}tj|tjd|j|j dtj|tjd|jd|j tj|tjd|jd|j dgSdS)NrrrrNz.zip. lib-dynload) rr"r# version_infor r r%rmajorminor)r+rrrverrrrrVs$      z#InitConfigTests.module_search_pathsccsBt"}tj|}trtj}d|j|j }d|j}t tj rZ|d7}|d7}|d7}|d7}tj tj |j|}tj tj |j|}tj |tj|}tj |tj|}t||t||tj |tj|j}t|j|t|j|||_|VWdn1s40YdS)NrNr z.dll)tempfileTemporaryDirectoryr r realpathr"r#rZr[r\rr$r%r!r&r rPcopyfilecopystat)r+tmpdirr]ZdllZdll3Zdll_copyZ dll3_copyZ exec_copyrrrtmpdir_with_pythonis,      z"InitConfigTests.tmpdir_with_pythonc Cs|}|dd}tjj|}|D]8}tj|s8q&tjtj|dr&tj|}qpq&|d||}}t j }|j ||d} || |||||d}| |||d} |j d|t| d dS) Nrros.pyzUnable to find home in )rr)rrrrrrr)ZTESTHOMErtest_init_setpythonhome)rr)rr r rr%isdirr'r!rr#rZrrRrr) r+rr paths_strr rrrr]Zexpected_pathsrrrrrfs4     z'InitConfigTests.test_init_setpythonhomecCs6|}|dd}tjj|}||d<d|i}|S)Nrrrr)rr r rr%)r+rZ all_configsrrhrrrrcopy_paths_by_envs  z!InitConfigTests.copy_paths_by_envz#Windows does not use pybuilddir.txtc Cs|}d}tj||}t|tj|d}t|ddd}||Wdn1sb0Y|}||d<|j}|||d}| |} |j d|t | d |d Wdn1s0YdS) Nlibdirzpybuilddir.txtwr/encoding)rr$rrTrrrr5) rdr r r%mkdiropenwriterr&rirr) r+rcZsubdirrjfilenamefprr$rrrrrtest_init_pybuilddirs&  ( z$InitConfigTests.test_init_pybuilddirc Cs|}t}tj}tsRtj|tj d|j d|j d}t |n0tj|d}t |t tjtj|dtj|d}t|ddd ,}td ||d td |d Wdn1s0Y|}ts||d <nZt|D]H\}} |dkr&tj|tj| ||<qtj|tj| ||<q||d <|j} |} | | | | |d} trz|| d<|| d<|| } |jd| t| d|d}tr||ddtj|tj|jddWdn1s0YWdn1s0YdS)NrNrXrYlibrez pyvenv.cfgrkr/rlz home = %sfilez$include-system-site-packages = falsernr)rrrr$rrrrTroZwindowsZ python3_dll)rdr^r_r#rZr"r r r%rr[r\makedirsrPrar rqrBrrbr r&rirrrCr)r+rcZ pyvenv_homer]Z lib_dynloadrsrtrindexr r$rrractualrrrtest_init_pyvenv_cfgsf   *    z$InitConfigTests.test_init_pyvenv_cfgc stdtd}fdd}|d}|d}|d}|d}|d }|d }|d } ||tjj| d ||| d ||| d||| d||| d||| ddS)Nctypes_testinternalcapicstj|}d|_j|_|S)Nr)getattrZ pythonapiargtypesZ c_wchar_pZrestype)rfuncr}rrget_funcs z8InitConfigTests.test_global_pathconfig..get_func Py_GetPath Py_GetPrefixPy_GetExecPrefixPy_GetProgramNamePy_GetProgramFullPathPy_GetPythonHomerrrrrr$r)r import_moduleZ get_configsrCrr r r) r+r~rrrrrrrrrrrtest_global_pathconfigs$    z&InitConfigTests.test_global_pathconfigcCs<gd}ttd}ddd|gdd}|jd||tddS)N) zignore:::PyConfig_Insert0rz ignore:::env1z ignore:::env2zignore:::cmdline1zignore:::cmdline2r zignore:::PySys_AddWarnOption1zignore:::PySys_AddWarnOption2zignore:::PyConfig_BeforeReadzignore:::PyConfig_AfterReadr%r)rz-Wignore:::cmdline1z-Wignore:::cmdline2)rrrrrtest_init_warnoptionsr)rr(rr)r+rr rrrrr4s  z%InitConfigTests.test_init_warnoptionscCs|ddS)Ntest_get_argc_argvrIr0rrrrOsz"InitConfigTests.test_get_argc_argv)N)NNNN)NN)QrYrZr[r}r"robjectrrrPYMEM_ALLOCATOR_NOT_SETrrrrrrrrr#rrrrrrrr9r classmethodrrrrrrrrrrrrr rr#r$r'r)r*r-r0r3r6r7r8r9r:r;r<r?rArDrFrLrMrRrTrWr contextlibcontextmanagerrdrfririZskipIfrur|rrrrrrrr8sh   D      @ 3?          !!  =&rc@sLeZdZddZddZddZddZd d Zd d Zd dZ ddZ dS) AuditingTestscCs|ddS)Ntest_open_code_hookrr0rrrrUsz!AuditingTests.test_open_code_hookcCs|ddS)N test_auditrr0rrrrXszAuditingTests.test_auditcCs|ddS)Ntest_audit_subinterpreterrr0rrrr[sz'AuditingTests.test_audit_subinterpretercCs|jdtjdddS)Ntest_audit_run_commandrr2r3rIr SHORT_TIMEOUTr0rrrr^sz$AuditingTests.test_audit_run_commandcCs|jdtjdddS)Ntest_audit_run_filerrrr0rrrrcsz!AuditingTests.test_audit_run_filec Cstj|jtjd}t|ddd(}td|dtd|dWdn1sR0Yz4itd|i}|j d tj d |d Wt |n t |0dS) N.pyrkrurlz import sysrwz&sys.__interactivehook__ = lambda: None PYTHONSTARTUPtest_audit_run_interactivehook r2r3r r r r%r)rZTESTFNrqrBrrIrunlinkr+Zstartupfrrrrrhs *z,AuditingTests.test_audit_run_interactivehookc Cstj|jtjd}t|ddd}td|dWdn1sF0Yz4itd|i}|j dtj d |d Wt |n t |0dS) Nrrkrurlrrwrtest_audit_run_startuprrrrrrrrus*z$AuditingTests.test_audit_run_startupcCs|jdtjdddS)Ntest_audit_run_stdinrrrr0rrrrsz"AuditingTests.test_audit_run_stdinN) rYrZr[rrrrrrrrrrrrrTs  r__main__)"testrri collectionsrrrr rOrPr;r#r^rrr"platformrOrr(rrrrrqrrrZTestCaser\rrrYrWrrrrsJ     n$2