id+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}|dd}|dSN somethingsstuff)r pathwritecleanup)selfdps Z/opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/tests/test_tempdirectory.py test_cleanupzTestTempDirectory.test_cleanups6 OO F GGK * * ct}t}|j}|j}tjdSN)r r cleanup_all)rd1d2p1p2s rtest_cleanup_allz"TestTempDirectory.test_cleanup_alls9 __ __W W!#####rct5}|j}|ddttj|d5}dddn #1swxYwYddddS#1swxYwYdSr)r rropenosjoin)rrrfs rtest_with_statementz%TestTempDirectory.test_with_statement,s __ *v1 77; ) ) )RW\\![1122 *a * * * * * * * * * * * * * * *  * * * * * * * * * * * * * * * * * *s6A A?A' A?'A+ +A?.A+ /A??BBct5}|dd|dd|dd|ddt5}|dddn #1swxYwYdddn #1swxYwY|ddS)Ngarfoo1Foo2g.ozFoo2 foo1 g.o ga)r rr listdirr )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__rr'r-r5rrrrsP*** + + +***.....rrceZdZdZdZdZdZdZdZdZ 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/folderstuff)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 r@makedirrAs 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#1swxYwYdSrE)r r r@readrAs rtest_read_with_slash_at_startz0TempDirectoryTests.test_read_with_slash_at_startQs __ 'ZN ' '~&&& ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'rIct5}ttd5|ddddn #1swxYwYddddS#1swxYwYdSrE)r r r@r3rAs r test_listdir_with_slash_at_startz3TempDirectoryTests.test_listdir_with_slash_at_startXrHrIct5}ttd5|dddddn #1swxYwYddddS#1swxYwYdS)Nr=r9r>r)r r r@r rAs 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 rK)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) rr*rr+r)rr assertEqualrr3rKr)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 assertFalser*exists)rrrZs rtest_dont_create_with_pathz-TempDirectoryTests.test_dont_create_with_path{sf IIq  " " " BG$$$ **+++++rc2t5}|dd|dd|dd|dd|gdddddS#1swxYwYdS)Nr/rr0r1r2)r1r0r2r/r rr rAs 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)Nr/rr0r1r2)r1r/r0r2rarAs rtest_compare_sort_expectedz-TempDirectoryTests.test_compare_sort_expectedrcrdct5}|dd|ddgddddS#1swxYwYdS)Na/b/cr)abcrexpectedrarAs 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/rubbishrza/.svn/rubbishza/b/.svnrhza/d/.svn/rubbish)za/za/b/rhza/d/rarAs rtest_recursive_ignorez(TempDirectoryTests.test_recursive_ignores 6( + + + q GGNC ( ( ( GG$c * * * GGJ $ $ $ GGGS ! ! ! GG& , , , II                     sBB%%B),B)ct5}|dd|dgdddddS#1swxYwYdS)NrhrT) files_onlyrarAs 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 2roct5}|d}|dd}|d}|d}|d}|d}dddn #1swxYwY|||||||||dS)NrSzbaz/bobrrh)rirjrk)r rFr 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 getpathrwr )rrrxryr{r|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)rrmrrrmrWs 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)r*rr+rr rK 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)r*rr+r rKrs 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)r*rr+r rKrs 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 TypeErrorrrAs rtest_write_unicode_badz)TempDirectoryTests.test_write_unicode_bads __ .Y'STTUU . . W--- . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .rCct5}|d|d|dddgdddddS#1swxYwYdS)Nfoo/barfoo/bazrSbarbazF)rrm recursiver rFr rAs 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/rrAs 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 rr*symlinkrwr rAs 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) followlinksrrAs rtest_follow_symlinksz'TempDirectoryTests.test_follow_symlinkss __ ( GGM4 ( ( ( Jq{{5))1;;u+=+= > > > IIDDD"&  ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (sA+BB B ct5}|dd|dddgddddS#1swxYwYdS)Nzsource/foo/bar.txtrzsource/rrrlrarAs 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.txtrmdecoder rr rKrencodeddecodedrs 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#1swxYwYdSNrrTrmstrictr r as_pathrrrAs 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#1swxYwYdSNrrrrSrTrrrAs 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)rSrrSrTrrrAs 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_localrrrAs 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#1swxYwYdSrrrAs rtest_as_local_relative_stringz0TempDirectoryTests.test_as_local_relative_string?s G , , , ` AJJy))E!&MME4IE4QZ^ _ _ _ _ ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `rctd5}t|dt|jdz dz dddddS#1swxYwYdSrrrAs 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)%r6r7r8rBrGrLrNrQrTr[r_rbrfrnrrrur~rrrrrrrrrrrrrrrrrrrrr9rrr;r;As-111***'''***333***  ,,,555555&&&   222 - - - + + +@<<< 666 /// /// ... '''888 777 (((HHH :::LLLEEE^^^cccGGG```eeeeerr;tmp_pathcVt|5}ddddS#1swxYwYdSr!r )rrs rtest_wrap_pathrHsq x 'A'''''''''''''''''' ""tmpdircVt|5}ddddS#1swxYwYdSr!r)rrs rtest_wrap_localrNsq v  %!%%%%%%%%%%%%%%%%%%r)r*pathlibrtempfilerunittestrwarningsrpy.pathrrr testfixturesr r r r r rencode some_bytesrrr;rrr9rrrs ######"""""" ]]7 # #  *.*.*.*.*.*.*.*.ZDeDeDeDeDeDeDeDeNT Er