bg+ddlZddlmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZmZmZmZmZd d lmZd d Zd ZGd deZGddeZdefdZde fdZdS)N)Path)mkdtemp)TestCase)catch_warnings)local)Mock) TempDirectoryReplacer ShouldRaisecompare OutputCapture)rmtree£utf-8c&eZdZdZdZdZdZdS)TestTempDirectoryct}|j}tj|dusJ|dd}|tj|dusJdS)NT somethingstuffF)r pathosexistswritecleanup)selfdps v/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/testfixtures/tests/test_tempdirectory.py test_cleanupzTestTempDirectory.test_cleanupsv OO Fw~~a  D(((( GGK * * w~~a  E))))))ct}t}tj|jdusJ|j}tj|jdusJ|j}tjtj|dusJtj|dusJdS)NTF)r rrr cleanup_all)rd1d2p1p2s rtest_cleanup_allz"TestTempDirectory.test_cleanup_alls __ __w~~bg&&$.... Ww~~bg&&$.... W!###w~~b!!U****w~~b!!U******r!ct5}|j}tj|dusJ|ddtj|dgksJt tj|d5}|dksJ dddn #1swxYwYdddn #1swxYwYtj|dusJdS)NTrrstuffF) r rrrrlistdiropenjoinread)rrrfs rtest_with_statementz%TestTempDirectory.test_with_statement,sf __ *v1'..##t++++ 77; ) ) )*Q--K=0000RW\\![1122 *affhh'))))) * * * * * * * * * * * * * * *  * * * * * * * * * * * * * * *w~~a  E))))))s6B CC4 CC CC CCCct5}|dd|dd|dd|ddt5}|dddn #1swxYwYdddn #1swxYwY|ddS)Ngar!foo1Foo2g.ozFoo2 foo1 g.o ga)r rr r+r )rroutputs rtest_listdir_sortz#TestTempDirectory.test_listdir_sort6s2 __  GGD#    GGFC GGFC GGE3    F                                 ,-----s6A'B.6B B.B B.B B..B25B2N)__name__ __module__ __qualname__r r(r0r7r!rrrsP*** + + +***.....r!rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#S)$TempDirectoryTestsct5}ttd5|dddddn #1swxYwYddddS#1swxYwYdS)N8Attempt to read or write outside the temporary Directory /some/folderr*)r r ValueErrorrrrs rtest_write_with_slash_at_startz1TempDirectoryTests.test_write_with_slash_at_startCs __ 1ZN 1 1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14A'A A'A A'A A''A+.A+ct5}ttd5|ddddn #1swxYwYddddS#1swxYwYdSNr?r@)r r rAmakedirrBs r test_makedir_with_slash_at_startz3TempDirectoryTests.test_makedir_with_slash_at_startJ __ *ZN * * .))) * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *4A&A A&A A&A A&&A*-A*ct5}ttd5|ddddn #1swxYwYddddS#1swxYwYdSrF)r r rAr.rBs rtest_read_with_slash_at_startz0TempDirectoryTests.test_read_with_slash_at_startQs __ 'ZN ' '~&&& ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'rJct5}ttd5|ddddn #1swxYwYddddS#1swxYwYdSrF)r r rAr+rBs r test_listdir_with_slash_at_startz3TempDirectoryTests.test_listdir_with_slash_at_startXrIrJct5}ttd5|dddddn #1swxYwYddddS#1swxYwYdS)Nr?r;r@r)r r rAr rBs r test_compare_with_slash_at_startz3TempDirectoryTests.test_compare_with_slash_at_start_s __ 3ZN 3 3 "> 222 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3s4A(A A(A A(A A((A,/A,ct5}|dd}t||dddddS#1swxYwYdS)Nfoosbar)r rr r.)rrrs r test_read_with_slash_at_start_okz3TempDirectoryTests.test_read_with_slash_at_start_okfs __ *775&))D AFF4LL& ) ) ) * * * * * * * * * * * * * * * * * *s:AAAct}tj|d}t |d5}|ddddn #1swxYwY t |}|||j||tj |dgt |5}|| ddddn #1swxYwYt|dS#t|wxYw)NtestwrSrP) rrrr-r,rr assertEqualrr+r.r)rrfpr/tds rtest_dont_cleanup_with_pathz.TempDirectoryTests.test_dont_cleanup_with_pathks II W\\!V $ $ "c]] a GGENNN                A&&&B   Q ( ( ( JJLLL   RZ]]VH 5 5 5b 2Q  5111 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1IIIIIF1IIIIsBA!!A%(A%-A7D5$)D D5DD5 D!D55Ect}t|t|}|||j|t j|dS)NrP)rrr rXr assertFalserr)rrrZs rtest_dont_create_with_pathz-TempDirectoryTests.test_dont_create_with_path{sf IIq  " " " BG$$$ **+++++r!c2t5}|dd|dd|dd|dd|gdddddS#1swxYwYdS)Nr2r!r3r4r5)r4r3r5r2r rr rBs rtest_compare_sort_actualz+TempDirectoryTests.test_compare_sort_actual __ 5 GGD#    GGFC GGFC GGE3    II333 4 4 4  5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5A0B  BBc2t5}|dd|dd|dd|dd|gdddddS#1swxYwYdS)Nr2r!r3r4r5)r4r2r3r5r`rBs rtest_compare_sort_expectedz-TempDirectoryTests.test_compare_sort_expectedrbrcct5}|dd|ddgddddS#1swxYwYdS)Na/b/cr!)abcrexpectedr`rBs rtest_compare_path_tuplez*TempDirectoryTests.test_compare_path_tuples __ & GGGS ! ! ! II: #u  & & & & & & & & & & & & & & & & & & & & &/A  AAcdtdg5}|dd|dd|dd|dd|dd|gd ddddS#1swxYwYdS) Nz.svn)ignorez .svn/rubbishr!za/.svn/rubbishza/b/.svnrgza/d/.svn/rubbish)za/za/b/rgza/d/r`rBs rtest_recursive_ignorez(TempDirectoryTests.test_recursive_ignores 6( + + + q GGNC ( ( ( GG$c * * * GGJ $ $ $ GGGS ! ! ! GG& , , , II                     sBB%%B),B)ct5}|dd|dgdddddS#1swxYwYdS)Nrgr!T) files_onlyr`rBs rtest_files_onlyz"TempDirectoryTests.test_files_onlys __ 2 GGGS ! ! ! IIwiDI 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2rnct5}|d}|dd}|d}|d}|d}|d}dddn #1swxYwY|||||||||dS)NrSzbaz/bobr!rg)rhrirj)r rGr as_stringrX)rr expected1 expected2 expected3actual1actual2actual3s r test_pathzTempDirectoryTests.test_paths __ 3 %((I 3//I G,,Ikk%((Gkk),,Gkk/22G 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 G,,, G,,, G,,,,,sBBB"Bc:t5}|}|d}|}|d}dddn #1swxYwYt||t||dS)NrS)actual)r getpathrvr )rrrwrxrzr{s r test_getpathzTempDirectoryTests.test_getpaths __ ) I %((IkkmmGkk%((G  ) ) ) ) ) ) ) ) ) ) ) ) ) ) )  '**** '******sAA..A25A2cddlm}t}t5}|dd|d|jt }||jg}t||j td5}|| t|dtt|djd |jzdddn #1swxYwY|tt#t j|ddddS#1swxYwYdS) Nr)callz'testfixtures.TempDirectory.atexit_setupFzatexit.registerT)recordz4TempDirectory instances not cleaned up by shutdown: )testfixtures.mockrrr replaceregisterr atexitr mock_callsr assertTruelenstrmessagerrset instances)rrmrrrlrWs r test_atexitzTempDirectoryTests.test_atexits****** FF ZZ 1 II? G G G II' 4 4 4A ah//0H Hal + + +t,,,  A***AaDL))KF                IIKKK CEE=2 3 3 3 HHJJJ3                  s8BE=#A(D E=D E=D AE==FFcft5}ttj|jdd5}|ddddn #1swxYwYt |ddtddddS#1swxYwYdS)N test.filewb£utf8) r r,rrr-rr r. some_textrrr/s rtest_read_decodez#TempDirectoryTests.test_read_decodes __ <bgll16;77>> %! $$$ % % % % % % % % % % % % % % % AFF;// ; ; ; < < < < < < < < < < < < < < < < < > %! $$$ % % % % % % % % % % % % % % % AFF;'' 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s54B A% B %A) )B ,A) -&B  B$'B$cZt5}|ddttj|jdd5}t |ddddn #1swxYwYddddS#1swxYwYdS)Nrrrb)r rr,rrr-r r.rs rtest_write_bytesz#TempDirectoryTests.test_write_bytess  __ / GGK - - -bgll16;77>> /!+... / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /s6A B #B< B B B B B  B$'B$cft5}|dtdttj|jdd5}t|ddddn #1swxYwYddddS#1swxYwYdS)Nrrrr) r rrr,rrr-r r.rs rtest_write_unicodez%TempDirectoryTests.test_write_unicodes __ / GGKF 3 3 3bgll16;77>> /!+... / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /s6AB&#B B&B B&B B&&B*-B*ct5}ttd5|dddddn #1swxYwYddddS#1swxYwYdS)Nz*a bytes-like object is required, not 'str'rr)r r TypeErrorrrBs rtest_write_unicode_badz)TempDirectoryTests.test_write_unicode_bads __ .Y'STTUU . . W--- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .rDct5}|d|d|dddgdddddS#1swxYwYdS)Nfoo/barfoo/bazrSbarbazF)rrl recursiver rGr rBs rtest_just_empty_non_recursivez0TempDirectoryTests.test_just_empty_non_recursives __ ' IIi IIi II5 %u~ %  ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'sAA!!A%(A%ct5}|d|d|gdddddS#1swxYwYdS)Nrr)foo/zfoo/bar/zfoo/baz/rrBs rtest_just_empty_dirsz'TempDirectoryTests.test_just_empty_dirs s __ 8 IIi IIi II666 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8sAAA"%A"c$t5}|ddtj|d|d|gdddddS#1swxYwYdS)N foo/bar.txtxrSr)baz/rrr rrsymlinkrvr rBs r test_symlinkzTempDirectoryTests.test_symlinks __ 7 GGM4 ( ( ( Jq{{5))1;;u+=+= > > > II555 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7sA)BB  B c(t5}|ddtj|d|d|gddddddS#1swxYwYdS)NrrrSr)rz baz/bar.txtrrT) followlinksrrBs rtest_follow_symlinksz'TempDirectoryTests.test_follow_symlinkss __ ( GGM4 ( ( ( Jq{{5))1;;u+=+= > > > IIDDD"&  ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (sA+BB B ct5}|dd|dddgddddS#1swxYwYdS)Nzsource/foo/bar.txtrzsource/rrrkr`rBs rtest_trailing_slashz&TempDirectoryTests.test_trailing_slashs __ H GG($ / / / II9 /FI G G G H H H H H H H H H H H H H H H H H Hs0A  AAcd}|d}td5}|d|t|d|ddddS#1swxYwYdS)Nrrencodingtest.txtrldecoder rr r.rencodeddecodedrs rtest_default_encodingz(TempDirectoryTests.test_default_encoding!s..)) G , , , : GGJ ( ( ( AFF:&& 9 9 9 9 : : : : : : : : : : : : : : : : : :s;A00A47A4cd}|d}td5}|d|dt|dd|ddddS#1swxYwYdS)Nrrasciirrrrrs rtest_override_default_encodingz1TempDirectoryTests.test_override_default_encoding(s..)) G , , , L GGJ'G : : : AFF:F887 K K K K L L L L L L L L L L L L L L L L L Ls?A44A8;A8ctd5}t|t|jdddddS#1swxYwYdSNrrTrlstrictr r as_pathrrrBs rtest_as_path_minimalz'TempDirectoryTests.test_as_path_minimal/s G , , , E AIIKK$qv,,t D D D D E E E E E E E E E E E E E E E E E E7AAActd5}t|dt|jdz dz dddddS#1swxYwYdSNrrrrSrTrrrBs rtest_as_path_relative_stringz/TempDirectoryTests.test_as_path_relative_string3s G , , , ^ AIIi((4<<%3G%3OX\ ] ] ] ] ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^>AA #A ctd5}t|dt|jdz dz dddddS#1swxYwYdSNrr)rSrrSrTrrrBs rtest_as_path_relative_sequencez1TempDirectoryTests.test_as_path_relative_sequence7s G , , , c AIIn--QV u8Lu8T]a b b b b c c c c c c c c c c c c c c c c c crctd5}t|t|jdddddS#1swxYwYdSrr r as_localrrrBs rtest_as_local_minimalz(TempDirectoryTests.test_as_local_minimal;s G , , , G AJJLL5== F F F F G G G G G G G G G G G G G G G G G Grctd5}t|dt|jdz dz dddddS#1swxYwYdSrrrBs rtest_as_local_relative_stringz0TempDirectoryTests.test_as_local_relative_string?s G , , , ` AJJy))E!&MME4IE4QZ^ _ _ _ _ ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `rctd5}t|dt|jdz dz dddddS#1swxYwYdSrrrBs rtest_as_local_relative_sequencez2TempDirectoryTests.test_as_local_relative_sequenceCs G , , , e AJJ~..qv9NQV9V_c d d d d e e e e e e e e e e e e e e e e e erN)%r8r9r:rCrHrLrNrQrTr[r^rarermrqrtr}rrrrrrrrrrrrrrrrrrrrr;r!rr=r=As-111***'''***333***  ,,,555555&&&   222 - - - + + +@<<< 666 /// /// ... '''888 777 (((HHH :::LLLEEE^^^cccGGG```eeeeer!r=tmp_pathct|5}|jt|ksJ dddn #1swxYwY|sJdSNr rrr)rrs rtest_wrap_pathrHs x 'AvX&&&&&''''''''''''''' ??    8<<tmpdirct|5}|jt|ksJ dddn #1swxYwY|sJdSrr)rrs rtest_wrap_localrNs v  %!vV$$$$$%%%%%%%%%%%%%%% ==???r)rpathlibrtempfilerunittestrwarningsrpy.pathrrr testfixturesr r r r r rencode some_bytesrrr=rrr;r!rrs ######"""""" ]]7 # #  *.*.*.*.*.*.*.*.ZDeDeDeDeDeDeDeDeNT Er!