a :êdgÏ ã@sŒdZddlZddlZddlZddlmZmZddlmZm Z ddl m Z ddl m Z Gdd„de je jejƒZd d „Zed krˆeeƒƒdS) z#Tests for distutils.command.config.éN)Ú run_unittestÚmissing_compiler_executable)Ú dump_fileÚconfig)Úsupport)ÚlogcsbeZdZdd„Z‡fdd„Z‡fdd„Zdd„Ze e j d kd ¡d d „ƒZ d d„Z dd„Z ‡ZS)ÚConfigTestCasecGs| ¡D]}|j |¡qdS©N)Ú splitlinesÚ_logsÚappend)ÚselfÚmsgÚargsÚline©rú;/usr/local/lib/python3.9/distutils/tests/test_config_cmd.pyÚ_infos zConfigTestCase._infocs(tt|ƒ ¡g|_tj|_|jt_dSr )ÚsuperrÚsetUpr rÚinfoÚold_logr©r ©Ú __class__rrrszConfigTestCase.setUpcs|jt_tt|ƒ ¡dSr )rrrrrÚtearDownrrrrrszConfigTestCase.tearDowncCsdtj t¡dd}t|ƒ}zt| ¡ƒ}W| ¡n | ¡0t|dƒ|  t|j ƒ|d¡dS)Nrz.pyzI am the headeré) ÚosÚpathÚsplitextÚ__file__ÚopenÚlenÚ readlinesÚcloserÚ assertEqualr )r Z this_fileÚfZnumlinesrrrÚtest_dump_files zConfigTestCase.test_dump_fileÚwin32zcan't test on WindowscCs¨tdgƒ}|dur | d|¡| ¡\}}t|ƒ}| ¡|j}tjdd…dkrpd|jd  ¡vrp| d¡|j dd d }|  |d¡|j d d d }|  |d ¡dS) NÚ preprocessorzThe %r command is not foundéZaixZxlcrzAxlc: The -E option overrides the -P, -o, and -qsyntaxonly optionsÚxxxz /* xxx */)ÚpatternÚbodyZ _configtestr) rZskipTestÚ create_distrZ_check_compilerÚcompilerÚsysÚplatformr)ÚlowerZ search_cppr%)r ÚcmdÚpkg_dirÚdistr/ÚmatchrrrÚtest_search_cpp(s  $  zConfigTestCase.test_search_cppcCsr| ¡\}}t|ƒ}dtj|_d|_dtj|_| ¡| |jddg¡| |jdg¡| |jddg¡dS)Nzone%stwoÚonez three%sfourÚtwoZthreeZfour) r.rrÚpathsepZ include_dirsZ librariesZ library_dirsZensure_finalizedr%)r r4r5r3rrrÚtest_finalize_options;s   z$ConfigTestCase.test_finalize_optionscCs | ¡}tj |d¡}tj |d¡}| |d¡| |d¡||fD]}| tj |¡¡qD| ¡\}}t|ƒ}|  ||¡||fD]}|  tj |¡¡q„dS)Nr8r9r+) ÚmkdtemprrÚjoinZ write_fileZ assertTrueÚexistsr.rZ_cleanZ assertFalse)r Ztmp_dirÚf1Úf2r&r4r5r3rrrÚ test_cleanIs      zConfigTestCase.test_clean)Ú__name__Ú __module__Ú __qualname__rrrr'ÚunittestZskipIfr0r1r7r;rAÚ __classcell__rrrrr s    rcCs t t¡Sr )rEZ makeSuiterrrrrÚ test_suite\srGÚ__main__)Ú__doc__rErr0Z test.supportrrZdistutils.command.configrrZdistutils.testsrZ distutilsrZLoggingSilencerZTempdirManagerZTestCaserrGrBrrrrÚs  þQ