asda?‰PNG  IHDR ? f ??C1 sRGB ??é gAMA ±? üa pHYs ? ??o¨d GIDATx^íüL”÷e÷Y?a?("Bh?_ò???¢§?q5k?*:t0A-o??¥]VkJ¢M??f?±8\k2íll£1]q?ù???T a bYh @sddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl ZddlZddlZddlmZmZzddlmZdZWneydZYn0ddlmZddlmZddlmZdd lmZd d Zd d ZddZGdddZ Gddde ej!eddZ"Gddde ej!eddZ#Gdddej!Z$GdddZ%Gddde%ej!eddZ&Gddde%ej!eddZ'Gdd d Z(Gd!d"d"e(ej!eddZ)Gd#d$d$e(ej!eddZ*e+d%kre,dS)&N)mock skipUnless)ProcessPoolExecutorTF)support) script_helper)without_source_date_epoch)SourceDateEpochTestMetacCs|sd}tjj||dS)N optimization) importlibutilcache_from_source)scriptoptr0/usr/local/lib/python3.9/test/test_compileall.pyget_pycsrcsfdddDS)Ncsg|]}t|qSr)r).0rrrr &zget_pycs..rrrrrrget_pycs%srcCs t|j}t|j}||kS)z8Returns True if two files have the same inode (hardlink))osstatst_ino)Z filename1 filename2Zinode1Zinode2rrr is_hardlink)s  r c@sheZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zed#d$d%Zd&d'Zed#d(d)Zed#ed*d+d,Zejd#d-d.ed*d/d0Zd1d2Zd3d4d5d6Zd7d8Zd9d:Zd;d<Zd=d>Z d?d@Z!dAdBZ"dCdDZ#dEdFZ$dGdHZ%e&j'dIdJZ(d-S)KCompileallTestsBasecCst|_tj|jd|_tj |j|_ t |jd}| dWdn1sX0Ytj|jd|_ tj |j |_t|j|j tj|jd|_t|jtj|jd|_t|j|jdS)N_test.pywzx = 123 z _test2.pyZ_subdirz _test3.py)tempfilemkdtemp directoryrpathjoin source_pathr r rbc_pathopenwrite source_path2bc_path2shutilcopyfileZ subdirectorymkdir source_path3selffilerrrsetUp2s ( zCompileallTestsBase.setUpcCst|jdSNr/rmtreer&r4rrrtearDown@szCompileallTestsBase.tearDowncCsLtj|jd|_t|jd}|dWdn1s>0YdS)Nz _test_bad.pyr#zx ( )rr'r(r&bad_source_pathr+r,r3rrradd_bad_source_fileCsz'CompileallTestsBase.add_bad_source_filecCsht|jd}|d}Wdn1s,0Ytt|jj}t dt j j d|d@}||fS)Nrb <4sLLr) r+r*readintrrr)st_mtimestructpackr r MAGIC_NUMBER)r4r5datamtimeZcomparerrrtimestamp_metadataHs(z&CompileallTestsBase.timestamp_metadatac Csxzt|jdWn ttfy2|dYn0tt "| t |jWdn1sj0YdS)N)rArAz0filesystem doesn't support timestamps near 2**32 rutimer) OverflowErrorOSErrorZskipTest contextlibredirect_stdoutioStringIO assertTrue compileall compile_filer:rrr test_year_2038_mtime_compilationPs z4CompileallTestsBase.test_year_2038_mtime_compilationc Csxzt|jdWn ttfy2|dYn0tt "| t |jWdn1sj0YdS)N) rWz+filesystem doesn't support large timestampsrKr:rrrtest_larger_than_32_bit_timesZs z1CompileallTestsBase.test_larger_than_32_bit_timescCstjdrtdt|j|j| t |j d$}| t |d}Wdn1sf0Yt |j d$}||||Wdn1s0Y|j| tj|jddd|j| dS) zOCheck that compileall recreates bytecode when the new metadata is used.SOURCE_DATE_EPOCHzSOURCE_DATE_EPOCH is setr>NwbFTforcequiet)renvirongetunittestZSkipTest py_compilecompiler) assertEqualrJr+r*rBlenr,assertNotEqualrT compile_dirr&rS)r4metadatar5bcrrrrecreation_checkds   2 (z$CompileallTestsBase.recreation_checkcCs|tdtjjdddS)Nr@rr)rirErFr r rGr:rrr test_mtimetszCompileallTestsBase.test_mtimecCs|ddS)Ns)rir:rrrtest_magic_numberysz%CompileallTestsBase.test_magic_numbercCs|j|jfD] }zt|Wq Yq 0q |tj|jddd|tj |joftj |j t|j|tj |j ddd|tj |jotj |jt|jt|j| | tj|jddd| tj |j ddddS)NFTr[r)r*r.runlinkrSrTrUr)r'isfilerfr&r= assertFalser<)r4fnrrrtest_compile_files}s6       z&CompileallTestsBase.test_compile_filescCs||tj|jt(}|t t |j Wdn1sJ0Y| |d|tj|jdS)Nz&Compiling ([^WindowsPath|PosixPath].*))rnrr'rmr*rcaptured_stdoutrSrTrUpathlibPathr) assertRegexgetvalue)r4stdoutrrrtest_compile_file_pathlikes  6z.CompileallTestsBase.test_compile_file_pathlikecCsP|tj|j|tjt |j t ddd|tj|jdS)NZ ddir_pathr)ddirr]) rnrr'rmr*rSrTrUrrrsr)r:rrrtest_compile_file_pathlike_ddirs z3CompileallTestsBase.test_compile_file_pathlike_ddircCstjjj|jgd"|tjddWdn1s<0Ytjjj|jgd.|| tjddddWdn1s0YdS)Nr'rr]FT) skip_curdirr\r]) testtest_importlibr Z import_stater&rSrT compile_pathr=rnr:rrrtest_compile_paths0 z%CompileallTestsBase.test_compile_pathcCs|tj|jd}tj|d}t|t|dWdn1sH0Yt||tj tj|ddS)NrHr5r# __pycache__) rr'r(r&r1r+rTrUrnexists)r4Zdata_dirZ data_filerrrtest_no_pycache_in_non_packages   z2CompileallTestsBase.test_no_pycache_in_non_packagecCsL|tt"|t|jWdn1s>0YdSr7) r=rOrPrQrRrnrTrUr<r:rrr#test_compile_file_encoding_fallbacksz7CompileallTestsBase.test_compile_file_encoding_fallbackcCsdnd\}}tj|jd|dtjj|j|d}|tj |tjj|j |d}|tj |tjj|j |d}|tj |dS)NT)rr)rr r]optimizer ) rTrfr&r r rr)rSrr'rmr-r2)r4rrcachedZcached2Zcached3rrr test_optimizes    z!CompileallTestsBase.test_optimizecCs|tj|jt"}tt |j Wdn1sD0Y| d}||d|tj|jdS)Nrz$Listing ([^WindowsPath|PosixPath].*))rnrr'rmr*rrqrTrfrrrsr&ru splitlinesrtrS)r4rvlinerrrtest_compile_dir_pathlikes  0 z-CompileallTestsBase.test_compile_dir_pathlikez&concurrent.futures.ProcessPoolExecutorcCs"tj|jddd||jdSNTr]workersrTrfr&rScalledr4 pool_mockrrrtest_compile_pool_calledsz,CompileallTestsBase.test_compile_pool_calledcCs@|td tj|jddWdn1s20YdS)Nz%workers must be greater or equal to 0)r)ZassertRaisesRegex ValueErrorrTrfr&r:rrr!test_compile_workers_non_positivesz5CompileallTestsBase.test_compile_workers_non_positivecCs,tj|jddd||jddddS)NTrrr max_workers)rTrfr&rc call_argsrrrrtest_compile_workers_cpu_countsz2CompileallTestsBase.test_compile_workers_cpu_countzcompileall.compile_filecCs,tj|jdd||j||jdS)NTr{)rTrfr&rnrrS)r4compile_file_mockrrrrtest_compile_one_workers z+CompileallTestsBase.test_compile_one_workerNnewcCs"tj|jddd||jdSrr)r4rrrr$test_compile_missing_multiprocessingsz8CompileallTestsBase.test_compile_missing_multiprocessingcCsd}|j}td|dD]>}tj|d|}tj|d}t|t|j|qt j |}t j |jd|dd|tj|t j |jd|d|tj|dS)NrZdir_z script.pyT)r] maxlevels)r&rangerr'r(r1r/r0r)r r rrTrfrnrmrS)r4depthr'isourceZ pyc_filenamerrrtest_compile_dir_maxlevelss  z.CompileallTestsBase.test_compile_dir_maxlevelsT)parallelcCsddg}|j}g}|D]>}tj||}t|t|dd|t|ddqtj |jd||rjdnd d | ||D]}| | |j|t j |}|t|jtjd } t|\} } } tj|| } tjj |} || j| |d | d t| qd S) z@Recursive compile_dir ddir must contain package paths; bpo39769.r}foo__init__r modzdef fn(): 1/0 fn() Trr)r]rxrN")r&rr'r(r1r make_scriptappendrTrfrS startswithr r rrdsepassert_python_failurer}r~Zget_code_from_pycrc co_filenameassertInfsdecode)r4rxrfullpathr'ZmodsZsubdirrZmodcodemodpath_err expected_inZ mod_code_objrrr_test_ddir_onlys0     z#CompileallTestsBase._test_ddir_onlycCs|jdddS)=Recursive compile_dir ddir= contains package paths; bpo39769. Frxrrr:rrrtest_ddir_only_one_workersz-CompileallTestsBase.test_ddir_only_one_workercCs|jdddS)rrTrrr:rrrtest_ddir_multiple_workers#sz.CompileallTestsBase.test_ddir_multiple_workerscCs|jdddS)?Recursive compile_dir ddir='' contains package paths; bpo39769.r Frrr:rrrtest_ddir_empty_only_one_worker'sz3CompileallTestsBase.test_ddir_empty_only_one_workercCs|jdddS)rr Trrr:rrr test_ddir_empty_multiple_workers+sz4CompileallTestsBase.test_ddir_empty_multiple_workersc Csgd}tjj|jg|R}t|t|dd}tj |}tjj|jg|ddR}t j |d|dt |\}}}tjj|dd} | | t|td||t|tddS)Nr}buildrealr'r}1 / 0rT)r]stripdirencodingrr'r(r&makedirsrrr r rrTrfrrstrsysgetdefaultencoding assertNotIn) r4rr'rrhrrcoutrrrrrtest_strip_only/s"  z#CompileallTestsBase.test_strip_onlyc Csgd}tjj|jg|R}t|t|dd}tj |}d}t j |d|dt |\}}}tjj||jg|R} | | t|tddS)Nrr}r/fooT)r] prependdirr)rr'r(r&rrrr r rrTrfrrrrr) r4rr'rrhrrrrrrrrtest_prepend_onlyBs  z%CompileallTestsBase.test_prepend_onlyc Csgd}tjj|jg|R}t|t|dd}tj |}tjj|jg|ddR}d}t j |d||dt |\}}} tjj|g|ddR} | | t| td||t| tddS) Nrr}rrrT)r]rrrr r4rr'rrhrrrrrrrrrtest_strip_and_prependQs(  z*CompileallTestsBase.test_strip_and_prependcCsxgd}tjj|jg|R}t|t|dd|t$t j |dddddWdn1sj0YdS)N)r}rrr'rxr}rTz/barr)r]rxrr) rr'r(r&rrr assertRaisesrrTrf)r4rr'rrrtest_strip_prepend_and_ddirfs   z/CompileallTestsBase.test_strip_prepend_and_ddirc Cst|jdd}g}dD]}|tjj||dqddgddgddggdg}|D]Z}tj|d |d |D]@}| t j ||zt ||WqltyYql0qlqTdS) Ntest_optimizationa = 0r rrrr rrrrTr)rrr&rr r rrTrUrSrr'rmrl Exception)r4rrh opt_leveltest_combinationsopt_combinationrrr!test_multiple_optimization_levelsos(   z5CompileallTestsBase.test_multiple_optimization_levelsc Cstj|jddd}tj|jddd}tj|jddd}t|t|t|t|dd}t|dd}tj|d }tj|d }t||t||tj |}tj |} t j |d |d | tj||tj| dS) Nr}dirallowedsymlinks prohibited test_allowedrtest_prohibitedtest_allowed.pytest_prohibited.pyT)r] limit_sl_dest)rr'r(r&rrrsymlinkr r rrTrfrSrmrn r4Z allowed_pathZ symlinks_pathZprohibited_pathZallowed_scriptZprohibited_scriptZallowed_symlinkZprohibited_symlinkZ allowed_bcZ prohibited_bcrrrtest_ignore_symlink_destinations"       z3CompileallTestsBase.test_ignore_symlink_destination))__name__ __module__ __qualname__r6r;r=rJrVrXrirjrkrprwryrrrrrrpatchrrrrrrrrrrrrrrrrrskip_unless_symlinkrrrrrr!0sR          r!c@s eZdZdS)CompileallTestsWithSourceEpochNrrrrrrrrsr) metaclassZsource_date_epochc@s eZdZdS)!CompileallTestsWithoutSourceEpochNrrrrrrsrc@s(eZdZdZddZddZddZdS) EncodingTestzTIssue 6716: compileall should escape source code when printing errors to stdout.cCsdt|_tj|jd|_t|jddd$}|d|dWdn1sV0YdS)Nr"r#utf-8rz# -*- coding: utf-8 -*- u print u"€" ) r$r%r&rr'r(r)r+r,r3rrrr6s   zEncodingTest.setUpcCst|jdSr7r8r:rrrr;szEncodingTest.tearDowncCs>z0tj}tjtddt_t|jW|t_n|t_0dS)Nasciir)rrvrQ TextIOWrapperBytesIOrTrfr&)r4Z orig_stdoutrrr test_errors zEncodingTest.test_errorN)rrr__doc__r6r;rrrrrrsrc@seZdZdZddZejddZddZdd Z d d Z d d Z ddZ ddZ eddZddZddgfdddgfdddgffD]&\ZZZeefddZeed e<qd!d"Zd#d$Zed%d&Zd'd(Zd)d*Zejd+d,Zd-d.Zd/d0Zd1d2Z d3d4Z!d5d6Z"d7d8Z#d9d:Z$d;d<Z%d=d>Z&d?d@Z'dAdBZ(dCdDZ)dEdFZ*e+e,dGdHdIZ-e./dJdKdLZ0dMdNZ1dOdPZ2ejdQdRZ3dSdTZ4dUdVZ5dWS)XCommandLineTestsBasezTest compileall's CLI.cCsrt|_|tj|jtj|jd|_ t |j tj|j d|_ t |j dd|_t |j dd|_dS)Nrrrr Zbar)r$r%r&Z addCleanupr/r9rr'r(pkgdirr1pkgdir_cachedirrrinitfnbarfnr:rrrr6s  zCommandLineTestsBase.setUpccsBtj}tj|jd}z|t_|j|dVW|t_n|t_0dS)z&Adjust and restore sys.pycache_prefix.Z __testcache__) PYTHONPATHZPYTHONPYCACHEPREFIXN)rpycache_prefixrr'r(r&)r4Z old_prefixZ new_prefixrrrtemporary_pycache_prefixs z-CommandLineTestsBase.temporary_pycache_prefixcCsgtddd|S)Nz-S-mrT)rZ!optim_args_from_interpreter_flags)r4argsrrr _get_run_argss z"CommandLineTestsBase._get_run_argscOs4tj||i|ddi\}}}|d||S)NPYTHONIOENCODINGrr)rassert_python_okrrcr4rZenv_varsrrrrrr assertRunOKs z CommandLineTestsBase.assertRunOKcOs.tj||i|ddi\}}}|||fS)Nr r)rrrr rrrassertRunNotOKsz#CommandLineTestsBase.assertRunNotOKcCs"tj|}|tj|dSr7)r r rrSrr'rr4ror'rrrassertCompileds z#CommandLineTestsBase.assertCompiledcCs"tj|}|tj|dSr7)r r rrnrr'rrrrrassertNotCompileds z&CommandLineTestsBase.assertNotCompiledcCsnt|jdd}|B}|jfi|||||j||jWdn1s`0YdS)Nbazr ) rrr&rr rrrr)r4bazfnenvrrrtest_no_args_compiles_paths    z/CommandLineTestsBase.test_no_args_compiles_pathcCst|jdd}|,}|jfi|tj|}Wdn1sJ0Yt |t dfdt |j }|jfi|t |j }| |||jdi|t |j }|||dS)Nrr <r-f)r)rrr&rr r r rrrLtimerrDrcre)r4rrpycpathrImtime2rrr test_no_args_respects_force_flags *    z5CommandLineTestsBase.test_no_args_respects_force_flagcCstt|jdd| }|jfi|}Wdn1s>0Y|d||jdi|}|d|dS)Nrr sListing -q)r)rrr&rr rr)r4rnoisyr]rrr test_no_args_respects_quiet_flags  . z5CommandLineTestsBase.test_no_args_respects_quiet_flagZnormalpycrz opt-1.pyc-OZdoubleoptimizez opt-2.pycz-OOcs~tj|ddd|jg|tj|jtfdddD}| tt |j|| fddt |jDdS) NrrTrc3s|]}|tjjVqdSr7)formatrimplementation cache_tag)rbaseextrr %sz)CommandLineTestsBase.f..)z__init__.{}.{}z bar.{}.{}csg|]}|r|qSr)endswith)rror$rrr)s z*CommandLineTestsBase.f..) rr rrSrr'rrsortedrclistdirrn)r4r%switchexpectedrr$rf s  zCommandLineTestsBase.fZtest_pep3147_paths_cCsL|dd|j|tj|jtgd}|tt |j|dS)Nz-br) __init__.pyz __init__.pyczbar.pyzbar.pyc) r rrnrr'rrr(rcr))r4r+rrrtest_legacy_paths-s z&CommandLineTestsBase.test_legacy_pathscCs||d|j|tj|jtj|jd}|tj||d|j|tj|j|tj|dS)Nrr) r rrSrr'rrr(rn)r4Z cachecachedirrrrtest_multiple_runs7sz'CommandLineTestsBase.test_multiple_runscCs|d|jtj|j}t|tdfdt |j }|d|jt |j }| |||dd|jt |j }| ||dS)Nrrrr) r rr r rrrrLrrrDrcre)r4rrIrrrr test_forceDs    zCommandLineTestsBase.test_forcecCstj|jd}t|t|dd}t|dd}|dd|j||| tj tj|d|d|j| || |dS)Nspamrr hamrz-lr) rr'r(rr1rrr rrnrr)r4 subpackage subinitfnhamfnrrrtest_recursion_controlTs   z+CommandLineTestsBase.test_recursion_controlc CsVtj|jd}tj|d}tj|d}|||fD]}t|q6tj|d}t|dd}t|dd}t|dd}|dd|j||| tj tj|d |dd |j| || ||||dd |j| || || ||||dd |j| || || || |dS) Nr1r2Zeggsr-r Zeggrz-r 0rz-r 1z-r 2z-r 5) rr'r(rrmake_pkgrr rrnrr) r4r3Z subpackage2Z subpackage3pkgr4r5ZspamfnZeggfnrrrtest_recursion_limit`s8            z)CommandLineTestsBase.test_recursion_limitc Csttj|jd}t|tdtj|dtdtj|d|d|j|tj|jdddddS)Nr1.ZevilZevil2rr-) rr'r(rrr7rr r)r4r8rrrtest_symlink_loops   z&CommandLineTestsBase.test_symlink_loopcCs6||j}|d|j}|d||d|dS)Nrr)r rrerc)r4rr]rrr test_quiets  zCommandLineTestsBase.test_quietcCsTt|jdd|d|j\}}}|d|j\}}}|d||d|dS)N crunchyfrog bad(syntaxrz-qqr)rrrr rerc)r4rr]Zsilentrrr test_silents  z CommandLineTestsBase.test_silentcCs.|ddd|j||j||jdS)Nrz-xz ba[^\\/]*$)r rrrrrr:rrr test_regexps z CommandLineTestsBase.test_regexpcCsvtj|jd}t|t|dd}t|dd}|d|j|| |j | |j | || |dS)NZfoo2rr bar2r) rr'r(r&r1rrr rrrr)r4Zpkgdir2Zinit2fnbar2fnrrrtest_multiple_dirss    z'CommandLineTestsBase.test_multiple_dirscCs8t|jdd|ddd|j\}}}||ddS)Nr=r>r-ddinsdaleFile "dinsdale)rrrr rtr4rrrrrrtest_d_compile_errorsz)CommandLineTestsBase.test_d_compile_errorcCst|jdd}|ddd|jt|jdd}tj|}t|tj |jdt |tj |d d \}}}| |d dS) Nrzraise ExceptionrrDrEbingz import bazzbaz.pycF) __isolatedrF)rrrr r r rrrenamer'r(removerrt)r4rrorrrrrrrtest_d_runtime_errors  z)CommandLineTestsBase.test_d_runtime_errorcCsZ|dtj|jd|j\}}}||d||d|tj t j |j dS)N-i nosuchfilesrror.*nosuchfiles Traceback)r rr'r(r&rrtZassertNotRegexrnrr r rrrGrrrtest_include_bad_files   z*CommandLineTestsBase.test_include_bad_filecCst|jdd}t|jdd}t|jdd}t|jdd}ttj|jddH}|tj|jdtj |tj|jd tj Wdn1s0Y| d tj|jd|| || || || |dS) Nf1r f2f3f4l1r#f1.pyf2.pyrN) rrrr+rr'r(r&r,linesepr rrr4rQrRrSrTrUrrrtest_include_file_with_args:   z/CommandLineTestsBase.test_include_file_with_argcCst|jdd}t|jdd}t|jdd}t|jdd}ttj|jdd,}|tj|jdtj Wdn1s0Y| d tj|jd| || || || |dS) NrQr rRrSrTrUr#rWrN) rrrr+rr'r(r&r,rXr rrrYrrrtest_include_file_no_args:   z-CommandLineTestsBase.test_include_file_no_argcCst|jdd}t|jdd}t|jdd}t|jdd}tj|dddg}|j|tj d t || || || || |dS) NrQr rRrSrTrrN-r) rrrZ spawn_pythonrstdinr,rrXencodeZ kill_pythonrr)r4rQrRrSrTprrrtest_include_on_stdins    z*CommandLineTestsBase.test_include_on_stdincCs\t|jdd}|d|j||j\}}}||d||||j||jdS)NrIz syntax(errorrOsrror) rrrr rrrtrr)r4Zbingfnrrrrrr!test_compiles_as_much_as_possibles     z6CommandLineTestsBase.test_compiles_as_much_as_possiblecCs|d}||ddS)NZ badfilenamesCan't list 'badfilename')r rt)r4rrrr!test_invalid_arg_produces_messages z6CommandLineTestsBase.test_invalid_arg_produces_messagecCst|jddtjtj|jd}| d|jt |d}| }Wdn1s^0Y| t |dddd | d |jt |d}| }Wdn1s0Y| t |dddd dS) NrQr rVz --invalidation-mode=checked-hashr>littlerz"--invalidation-mode=unchecked-hashr)rrrr r rrr'r(r r+rBrcrC from_bytes)r4rfprHrrrtest_pyc_invalidation_modes & &z/CommandLineTestsBase.test_pyc_invalidation_modezrequires multiprocessingcCst|jdd}g}tdD]F}tj|jd|}t|t|dd}| t|ddq| |jdd| ||D]}| |qdS)NrAr rzfoo{}rz-j0) rrr&rrr'r(r r1rr r)r4rBfilessuffixrror5rrr test_workerss   z!CommandLineTestsBase.test_workerszcompileall.compile_dircCsftjdtj|jdgd:t||j| |j dddWdn1sX0YdS)Nzsys.argvz-j0rrrr) rrr executabler&rTmainrSrrcr)r4rfrrrtest_workers_available_coress   z1CommandLineTestsBase.test_workers_available_coresc Csgd}tjj|jg|R}t|t|dd}tj |}tjj|jg|ddR}d}| d|d||t |\}}} tjj|g|ddR} | | t | td||t | tddS) Nrr}rrrz-sz-pr)rr'r(r&rrrr r rr rrrrrrrrrrrs$  z+CommandLineTestsBase.test_strip_and_prependc Cstj|jd}t|t|dd}g}dD]}|tj j ||dq0ddgddgddggd g}|D]j}|j |gd d |DR|D]D}| tj |t|zt||WqtyYq0qqldS) NZ optimizationsrrrr ri12)rirprqcss|]}dt|VqdS)z-oN)r)rnrrrr&@rzICommandLineTestsBase.test_multiple_optimization_levels..)rr'r(r&rrrrr r rr rSrmrCrlr)r4r'rrhrrrrrrr1s0    z6CommandLineTestsBase.test_multiple_optimization_levelsc Cstj|jddd}tj|jddd}tj|jddd}t|t|t|t|dd}t|dd}tj|d }tj|d }t||t||tj |}tj |} | |d || tj ||tj | dS) Nr}rrrrrrrrrz-e)rr'r(r&rrrrr r rr rSrmrnrrrrrHs"       z4CommandLineTestsBase.test_ignore_symlink_destinationcCs||jdddS)N-o 1--hardlink-dupes)r r&r:rrrtest_hardlink_bad_argsasz+CommandLineTestsBase.test_hardlink_bad_argsc CsdD]}t}|j|dt|dd}t|}gd}|rL|d|j|g|R|t |d|d||t |d|d ||t |d|d |Wdn1s0YWdq1s0YqdS) N)TFdeduprr)rz-o 0rsz-o 2rtrrr) r$TemporaryDirectorysubTestrrrrr rcr )r4rwr'rpycsrrrr test_hardlinkfs  z"CommandLineTestsBase.test_hardlinkN)6rrrrr6rOcontextmanagerrrr r rrrrrrnamer%r*r,localsr.r/r0r6r9rrr;r<r?r@rCrHrMrPrZr[r`rarbrhr_have_multiprocessingrlrrrorrrrur{rrrrrsd            "          rc@s eZdZdS)CommandLineTestsWithSourceEpochNrrrrrr|src@s eZdZdS)CommandLineTestsNoSourceEpochNrrrrrrsrc@seZdZddZejddZd#ddZdd d d d d ZddZ d$ddZ ddZ ddZ d%ddZ ddZddZddZddZd d!Zd"S)&HardlinkDedupTestsBasecCs d|_dSr7rzr:rrrr6szHardlinkDedupTestsBase.setUpccs>t"}||_|Vd|_Wdn1s00YdSr7)r$rxr')r4r'rrrtemporary_directorys z*HardlinkDedupTestsBase.temporary_directoryrcCst|j||Sr7)rrr')r4coder}rrrrsz"HardlinkDedupTestsBase.make_scriptTrF)rwrr\cCstj|jd|||ddS)NT)r]rhardlink_dupesr\)rTrfr')r4rwrr\rrrrfs z"HardlinkDedupTestsBase.compile_dirc Cs||d|t$tj|jddddWdn1sH0Y|t(tj|jdddgddWdn1s0YWdn1s0YdS)NpassTr)r]rr)rrrrrTrfr'r:rrr test_bad_argss    $ z$HardlinkDedupTestsBase.test_bad_argscCs4g}|r|d|d|r*|dd|S)Nz'module docstring'zx = 1z assert x == 1 )rr()r4 docstring assertionlinesrrr create_codes   z"HardlinkDedupTestsBase.create_codeccs2dD](}dD]}|j||d}|||fVq qdS)N)FTrr)r)r4rrrrrr iter_codessz!HardlinkDedupTestsBase.iter_codesc Cs|D]\}}}|j||d|v||}t|}|jdd|t|d|d|t|d|d|t|d|dWdn1s0YWdq1s0YqdS)NrFrvrrr)rryrrrrfrnr )r4rrrrrzrrr test_disableds   z$HardlinkDedupTestsBase.test_disabledcCsft|}|t|d|d| |t|d|d| oB| |t|d|d| dS)Nrrr)rrcr )r4rrrrzrrrcheck_hardlinkss z&HardlinkDedupTestsBase.check_hardlinksc Cs|D]\}}}|j||dX|0||}|||||Wdn1s`0YWdq1s~0YqdS)Nr)rryrrrfr)r4rrrrrrrr{s   z$HardlinkDedupTestsBase.test_hardlinkc CsdD]}|j|d~|V||}|j|dt||d}t||d}|t||Wdn1sz0YWdq1s0YqdS)N))rr)rr)rr)optsrrr)ryrrrrfrrSr )r4rrpyc1pyc2rrrtest_only_two_levelss  z+HardlinkDedupTestsBase.test_only_two_levelscCsn|R||}|jgddt|d}t|d}|t||Wdn1s`0YdS)N)rrrrrrr)rrrrfrrSr )r4rrrrrrtest_duplicated_levelss    z-HardlinkDedupTestsBase.test_duplicated_levelscCs||d}|||t|}t|dj}|d}|jddgdd||t|dj| t |d|d| |t|dj| t j|d|dddWdn1s0YdS) Nrrprint(0)rT)rr\rshallow)rrrfrrrrrrcrSr rernfilecmpcmpr4rrzinoderrrtest_recompilations    z)HardlinkDedupTestsBase.test_recompilationcCs||j|dd}|||t|}t|dj}|jddd}t j dddd|j d | |t|dj| |t|d j| t|d |d | tj|d |d d d Wdn1s0YdS)Nmodule)r}rrrz-cz import moduleF)rJrrrTr)rrrrfrrrrrrr r'rcrnr rrrrrr test_import s   z"HardlinkDedupTestsBase.test_importN)r)FF)FF)rrrr6rOr|rrrfrrrrrr{rrrrrrrrrs       rc@s eZdZdS)!HardlinkDedupTestsWithSourceEpochNrrrrrr(src@s eZdZdS)HardlinkDedupTestsNoSourceEpochNrrrrrr/sr__main__)-rTrOrimportlib.utilr rQrrrrar/rErr$Ztest.test_importlib.utilr}rr`rrconcurrent.futuresrr ImportErrorrZ test.supportrZtest.test_py_compilerrrrr r!ZTestCaserrrrrrrrrrrnrrrrs       n  >