jl8TndZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z  ddl Z n #e $rdZ YnwxYwddlmZmZmZddlmZmZmZmZmZddlmZddlmZmZmZmZGdd eZGd d eZ Gd d eZ!GddeZ"GddeZ#GddeZ$GddeZ%GddeZ&GddeZ'GddeZ(Gdde(Z)Gdde(Z*Gd d!e(Z+Gd"d#eZ,Gd$d%eZ-Gd&d'eZ.Gd(d)eZ/Gd*d+eZ0Gd,d-eZ1Gd.d/eZ2Gd0d1eZ3Gd2d3eZ4e5d4kre j6dSdS)5z$Unittest for fake_filesystem module.N)patch)fake_filesystemfake_os fake_open)set_uidset_gidis_root reset_idsOSType)IS_WIN)TestCaseRealFsTestCase time_mockskip_if_symlink_not_supportedceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdS)FakeDirectoryUnitTestcTtjd|_tj|j|_t dd|_|jtj dd|j|_ tj d|j |_ dS) N/path_separator foobar dummy_file)contents filesystemsomedirr) rFakeFilesystemrr FakeOsModuleosrtimestartFakeFile fake_file FakeDirectoryfake_dirselfs u/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/tests/fake_filesystem_test.pysetUpzFakeDirectoryUnitTest.setUp3s)8LLL&t77b!$$  (1 |   (5 $/    c8|jdSN)r"stopr(s r*tearDownzFakeDirectoryUnitTest.tearDown?s r,c|tj|jjz|tj|jjz|i|jjdSr.) assertTruestatS_IFREGr%st_modeS_IFDIRr' assertEqualentriesr(s r*test_new_file_and_directoryz1FakeDirectoryUnitTest.test_new_file_and_directoryBs_  t~'==>>>  t}'<<=== T]233333r,c|j|j|d|ji|jjdSNr)r' add_entryr%r7r8r(s r*test_add_entryz$FakeDirectoryUnitTest.test_add_entryGsB /// (DN3T]5JKKKKKr,c|j|j||j|jddSr;)r'r<r%r7 get_entryr(s r*test_get_entryz$FakeDirectoryUnitTest.test_get_entryKsH /// )@)@)J)JKKKKKr,c0|jj}|jj|j|j|j||d|jj||d|jjdS)Nzsomedir/foobarr)r root_dir_namerootr<r'r%r7pathr)root_dirs r* test_pathzFakeDirectoryUnitTest.test_pathOs?0 &&t}555 /// H444dn6IJJJ H---t}/ABBBBBr,cd|j_d}|j||j|}|||jdSNTzC:/foo/bar/baz)r is_windows_fs create_dir get_objectr7rDr)dir_path dir_objects r*test_path_with_drivez*FakeDirectoryUnitTest.test_path_with_driveVsZ(,%# ""8,,,_//99  :?33333r,c|jj}d}|j||j||j|}||d|jdS)N /foo/bar/baz foo/bar/baz)rrBrKr!chdirrLr7rD)r)rFrNrOs r*test_path_after_chdirz+FakeDirectoryUnitTest.test_path_after_chdir]sw?0! ""8,,,  h_//99  H111:?CCCCCr,cd|j_d}|j||j||j|}|||jdSrI)rrJrKr!rTrLr7rDrMs r* test_path_after_chdir_with_drivez6FakeDirectoryUnitTest.test_path_after_chdir_with_driveesn(,%# ""8,,,  h_//99  :?33333r,cx|j|j||j|jd|jd|t5|jdddddS#1swxYwYdSr;)r'r<r%r7r? remove_entry assertRaisesKeyErrorr(s r*test_remove_entryz'FakeDirectoryUnitTest.test_remove_entryms /// )@)@)J)JKKK ""8,,,   x ( ( . . M # #H - - - . . . . . . . . . . . . . . . . . .sB//B36B3c|tj5d|j_ddddS#1swxYwYdSNg?raises_os_errorerrnoENOSPCr%sizer(s r*,test_should_throw_if_set_size_is_not_integerzBFakeDirectoryUnitTest.test_should_throw_if_set_size_is_not_integerts  ! !%, / / & &"%DN  & & & & & & & & & & & & & & & & & & :>>c|tj5d|j_ddddS#1swxYwYdSNr_r(s r*)test_should_throw_if_set_size_is_negativez?FakeDirectoryUnitTest.test_should_throw_if_set_size_is_negativexs  ! !%, / / % %"$DN  % % % % % % % % % % % % % % % % % %rec^d|j_|d|jjdSNrr%rcr7rr(s r*+test_produce_empty_file_if_set_size_is_zerozAFakeDirectoryUnitTest.test_produce_empty_file_if_set_size_is_zero|- T^455555r,c^d|j_|d|jjdSrkrmr(s r*+test_sets_content_empty_if_set_size_is_zerozAFakeDirectoryUnitTest.test_sets_content_empty_if_set_size_is_zeroror,c^d|j_|d|jjdS)Ndummy_rmr(s r*7test_truncate_file_if_size_is_smaller_than_current_sizezMFakeDirectoryUnitTest.test_truncate_file_if_size_is_smaller_than_current_sizes- 4>#:;;;;;r,c^d|j_|d|jjdS)Nrrrmr(s r*:test_leave_file_unchanged_if_size_is_equal_to_current_sizezPFakeDirectoryUnitTest.test_leave_file_unchanged_if_size_is_equal_to_current_sizes-  t~'>?????r,c|d|j_|tj5|jddddn #1swxYwYd|j_|tj5|jdddddS#1swxYwYdS)NTaF)rrJr`raEISDIRr' set_contentsr(s r*test_set_contents_to_dir_raisesz5FakeDirectoryUnitTest.test_set_contents_to_dir_raisess'(,%  ! !%, / / , , M & &s + + + , , , , , , , , , , , , , , ,(-%  ! !%, / / , , M & &s + + + , , , , , , , , , , , , , , , , , ,s#AAA B11B58B5c^d|j_|d|jjdS)N z dummy_filermr(s r*=test_pads_with_nullbytes_if_size_is_greater_than_current_sizezSFakeDirectoryUnitTest.test_pads_with_nullbytes_if_size_is_greater_than_current_sizes.  +T^-DEEEEEr,c|d|jjd|j_|d|jjd|j_|d|jjdS)Nr)r7r%st_mtimer(s r*test_set_m_timez%FakeDirectoryUnitTest.test_set_m_timesm T^4555"$ T^4555"% dn566666r,ctjd}tj|}d}||d|d||t j||}d|_ | d||t jdS)Nrr some_file1zcontents here1rr+) rrrr create_file assertLessr3ST_INOrLst_inor7)r)rfake_os_module file_pathfile_objs r*test_file_inodez%FakeDirectoryUnitTest.test_file_inodes$33GGG  -j99 y3CDDD >..y99$+FGGG((33 ^00;;DKHIIIIIr,ctjd}tj|}d}|||d||t j||}d|_ | d||t jdS)Nrrtestdirrr) rrrr rKrr3rrLrr7)r)rrdirpathdir_objs r*test_directory_inodez*FakeDirectoryUnitTest.test_directory_inodes$33GGG  -j99g&&& >..w77 DEEE''00 ^0099$+FGGGGGr,ctjd}|d}|dd|d}|dd |d d |d }|d d|dd|d|j|d|j|d|j|d|jj|tj 5d|_ddddS#1swxYwYdS)Nrr/fooz /foo/bar.txtst_sizez /foo/bar/z/foo/bar/baz1.txtz/foo/bar/baz2.txt(z/foo1z /foo1/bar.txt2z/foo1/bar/baz/file<ZFnd) rrrKrr7rcrFr`rarz)r)fsfoo_dirbar_dirfoo1_dirs r*test_directory_sizez)FakeDirectoryUnitTest.test_directory_sizes  +3 ? ? ?--'' ~r222-- ,, *B777 *B777==)) 333 +R888 W\*** W\*** hm,,, bk.///  ! !%, / /  HM                  sE--E14E1cftjd}|d|d|d|d|d|d}|gd|jdS) Nrrrz/foo/2z/foo/4z/foo/1z/foo/3)2413)rrrKrrLr7 ordered_dirs)r)rr's r*test_ordered_dirsz'FakeDirectoryUnitTest.test_ordered_dirss$33GGG f%%%x(((x(((x(((x(((((00 ---x/DEEEEEr,N)__name__ __module__ __qualname__r+r0r9r=r@rGrPrUrWr\rdrirnrqrurwr|rrrrrrr,r*rr2s    444 LLLLLLCCC444DDD444...&&&%%%666666<<<@@@,,,FFF777 J J J H H H   "FFFFFr,rc&eZdZdZdZdZdZdS)SetLargeFileSizeTestcbtj}tjd||_dS)Nrr)rrr$r%r)rs r*r+zSetLargeFileSizeTest.setUps+$355 (1(zRRRr,c|tj5|jdddddS#1swxYwYdSr^r`rarbr%set_large_file_sizer(s r*(test_should_throw_if_size_is_not_integerz=SetLargeFileSizeTest.test_should_throw_if_size_is_not_integers  ! !%, / / 4 4 N . .s 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4AA A c|tj5|jdddddS#1swxYwYdSrgrr(s r*%test_should_throw_if_size_is_negativez:SetLargeFileSizeTest.test_should_throw_if_size_is_negatives  ! !%, / / 3 3 N . .r 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3rc|jd|d|jj|d|jjdS)Niʚ;)r%rr7rrr(s r*6test_sets_content_none_if_size_is_non_negative_integerzKSetLargeFileSizeTest.test_sets_content_none_if_size_is_non_negative_integersT **:666 t~6777 T^%;<<<<eZdZdZdZdZdZdZdZdZ dZ d S) NormalizePathTestc\tjd|_|jj|_dSNrr)rrrrB root_namer(s r*r+zNormalizePathTest.setUps')8LLL6r,cl||j|jddSNrlr7rr absnormpathr(s r*2test_empty_path_should_get_normalized_to_root_pathzDNormalizePathTest.test_empty_path_should_get_normalized_to_root_paths0 )D)DR)H)HIIIIIr,cv||j|j|jdSr.rr(s r* test_root_path_remains_unchangedz2NormalizePathTest.test_root_path_remains_unchangeds2 )D)DT^)T)TUUUUUr,c~d}d|j_|d|j|dS)Nbarr/foo/barrcwdr7rr)rDs r* test_relative_path_forced_to_cwdz2NormalizePathTest.test_relative_path_forced_to_cwds=$ T_%@%@%F%FGGGGGr,ctjd|j_|d|jjdS)Nr)pathlibPathrrr7r(s r*test_cwd_from_pathlib_pathz,NormalizePathTest.test_cwd_from_pathlib_paths7%l:66 T_%899999r,cvd}||j|z|j|dS)Nfoo/barrrs r*$test_absolute_path_remains_unchangedz6NormalizePathTest.test_absolute_path_remains_unchangeds: $.0K0KD0Q0QRRRRRr,cd}||jj|j|d}||jjd|j|dS)Nz/foo/..z foo/../barrr7rrBrrs r*test_dotted_path_is_normalizedz0NormalizePathTest.test_dotted_path_is_normalizeds  O )4?+F+Ft+L+L    , 1 1 1 O ' ' - -     r,cpd}||j|j|dSN.rrs r*test_dot_path_is_normalizedz-NormalizePathTest.test_dot_path_is_normalizeds5 )D)DT)J)JKKKKKr,N) rrrr+rrrrrrrrr,r*rrs777JJJVVVHHH :::SSS    LLLLLr,rc8eZdZdZdZdZdZdZdZdZ dS) GetPathComponentsTestcHtjd|_d|_dSr)rrrrr(s r*r+zGetPathComponentsTest.setUps")8LLLr,cl|g|j|jdSr.)r7r_path_componentsrr(s r*'test_root_path_should_return_empty_listz=GetPathComponentsTest.test_root_path_should_return_empty_lists0 T_==dnMMNNNNNr,cb|g|jddSrr7rrr(s r*(test_empty_path_should_return_empty_listz>GetPathComponentsTest.test_empty_path_should_return_empty_lists. T_==bAABBBBBr,cd|dg|jddSNfoorr(s r*=test_relative_path_with_one_component_should_return_componentzSGetPathComponentsTest.test_relative_path_with_one_component_should_return_components0 %$/"B"B5"I"IJJJJJr,cd|dg|jddS)Nrrrr(s r*=test_absolute_path_with_one_component_should_return_componentzSGetPathComponentsTest.test_absolute_path_with_one_component_should_return_components0 %$/"B"B6"J"JKKKKKr,cf|ddg|jddS)Nrrrrr(s r*5test_two_level_relative_path_should_return_componentszKGetPathComponentsTest.test_two_level_relative_path_should_return_componentss2 %)I)I))T)TUUUUUr,cf|ddg|jddS)Nrrrrr(s r*5test_two_level_absolute_path_should_return_componentszKGetPathComponentsTest.test_two_level_absolute_path_should_return_components!s2 %)I)I*)U)UVVVVVr,N) rrrr+rrrrrrrr,r*rr sOOOCCCKKKLLLVVVWWWWWr,rcReZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7S)8FakeFilesystemUnitTestctjd|_|jj|_tjd|j|_tjd|j|_tjd|j|_ dS)Nrrrrfoobazquux) rrrrBrr$r%r& fake_childfake_grandchildr(s r*r+zFakeFilesystemUnitTest.setUp&s)8LLL6(1(tWWW)7     /< t   r,c|d|jj|tj|jjjz|i|jjj dS)Nr) r7rrr2r3r6rCr5rFr8r(s r*test_new_filesystemz*FakeFilesystemUnitTest.test_new_filesystem1sb do<===  t';'CCDDD T_5=>>>>>r,c|t5|jdddddS#1swxYwYdSr.)rZ TypeErrorrexistsr(s r*test_none_raises_type_errorz2FakeFilesystemUnitTest.test_none_raises_type_error6s   y ) ) ) ) O " "4 ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )sAA Ac`||jddSr) assertFalserrr(s r* test_empty_string_does_not_existz7FakeFilesystemUnitTest.test_empty_string_does_not_exist:s, //3344444r,cj||j|jdSr.)r2rrrr(s r*test_exists_rootz'FakeFilesystemUnitTest.test_exists_root=s, ..t~>>?????r,ct||j|jjdSr.)rrrr%namer(s r*test_exists_unadded_filez/FakeFilesystemUnitTest.test_exists_unadded_file@s1 //0CDDEEEEEr,cd}|j|d||j|dzdS)Nrbazr/baz)rrrrr)rs r*0test_not_exists_subpath_named_like_file_contentszGFakeFilesystemUnitTest.test_not_exists_subpath_named_like_file_contentsCsQ  ##I#>>> // F0BCCDDDDDr,c||jj|j|jdSr.)r7rrFrLrr(s r*test_get_root_objectz+FakeFilesystemUnitTest.test_get_root_objectIsA  O $ O & &t~ 6 6     r,c|j|j|j|d|ji|jjjdSr;)r add_objectrr%r7rFr8r(s r*test_add_object_to_rootz.FakeFilesystemUnitTest.test_add_object_to_rootOsI ""4>4>BBB (DN3T_5M5UVVVVVr,cd|j_|d|jjd|j_|d|jjd|j_|d|jjdS)NTzC:/zE:/foozE:/z //foo/barz //foo/bar/)rrJr7rBrr(s r*test_windows_root_dir_namez1FakeFilesystemUnitTest.test_windows_root_dir_nameSsw(,%  =>>>&  =>>>) t'DEEEEEr,c|j|j|j||j|jjdSr.)rrrr%r2rrr(s r*test_exists_added_filez-FakeFilesystemUnitTest.test_exists_added_file[sK ""4>4>BBB ..t~/BCCDDDDDr,c"d|j_|jd|jd||jd||jd||jd||jd||jdd |j_||jd ||jd ||jd ||jd ||jddS)NF /a/b/file_one /a/c/file_twoa/b/../c/file_two/a/c/../b/file_one/a/c/../../a/b/file_one a/b/../z/da/b/../z/../c/file_twoz/a/c ../b/file_one../../a/b/file_one../../a/b/../../a/c/file_two ../z/file_one../z/../c/file_two)rrJrr2rrrr(s r*test_exists_relative_path_posixz6FakeFilesystemUnitTest.test_exists_relative_path_posix_s(-% ##O444 ##O444 ../BCCDDD ../CDDEEE ../HIIJJJ // ==>>> //0HIIJJJ$ ..??@@@ ../CDDEEE ../MNNOOO //@@AAA //0DEEFFFFFr,c:d|j_d|j_|jd|jd||jd||jd||jd||jd||jd d |j_||jd ||jd ||jd ||jd||jddS)NTFrrrrrrrzC:/a/cr r!r"r#r$)rrJis_macosrr2rrrr(s r*!test_exists_relative_path_windowsz8FakeFilesystemUnitTest.test_exists_relative_path_windowsos(,%#(  ##O444 ##O444 ../BCCDDD ../CDDEEE ../HIIJJJ // ==>>> ../GHHIII& ..??@@@ ../CDDEEE ../MNNOOO //@@AAA ../CDDEEEEEr,c|j|j|j||j|jddSr;)rrrr%r7rLr(s r*test_get_object_from_rootz0FakeFilesystemUnitTest.test_get_object_from_rootsL ""4>4>BBB )C)CH)M)MNNNNNr,cZ|j|j|j||j|jd|tj5|jdddddS#1swxYwYdS)Nrsome_bogus_filename) rrrr%r7rLr`raENOENTr(s r*+test_get_nonexistent_object_from_root_errorzBFakeFilesystemUnitTest.test_get_nonexistent_object_from_root_errors ""4>4>BBB )C)CH)M)MNNN  ! !%, / / > > O & &'< = = = > > > > > > > > > > > > > > > > > >s8B  B$'B$cP|j|j|j|j|jj|tj5|j |jjddddS#1swxYwYdSr.) rrrr% remove_objectrr`rar-rLr(s r*test_remove_object_from_rootz3FakeFilesystemUnitTest.test_remove_object_from_roots ""4>4>BBB %%dn&9:::  ! !%, / / < < O & &t~': ; ; ; < < < < < < < < < < < < < < < < < 4>BBB %%dn&9::: //0CDDEEEEEr,cJ|j|j|j|j|jj|j||jj|ji|jj|jjj dSr.) rrrrrr%r7rFr?r8r(s r*test_add_object_to_childz/FakeFilesystemUnitTest.test_add_object_to_childs ""4>4?CCC ""4?#7HHH  ^ $. 1 O $ . .t/C D D L     r,c6d|j_|j|jj|j|t j5|j|jj|jddddS#1swxYwYdSNF) rrJrrBr%r`raENOTDIRrr(s r*+test_add_object_to_regular_file_error_posixzBFakeFilesystemUnitTest.test_add_object_to_regular_file_error_posixs(-% ""4?#@$.QQQ  ! !%- 0 0 L L O & &t~':DN K K K L L L L L L L L L L L L L L L L L Ls+BBBc,d|j_|j|j|j|t j5|j|jj|jddddS#1swxYwYdSNT) rrJrrr%r`rar-rr(s r*-test_add_object_to_regular_file_error_windowszDFakeFilesystemUnitTest.test_add_object_to_regular_file_error_windowss(,% ""4>4>BBB  ! !%, / / L L O & &t~':DN K K K L L L L L L L L L L L L L L L L L Ls+B  B B c\|j|j|j|j|jj|j|j|jj|jj}||j|dSr.) rrrrrr% joinpathsr2rrs r*test_exists_file_added_to_childz6FakeFilesystemUnitTest.test_exists_file_added_to_childs ""4>4?CCC ""4?#7HHH(()=t~?RSS ..t4455555r,c d|j|j|j|j|jj|j||j|j|j|jj|jjdSr.) rrrrrr%r7rLrAr(s r*test_get_object_from_childz1FakeFilesystemUnitTest.test_get_object_from_childs ""4>4?CCC ""4?#7HHH  N O & &))$/*>@STT       r,c|j|j|j|j|jj|j|tj5|j |j |jjdddddS#1swxYwYdSr3) rrrrrr%r`rar-rLrAr(s r*,test_get_nonexistent_object_from_child_errorzCFakeFilesystemUnitTest.test_get_nonexistent_object_from_child_errors ""4>4?CCC ""4?#7HHH  ! !%, / /   O & &))$/*>@UVV                     s/>B::B>B>c|j|j|j|j|jj|j|j|jj|jj}|j||tj 5|j |ddddS#1swxYwYdSr.) rrrrrr%rAr0r`rar-rL)r) target_paths r*test_remove_object_from_childz4FakeFilesystemUnitTest.test_remove_object_from_childs  ""4>4?CCC ""4?#7HHHo// O $."5   %%k222  ! !%, / / 4 4 O & &{ 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4s8C  C$'C$c:|j|j|j|t j5|j|j|jj dddddS#1swxYwYdSr3) rrrrr`rar-r0rArr(s r*#test_remove_object_from_child_errorz:FakeFilesystemUnitTest.test_remove_object_from_child_errors ""4>4?CCC  ! !%, / /   O ) )))$/*>@UVV                     s>BBBc@|j|j|j|t j5|j|jd|jj zdddddS#1swxYwYdS)Nz%s1file_does_not_matter_since_parent_not_a_directory) rrrr%r`rar;r0rArr(s r*+test_remove_object_from_non_directory_errorzBFakeFilesystemUnitTest.test_remove_object_from_non_directory_errors ""4>4>BBB  ! !%- 0 0   O ) )))4>..G                     sABBBc|j|j|j|j|jj|j|j|jj|jj}|j|||j |dSr.) rrrrrr%rAr0rrrs r*#test_exists_file_removed_from_childz:FakeFilesystemUnitTest.test_exists_file_removed_from_childs ""4>4?CCC ""4?#7HHH(()=t~?RSS %%d+++ //5566666r,c |j|j|j|j|jj|j|j|jj|jj}|j||jj}|t5|j |dddn #1swxYwY|j||j| |j|j || |j ||j||t5|j |dddn #1swxYwY||j |dSr.)rrrrrrrAr%rZOSErrorrLr7r2rr0r)r)grandchild_directorygrandchild_files r*$test_operate_on_grandchild_directoryz;FakeFilesystemUnitTest.test_operate_on_grandchild_directorys. ""4>4?CCC ""4?#79MNNN#88 O $"6";  /33 $."5    w ' ' 8 8 O & & 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 ""#7HHH )C)CO)T)TUUU ..??@@@ %%o666   w ' ' 8 8 O & & 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 //@@AAAAAs$>C%%C),C)$G  GGc0d}|j||j|}|tj||j|tj |j zdSr rrKrLr7r!rDbasenamerr2r3r6r5r)rDnew_dirs r*'test_create_directory_in_root_directoryz>FakeFilesystemUnitTest.test_create_directory_in_root_directorys{ ""4(((/,,T22 ))$//>>>  w677777r,cd}|j||tj5|j|ddddS#1swxYwYdSrrrKr`raEEXISTrs r*>>  w67774 ""4(((/,,T22 ))$//>>>  w677777r,c|jj}d|j_d}|j|d|j|}|t jdz|jd}|j|dd|j|}|t jdz|j||j_dS) NrSi perm_bitsiz foo/bar/booF)rf apply_umask)rumaskrKrLr7r3r6r5)r) old_umaskrDrZs r*test_create_dir_umaskz,FakeFilesystemUnitTest.test_create_dir_umasksO) $ ""45"999/,,T22 -w??? ""45e"LLL/,,T22 -w??? )r,cd}|j||tj5|j|ddddS#1swxYwYdS)NrSr]rs r**test_create_directory_already_exists_errorzAFakeFilesystemUnitTest.test_create_directory_already_exists_error#s ""4(((  ! !%, / / - - O & &t , , , - - - - - - - - - - - - - - - - - -r`cd|j_d}|j|d|dz}tsT|t j5|j|ddddS#1swxYwYdS|j|||j |dS)NFrmrer ) rrJrKr r`raEACCESrr2rr)rNrs r*7test_create_file_in_read_only_directory_raises_in_posixzNFakeFilesystemUnitTest.test_create_file_in_read_only_directory_raises_in_posix)s(-% ""8u"===v% yy ?%%el33 7 7++I666 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 O ' ' 2 2 2 OODO229== > > > > >sBB  B cd|j_d}|j|d|dz}|j|||j|dS)NTz C:/foo/barrnrer )rrJrKrr2rrps r*;test_create_file_in_read_only_directory_possible_in_windowszRFakeFilesystemUnitTest.test_create_file_in_read_only_directory_possible_in_windows6st(,% ""8u"===v%  ##I... ..y99:::::r,cd}d}|j||||j|||jt j|d|z}||jt j|dS)Nr dummy datarz./%s)rrr2rrr!rDdirname)r)rDrs r*%test_create_file_in_current_directoryzs ##D8#<<< ..t44555 //0E0EFFGGG} ..rwt/D/DEEFFFFFr,c\d}d}|j|||j|}||j|||jt j||t j ||j |tj |j z|||jdS)Nrrur)rrrLr2rr!rDrvr7rXrr3r4r5r)r)rDrnew_files r*"test_create_file_in_root_directoryz9FakeFilesystemUnitTest.test_create_file_in_root_directoryGs ##D8#<<<?--d33 ..t44555 ..rwt/D/DEEFFF ))$//???  x'77888 8#455555r,cd}|j|d|j|}|d|j|d|jdS)N large_foo_barir)rrrLr7rrr)rDrys r*>>o%%i00 38,,, #,77777r,cTd}d}d}|jd|jd||j|||j|}|||j|||jdS)Nrrrrr)rrKrrlresolver7rrrs r*check_lresolve_objectz,FakeFilesystemUnitTest.check_lresolve_objects" ,  ""5))) ##L?#KKK &&y+>>>o&&y11 CH--- cl33333r,cFd|j_|dSr>rrJrr(s r*test_lresolve_object_windowsz3FakeFilesystemUnitTest.test_lresolve_object_windowss$(,% ""$$$$$r,cFd|j_|dSr:rr(s r*test_lresolve_object_posixz1FakeFilesystemUnitTest.test_lresolve_object_posixs$(-% ""$$$$$r,cX|jd||5|jddddn #1swxYwY||5|jdddddS#1swxYwYdS)N not_a_dirz not_a_dir/fooznot_a_dir/foo/bar)rrr`rr)r) error_subtypes r*check_directory_access_on_filez5FakeFilesystemUnitTest.check_directory_access_on_files& ##K000  ! !- 0 0 5 5 O # #O 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5  ! !- 0 0 : : O $ $%8 9 9 9 : : : : : : : : : : : : : : : : : :s#AAA7BB#&B#c\d|j_|tjdSr>)rrJrrar-r(s r*%test_directory_access_on_file_windowsz>> <<< AAAFFF    LLL LLL 666    444777BBB&888--- 8 8 8 * * *--- ? ? ?;;;GGG 6 6 6666... +++   +++666... === 8 8 8 4 4 4%%%%%%::::::;;;HHHHHr,rcVeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S)!CaseInsensitiveFakeFilesystemTestctjd|_d|j_t j|j|_|jj|_dSNrrFrrris_case_sensitiverr r!rDr(s r*r+z'CaseInsensitiveFakeFilesystemTest.setUpsD)8LLL,1)&t77GL r,c|jd|jd||jddSNrrRz /Foo/Bar/Baz)rrKrr2rLr(s r*test_get_objectz1CaseInsensitiveFakeFilesystemTest.test_get_objectsV "":... ##N333 22>BBCCCCCr,c|jd|jd|jd||jddSr)rrKrr0rrr(s r*test_remove_objectz4CaseInsensitiveFakeFilesystemTest.test_remove_objectsn "":... ##N333 %%n555 //??@@@@@r,c|jd||jd||jd|jd||jd||jddSN/Foo/Barrz /foo/Bar/bazz /Foo/bar/BAZrR)rrKr2rrr(s r* test_existsz-CaseInsensitiveFakeFilesystemTest.test_existss "":... ..z::;;; ..z::;;; ##N333 ..~>>??? ..~>>?????r,c|jd|jd|jd}|jd}|||dSNrrRr)rrKrLr7r)dir1dir2s r*.test_create_directory_with_different_case_rootzPCaseInsensitiveFakeFilesystemTest.test_create_directory_with_different_case_rootst "":... "">222))*55))*55 t$$$$$r,c|jd|jd|jd}|jd}|||dSr)rrKrrLr7rs r*(test_create_file_with_different_case_dirzJCaseInsensitiveFakeFilesystemTest.test_create_file_with_different_case_dirst "":... ##N333))*55))*55 t$$$$$r,c|jd|jdd||jjd|jddS)Nz/foo/bazrz ./baz/bipz foo/baz/bipr)rrKrr7rB resolve_pathr(s r*test_resolve_pathz3CaseInsensitiveFakeFilesystemTest.test_resolve_pathsv "":... &&z;??? , 9 9 9 O ( ( 4 4     r,c|jd||jd||jd||jd||jddSNrFooFoo/Bar)rrr2rDisdirrisfiler(s r*test_isdir_isfilez3CaseInsensitiveFakeFilesystemTest.test_isdir_isfiles ##I...  ../// ))%00111  ((33444 3344444r,cd}|j|d|d|jddS)NrS1234567r FOO/BAR/BAZrrr7rDgetsizer s r* test_getsizez.CaseInsensitiveFakeFilesystemTest.test_getsize sN!  ##I #BBB DI--m<<=====r,cNd|j_d}|j||dz}|dz}|j|||t j5|jj |ddddS#1swxYwYdS)NFrz/link) rrJrKr!symlinkr`raELOOPrDr)r)rN link_path link_targets r*!test_getsize_with_looping_symlinkzCCaseInsensitiveFakeFilesystemTest.test_getsize_with_looping_symlinks(-% ""8,,,w& ')   Y///  ! !%+ . . , , GL  + + + , , , , , , , , , , , , , , , , , ,s- BB!Bc|jd}d|_|d|jddSNz foo/bar1.txtz Foo/Bar1.TXT)rrrr7rDgetmtimer) test_files r*test_get_mtimez0CaseInsensitiveFakeFilesystemTest.test_get_mtimesKO//??   TY//??@@@@@r,c|jdd||jddS)Nrrrr)rrr2rLr(s r*test_get_object_with_file_sizez@CaseInsensitiveFakeFilesystemTest.test_get_object_with_file_sizesE ##J#;;; 22:>>?????r,N)rrrr+rrrrrrrrrrrrr,r*rrs!!! DDD AAA @@@%%%%%%   555>>> ,,,AAA @@@@@r,rcDeZdZdZdZdZdZdZdZdZ dZ d Z d S) CaseSensitiveFakeFilesystemTestctjd|_d|j_t j|j|_|jj|_dS)NrrTrr(s r*r+z%CaseSensitiveFakeFilesystemTest.setUp%sD)8LLL,0)&t77GL r,c|jd|jd|t5|jdddddS#1swxYwYdSr)rrKrrZrRrLr(s r*rz/CaseSensitiveFakeFilesystemTest.test_get_object+s "":... ##N333   w ' ' 7 7 O & &~ 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7sA77A;>A;c`|jd|jd|t5|jddddn #1swxYwY||jddSr)rrKrrZrRr0r2rr(s r*rz2CaseSensitiveFakeFilesystemTest.test_remove_object1s "":... ##N333   w ' ' : : O ) ). 9 9 9 : : : : : : : : : : : : : : : ..~>>?????sA66A:=A:c|jd||jd||jd|jd||jd||jddSr)rrKr2rrrr(s r*rz+CaseSensitiveFakeFilesystemTest.test_exists8s "":... ..z::;;; // ;;<<< ##N333 //??@@@ //??@@@@@r,c|jd|jd|jd}|jd}|||dSr)rrKrLassertNotEqualrs r*rzNCaseSensitiveFakeFilesystemTest.test_create_directory_with_different_case_rootAst "":... "">222))*55))*55 D$'''''r,c|jd|jd|jd}|jd}|||dSr)rrKrrLrrs r*rzHCaseSensitiveFakeFilesystemTest.test_create_file_with_different_case_dirHst "":... ##N333))*55))*55 D$'''''r,c|jd||jd||jd||jd||jddSr)rrrrDrrr(s r*rz1CaseSensitiveFakeFilesystemTest.test_isdir_isfileOs ##I... //000 ))%00111 )))44555 3344444r,cd}|j|d|tj5|jdddddS#1swxYwYdS)NrSrrr)rrrZr!errorrDrr s r*rz,CaseSensitiveFakeFilesystemTest.test_getsizeVs!  ##I #BBB   rx ( ( - - I  m , , , - - - - - - - - - - - - - - - - - -rc|jd}d|_|tj5|jdddddS#1swxYwYdSr)rrrr`rar-rDrrs r*rz.CaseSensitiveFakeFilesystemTest.test_get_mtime\sO//??    ! !%, / / / / I  ~ . . . / / / / / / / / / / / / / / / / / /A))A-0A-N) rrrr+rrrrrrrrrr,r*rr$s!!! 777 @@@AAA((((((555--- /////r,rc$eZdZdZdZdZdZdS)OsPathInjectionRegressionTestzTest faking os.path before calling os.walk. Found when investigating a problem with gws/tools/labrat/rat_utils_unittest, which was faking out os.path before calling os.walk. ctjd|_tj|_t j|j|_dSr)rrrr!rDos_pathrr r(s r*r+z#OsPathInjectionRegressionTest.setUpks:)8LLLw &t77r,c(|jt_dSr.)r r!rDr(s r*r0z&OsPathInjectionRegressionTest.tearDownss,r,cd}||j||j|||jd||j||jd|z|jd|z|jd|z|jd|z|jd|zddggfdd d ggfd gd gfd gd dgfg}t d|jdDd}| t|t|t||D]\}}| |d|d| |dt |d| |dt |ddS)Nz/xrz%s/poz %s/po/controlz%s/po/experimentz%s/gvz %s/gv/controlrgvpoz/x/gvcontrolz/x/po experimentcg|]}|Srr).0steps r* zQOsPathInjectionRegressionTest.test_create_top_level_directory..s<<<$<<zOOsPathInjectionRegressionTest.test_create_top_level_directory..s AaDr,)keyrrr) rrrrKr2rsortedr!walkr7lenzip)r) top_level_direxpectedresultentryexpected_entrys r*test_create_top_level_directoryz=OsPathInjectionRegressionTest.test_create_top_level_directoryvs<  // >>??? ""=111 ..s33444 ..}==>>> ""7]#:;;; ##Om$CDDD ##$6$FGGG ""7]#:;;; ##Om$CDDD3%  D$< $ b9+ & b9l3 4  <<$',,s*;*;<<<..QQQ XF 444%(%:%: B B !E>   ^A.a 9 9 9   ^A.uQx0@0@ A A A   ^A.uQx0@0@ A A A A B Br,N)rrr__doc__r+r0r&rr,r*r r csP888BBBBBr,r c2eZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zejejd kddZejeejd ddZdZdZdZdZdZdZdZdZejej dkp ejdkde!j"ej#ddid Z$ejej dkd!e!j"ej#d"d#id$Z%e!j"ej#id%&d'Z&eje'j(pe'j)d(d)Z*d*Z+d+Z,d,Z-d-Z.d.Z/d/Z0d0Z1d1Z2d2Z3d3Z4d4Z5d5Z6d6Z7d7Z8d8Z9d9Z:d:Z;d;Z<ejejdd?Z=ejejddBS)CFakePathModuleTestctjd|_tj|j|_|jj|_dSN!r)rrrrr r!rDr(s r*r+zFakePathModuleTest.setUps:)8LLL&t77GL r,c||j_d}|jj|z}|j||||j||||j||||jd|zdS)Nrz..!%s)rrJrBrr7rDabspathr) is_windowsfilenamer.s r* check_abspathz FakePathModuleTest.check_abspaths(2%//(: ##G,,, $)"3"3G"<"<=== $)"3"3H"="=>>> $)"3"3Gh4F"G"GHHHHHr,c2|ddSNTr0r2r(s r*test_abspath_windowsz'FakePathModuleTest.test_abspath_windowss d+++++r,c2|ddS)r(s r*test_abspath_bytes_windowsz-FakePathModuleTest.test_abspath_bytes_windowss   D 11111r,c2|ddS)NFr5r@r(s r*test_abspath_bytes_posixz+FakePathModuleTest.test_abspath_bytes_posixs   E 22222r,cRd}||jj}|jj}||d}|j||j||||j |jj |||j d||j ||d|j |ddS)zabspath should correctly handle relative paths from a non-! directory. This test is distinct from the basic functionality test because fake_filesystem has historically been based in !. !foo!bar!bazr..rN) splitrDseprrBrr!rTr7r.curdirjoin)r)r1file_componentsrbasedirs r*.test_abspath_deals_with_relative_non_root_pathzAFakePathModuleTest.test_abspath_deals_with_relative_non_root_paths ""..77O1 4 244 ##H---  g $)"3"3DI4D"E"EFFF DI$5$5d$;$;<<<  INN7OA$6 7 7 I  oa0 1 1     r,cJd|j_d|j_|d|jd|d|jd|d|jddS)NTC:!foo C:!foo!barrzC:bar!foo!bar)rrJrr7rDr.r(s r*"test_abs_path_with_drive_componentz5FakePathModuleTest.test_abs_path_with_drive_components(,%& ty'8'8'?'?@@@ ty'8'8'A'ABBB ty'8'8'D'DEEEEEr,cd|j_||jd||jd||jd||jdd|j_||jd||jdt jdkr\||jd||jddS||jd||jddS)NFrOsC:!foor,!Tr~)rrJrrDisabsr2sys version_infor(s r*test_isabs_with_drive_componentz2FakePathModuleTest.test_isabs_with_drive_componentsx(-% 22333 33444  ,,---  --...(,%  11222   22333  g % % OODIOOC00 1 1 1 OODIOOD11 2 2 2 2 2   TY__S11 2 2 2   TY__T22 3 3 3 3 3r,cd}d}d}|t5|jddddn #1swxYwY|t5|jddddn #1swxYwY|d|j||d|j|||d|z|j|||d|j||dS) Nz !path!to!fooz !path!to!barz!some!where!elserlz path!to!fooz..!fooz ..!..!..%sr)rZ ValueErrorrDrelpathr7)r)path_foopath_bar path_others r* test_relpathzFakePathModuleTest.test_relpaths!!'   z * * $ $ I  d # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $   z * * " " I  b ! ! ! " " " " " " " " " " " " " " "  (9(9((C(CDDD 49#4#4Xx#H#HIII  : %ty'8'8X'N'N    di//(CCDDDDDs#AA A -BBBcd|j_|jd|jdd|d|jjd|d|jjd|j d|d|jjddS)NFz!george!washington!bridgez!first!presidentz!george!washingtonz!first!president!bridgebridge) rrJrrr7r!rDr.realpathrTr(s r*test_realpath_vs_abspathz+FakePathModuleTest.test_realpath_vs_abspaths(-% ##$?@@@ &&'9;OPPP  % GL !: ; ;     ' GL ! !"; < <     ())) 4dgl6K6KH6U6UVVVVVr,)rVrz'strict' new in Python 3.10c|jd|jj}|d|j_||d|jjdd|tj 5|jjdddddn #1swxYwY||d|jjd ddS) NrQrfoo!bazr FstrictTfoo!barr) rrrBrr7r!rDrdr`rar-rEs r*test_realpath_strictz'FakePathModuleTest.test_realpath_strictsC ##J///?0!)...  $',"7"7e"7"L"L    ! !%, / / 6 6 GL ! !% ! 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6  $',"7"7d"7"K"K     s "B;;B?B? ALLOW_MISSINGz8ALLOW_MISSING has been added in different patch versionsc8|jd}|jj}|d|j_||d|jjdt jjts|j |jd| tj 5|jj|jt jjddddS#1swxYwYdSdS)NrQrrgr rhr)rrrBrr7r!rDrdrlr chmodr`raro)r)rrFs r*test_realpath_allow_missingz.FakePathModuleTest.test_realpath_allow_missings^ O ' ' 3 3?0!)...  GL ! !%0E ! F F   yy L GMM!&! $ $ $%%el33 L L %%afRW5J%KKK L L L L L L L L L L L L L L L L L L L Ls 6D  DDcd}d}|j||j|||j||||j||||j|d||j|ddS)NrEz !foo!bar!booz!foo!..!foo!bar!..!bar!bazs!foo!..!foo!bar!..!bar!baz)rrr2rDsamefiler)r) file_path1 file_path2s r* test_samefilez FakePathModuleTest.test_samefile s# #  ##J/// ##J///  **:zBBCCC ++J CCDDD  **:7STTUUU  **:7TUUVVVVVr,cPd}d}|j|||j|||j|||jddS)N foo!bar!baz foo!bar!bazz!some!other!bogus!path)rrr2rDrrr)rfile_path_bytess r*rzFakePathModuleTest.test_exists*s! ( ##I...  ((33444  ((99::: ))*BCCDDDDDr,ctj|j_|jd||jd||jd||jd||jd||jd||jddS)NzF:C:zc:\zf:zF:\zZ:zz:\) r WINDOWSrr!add_mount_pointr2rDrrr(s r*test_exists_with_drivez)FakePathModuleTest.test_exists_with_drive2s#^ ''---  ((..///  ((00111  ((..///  ((00111 ))$//000 ))&1122222r,cnd}d}|jd|j|d||j|||j|||j|||j||jd||j|dS)Nrvrwrjbogusz foo!bar!bogus) rrKrr2rDlexistsrrrrxs r* test_lexistszFakePathModuleTest.test_lexists<s! ( ""9--- &&y':::  )))44555  ))/::;;; )))44555 ))/::;;; ##O444  ((3344444r,cd|j_|d|jd|d|jd|d|jd|d|jd |d |jd |d |jd |d|jddS)NTc:!foo c:!foo!barc:!c:!foo!foorQrT!fooc:foo c:foo!barc:c:foorrj)rrJr7rDrvr(s r*test_dirname_with_drivez*FakePathModuleTest.test_dirname_with_driveHs(,% 49#4#4\#B#BCCC !2!29!=!=>>> !2!2:!>!>??? ty0099::: $)"3"3K"@"@AAA  1 1( ; ;<<<  1 1) < <=====r,cld}|||jd|zdS)Nrjz%s!baz)r7rDrv)r)rvs r* test_dirnamezFakePathModuleTest.test_dirnameRs8 $)"3"3Hw4F"G"GHHHHHr,cTgd}|d|jj|dS)N)rrr rvr7rDrJr) componentss r*test_join_stringsz$FakePathModuleTest.test_join_stringsVs4***    (CDDDDDr,cTgd}|d|jj|dS)N)r<barbazrwrrs r*test_join_bytesz"FakePathModuleTest.test_join_bytesZs4---  )DEEEEEr,win32rVzWindows specific test USERPROFILEz C:\Users\Johncb||jdddS)N~z C:!Users!Johnr7rD expanduserr(s r*test_expand_user_windowsz+FakePathModuleTest.test_expand_user_windows^s0 --c22ODDDDDr,zPosix specific testHOMEz /home/johncb||jdddS)Nrz !home!johnrr(s r*test_expand_userz#FakePathModuleTest.test_expand_useres0 --c22LAAAAAr,T)clearc`||jddS)z8Make sure this also works without HOME / USERPROFILE setrN)r2rDrr(s r*$test_expand_user_no_home_environmentz7FakePathModuleTest.test_expand_user_no_home_environmentjs,  ,,S1122222r,zonly tested on unix systemsctjdkrd}nd}||jd|dS)Ndarwinz !var!rootz!rootz~root)rXplatformr7rDr)r)roothomes r*test_expand_rootz#FakePathModuleTest.test_expand_rootqsI <8 # #"HHH --g66AAAAAr,cd}|tj5|j|ddddS#1swxYwYdS)Nrv)rZr!rrDrr s r*test_getsize_path_nonexistentz0FakePathModuleTest.test_getsize_path_nonexistent|s!   rx ( ( ) ) I  i ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) )sA  AAcd}|j||d|j|dS)Nrvrrr s r*test_getsize_file_emptyz*FakePathModuleTest.test_getsize_file_emptysI!  ##I... DI--i8899999r,cd}d}|j|d|d|j||d|j|dS)Nrvrwrrrrrxs r*test_getsize_file_non_zero_sizez2FakePathModuleTest.test_getsize_file_non_zero_sizesy! ( ##I #BBB DI--i88999 DI--o>>?????r,cd}|j||j|}|t |dkd|zdS)Nrjr&expected non-negative size; actual: %s)rrKrDrrintr)rNrcs r*test_getsize_dir_emptyz)FakePathModuleTest.test_getsize_dir_emptys_ ""8,,,y  ** TQ(PSW(WXXXXXr,cd}|j|j|d|j|}|t |dkd|zdS)Nrjr rr)rrrArDrrrrs r*test_getsize_dir_non_zero_sizez1FakePathModuleTest.test_getsize_dir_non_zero_sizesq ##DO$=$=h$N$NOOOy  ** TQ(PSW(WXXXXXr,c|jd||jd||jd||jd||jddS)Nrjrr< it_dont_exist)rrr2rDrrr(s r* test_isdirzFakePathModuleTest.test_isdirs ##I...  ..///  //000 33444 99:::::r,c|jd||jd||jd||jd||jd|jjd|j_||jd||jd||jddS)NrErrQrrjr)rrr2rDrrBrr(s r*test_isdir_with_cwd_changez-FakePathModuleTest.test_isdir_with_cwd_changes ##N333  //000   33444  ..///   22333!%!>CCC  //000   33444  ../////r,c|jd||jd||jd||jd||jddS)Nrjrfoo!barr)rrrrDrr2r(s r* test_isfilezFakePathModuleTest.test_isfiles ##I... ))%00111  ((33444  ((44555 ))/::;;;;;r,c\|jd}|d|jdd|_|d|jd|d|jddS)Nz foo!bar1.txtrs foo!bar1.txt)rrrrDrrr7rs r*rz!FakePathModuleTest.test_get_mtimesO//??  B 2 2> B BCCC  TY//??@@@ TY//@@AAAAAr,c||jd|tj5|jdddddS#1swxYwYdS)Ndoes_not_exist)rrDrr`rar-rr(s r*test_get_mtime_raises_os_errorz1FakePathModuleTest.test_get_mtime_raises_os_errors ))*:;;<<<  ! !%, / / 1 1 I  / 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s A55A9<A9ct|jd|jd|jdd||jd||jd||jd||jd||jd||jd||jd||jddS)Nrzfoo!regular_filezfoo!link_to_file regular_filesfoo!link_to_filer) rrKrrrrDislinkr2rr(s r* test_islinkzFakePathModuleTest.test_islinksl ""5))) ##$6777 &&'9>JJJ ))%00111  (();<<===  (();<<===  (()<==>>>  (()<==>>>  (();<<=== ))*<==>>> ))/::;;;;;r,cd|j_|jd|jdd||jddS)NFrrjzfoo!Bar)rrrKrr2rDrr(s r*test_is_link_case_sensitivez.FakePathModuleTest.test_is_link_case_sensitivesb,1) ""5))) &&y%888  ((3344444r,c||jd||jd||jd||jd|jd||jd||jd||jddS)Nrlr,rT!mount!!mounts!mount)rrDismountr2rr}r(s r* test_ismountzFakePathModuleTest.test_ismounts **2..///  ))#..///  ))$//000 **955666 ''111  ))(33444  )))44555  )))4455555r,cnd|j_||jd||jd||jd||jd|jd||jd||jddS)NTr,c:!c:zz:!rr)rrJr2rDrrr}r(s r*test_ismount_with_drive_lettersz2FakePathModuleTest.test_ismount_with_drive_letterss(,%  ))#..///  ))%00111 **400111  ))%00111 ''111  ))(33444  )))4455555r,cd|j_||jd||jd||jd||jd||jddS)NTz!!a!z!!a!bz!!a!b!z!a!b!z!!a!b!c)rrJr2rDrrr(s r*test_ismount_with_unc_pathsz.FakePathModuleTest.test_ismount_with_unc_pathss(,%  ))&11222  ))'22333  ))(33444 **733444 **95566666r,cd|j_|jd||jd||jd||jdd|j_||jddS)Nr,rrz!mount!!TzZ:!)ralternative_path_separatorr}r2rDrrJr(s r**test_ismount_with_alternate_path_separatorz=FakePathModuleTest.test_ismount_with_alternate_path_separators582 ''111  ))(33444  )))44555  ))*55666(,%  ))%0011111r,c:|t|jddd}tjdkr |jrd}nd}|r)|t|j|d|t|jddS) z(Forwards any non-faked calls to os.path.rHzGet a faked os.path functionN)rVrs _get_bothseps_join_real_pathz;Get a real os.path function not implemented in fake os.path nonexistent)r2hasattrrDrXrYr0r)r)private_path_functions r*$test_getattr_forward_to_real_os_pathz7FakePathModuleTest.test_getattr_forward_to_real_os_paths  5113QRRR $  f $ $ :(7%%(9%   OO #899M    M::;;;;;r,c2d|j_|d|jd|d|jd|d|jddS)NF)rlrlrjrj)rlr,rjrQ)rl!!zfoo!!bar !!foo!!bar)rrJr7 splitrootr(s r*test_splitroot_posixz'FakePathModuleTest.test_splitroot_posixs(-% ,do.G.G .R.RSSS -t/H/H/T/TUUU  "DO$=$=l$K$K     r,rUzIntroduced in Python 3.13zPosix specific behaviorcn||jd||jd||jd||jddSNz!devr,COM1znul.txt)rr isreservedr(s r*test_is_reserved_posixz)FakePathModuleTest.test_is_reserved_posixs 33F;;<<< 33C88999 33F;;<<< 33I>>?????r,zWindows specific behaviorcn||jd||jd||jd||jddSr)rrrr2r(s r*test_is_reserved_windowsz+FakePathModuleTest.test_is_reserved_windowss 33F;;<<< 33C88999 226::;;; 229==>>>>>r,N)?rrrr+r2r7r:r>rArCrMrRrZrareunittestskipIfrXrYrkrr!rDrortrr~rrrrrrrdictenvironrrrr r0 is_cygwinrrrrrrrrrrrrrrrrrrrrrrr,r*r)r)s!!! III,,,---HHH222333   (FFF444 E E E W W WX_S%/1NOO   PO  X_ GBG_ - --B L L  LWWWEEE333 5 5 5>>>IIIEEEFFFX_ <3#3f#<>UUZ ],<=>>EE?>EX_S\W,.CDDUZ V\233BB43EDBUZ Bd+++33,+3 X_1x1%BB B))) ::: @@@YYYYYY;;; 0 0 0<<<BBB111 <<<$555666666777222<<<    X_S%/1LMMX_X(*CDD@@EDNM@ X_S%/1LMMX_,,.IJJ??KJNM???r,r)ceZdZdZdS)PathManipulationTestBasec:tjd|_dS)N|rrrrr(s r*r+zPathManipulationTestBase.setUp(s)8LLLr,N)rrrr+rr,r*rr's(MMMMMr,rcTeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd S)CollapsePathPipeSeparatorTestzKTests CollapsePath (mimics os.path.normpath) using | as path separator.cb|d|jddS)Nrrlr7rnormpathr(s r* test_empty_path_becomes_dot_pathz>CollapsePathPipeSeparatorTest.test_empty_path_becomes_dot_path0s. do66r::;;;;;r,cb|d|jddSrrr(s r*test_dot_path_unchangedz5CollapsePathPipeSeparatorTest.test_dot_path_unchanged3. do66s;;<<<<%>t%D%DEEEEEr,cb|d|jddS)zMTests that '/' is not treated specially if the path separator is '|'.)rla/brNrr(s r*test_slashes_do_not_splitz'SplitPathTest.test_slashes_do_not_splitgs0 do&?&?&F&FGGGGGr,c|d|jd|d|jd|d|jd|d|jd|d|jd dS) N)ryba|bza|||b)|ar |a||b)r!ca|b|c)z|a|br$z|a|b|crr(s r*,test_eliminate_trailing_separators_from_headz:SplitPathTest.test_eliminate_trailing_separators_from_headls T_%>%>u%E%EFFF T_%>%>w%G%GHHH do&?&?&H&HIII t'@'@'I'IJJJ (A(A((K(KLLLLLr,c|d|jd|d|jd|d|jddS)N)|||rlr()rryr")r(ryz|||arr(s r*#test_root_separator_is_not_strippedz1SplitPathTest.test_root_separator_is_not_strippedssz do&?&?&F&FGGG T_%>%>t%D%DEEE t'@'@'H'HIIIIIr,cb|d|jddS)N)r!rla|b|rr(s r*)test_empty_tail_if_path_ends_in_separatorz7SplitPathTest.test_empty_tail_if_path_ends_in_separatorxs. do&?&?&G&GHHHHHr,cb|d|jddS)N)r#r$z|a||b||crr(s r*0test_empty_path_components_are_preserved_in_headz>SplitPathTest.test_empty_path_components_are_preserved_in_head{s. )B)B:)N)NOOOOOr,N) rrrr'rrrr&r)r,r.rr,r*rr]s""BBBFFFHHH MMMJJJ IIIPPPPPr,rcHeZdZdZdZdZdZdZdZdZ dZ d Z d Z d S) JoinPathTestzETests JoinPath (which mimics os.path.join) using | as path separator.cb|d|jddSrr7rrAr(s r*test_one_empty_componentz%JoinPathTest.test_one_empty_components. T_66r::;;;;;r,cf|d|jddddSrr2r(s r*test_multiple_empty_componentsz+JoinPathTest.test_multiple_empty_componentss2 T_66r2rBBCCCCCr,cb|d|jddS)Nz||a||r2r(s r*2test_separators_not_stripped_from_single_componentz?JoinPathTest.test_separators_not_stripped_from_single_components. $/";";G"D"DEEEEEr,c h|d|jdddddS)Nza|b|c|dryr r$dr2r(s r*+test_one_separator_added_between_componentsz8JoinPathTest.test_one_separator_added_between_componentss4 DO$=$=c3S$Q$QRRRRRr,c|d|jddd|d|jddddS)Nr%a|b|r$z a|||b|||cza|||zb|||r2r(s r*:test_no_separator_added_for_components_ending_in_separatorzGJoinPathTest.test_no_separator_added_for_components_ending_in_separators] $/";";D$"L"LMMM do&?&?PS&T&TUUUUUr,c h|d|jdddddS)Nz|c|dryz|bz|cr9r2r(s r*8test_components_preceding_absolute_component_are_ignoredzEJoinPathTest.test_components_preceding_absolute_component_are_ignoreds4 !:!:3dC!P!PQQQQQr,c|d|jdd|d|jddddS)Nr<ryrlr2r(s r*6test_one_separator_added_for_trailing_empty_componentszCJoinPathTest.test_one_separator_added_for_trailing_empty_componentssZ t88bAABBB t88b"EEFFFFFr,cd|d|jdddS)Nryrlr2r(s r*4test_no_separator_added_for_leading_empty_componentszAJoinPathTest.test_no_separator_added_for_leading_empty_componentss0 do77C@@AAAAAr,c|d|jddd|d|jddddS)Nr!ryrlr r+r<r=r2r(s r*&test_internal_empty_components_ignoredz3JoinPathTest.test_internal_empty_components_ignoreds\  9 9#r3 G GHHH !:!:4T!J!JKKKKKr,N) rrrr'r3r5r7r:r>r@rBrDrFrr,r*r0r0sOO<<<DDDFFFSSSVVVRRRGGGBBBLLLLLr,r0ceZdZdZdS)PathSeparatorTestctjd}tj|}|d|j|d|jjdSr+)rrrr r7rHrD)r)rrs r*2test_os_path_sep_matches_fake_filesystem_separatorzDPathSeparatorTest.test_os_path_sep_matches_fake_filesystem_separators`$33GGG  -j99 n0111 n1566666r,N)rrrrJrr,r*rHrHs#77777r,rHcfeZdZdZdZdZdZeje j ddZ dS)NormalizeCaseTestcRtjd|_d|j_dSr)rrrrr(s r*r+zNormalizeCaseTest.setUps')8LLL,1)))r,c&|jd||jjd|jd||jjd|jddS)Nrrrz/FOO/BAR)rrr7rB_original_pathr(s r*test_normalize_casez%NormalizeCaseTest.test_normalize_cases ##J/// , 5 5 5 O * *: 6 6    , 5 5 5 O * *: 6 6     r,c d|j_|jd|d|jd|d|jddS)NTz C:/Foo/Barz c:/foo/barz C:/FOO/BAR)rrJrr7rOr(s r*test_normalize_case_for_drivez/NormalizeCaseTest.test_normalize_case_for_drivest(,% ##L111 t'E'El'S'STTT t'E'El'S'STTTTTr,c&|jd||jjd|jd||jjd|jddS)Nrz Foo/Bar/bazrRz Foo/Bar/BAZz /FOO/BAR/BAZ)rrKr7rBrOr(s r*)test_normalize_case_for_non_existing_filez;NormalizeCaseTest.test_normalize_case_for_non_existing_files "":... , 9 9 9 O * *> : :    , 9 9 9 O * *> : :     r,z(Regression test for Windows problem onlyctj}tjtjtjtd}||tj |d}| || | dS)Nr __init__.py) rrr!rDrGrvr.__file__add_real_directoryrJr7rOupper)r)r real_dir_path initPyPaths r*/test_normalize_case_for_lazily_added_empty_filezANormalizeCaseTest.test_normalize_case_for_lazily_added_empty_files %355  bgoobgooh6O6O&P&PQQRST %%m444W\\-??  Z%>%>z?O?O?Q?Q%R%RSSSSSr,N) rrrr+rPrRrTrrr r0r\rr,r*rLrLs222    UUU    X_  !KTTTTTr,rLc2eZdZdZdZdZdZdZdZdS)AlternativePathSeparatorTestcRtjd|_d|j_dS)Nr,r?)rrrrr(s r*r+z"AlternativePathSeparatorTest.setUps')8LLL58222r,ctj}|jr|d|jn||jtjd}||jdSr)rrr0r7r assertIsNoners r*test_initial_valuez/AlternativePathSeparatorTest.test_initial_values~$355 ? E   S*"G H H H H   jC D D D$33GGG  *?@@@@@r,ctj|j}|d|j|d|jjdS)Nr`)rr rr7altseprD)r)rs r* test_alt_sepz)AlternativePathSeparatorTest.test_alt_sepsO -do>> n3444 n1899999r,cb|d|jddS)NrQz !foo??barrr(s r*(test_collapse_path_with_mixed_separatorszEAlternativePathSeparatorTest.test_collapse_path_with_mixed_separatorss. T_%=%=k%J%JKKKKKr,cd}||jjd|j|dS)Nz foo?..?barrrrs r*)test_normalize_path_with_mixed_separatorszFAlternativePathSeparatorTest.test_normalize_path_with_mixed_separatorssM , 1 1 1 O ' ' - -     r,c"|jd|jd||jd||jddS)Nz ?foo?bar?bazz!foo!bar!xyzzy!plughrEz?foo?bar?xyzzy?plugh)rrr2rr(s r*!test_exists_with_mixed_separatorsz>AlternativePathSeparatorTest.test_exists_with_mixed_separatorssz ##N333 ##$:;;; ..~>>??? ../EFFGGGGGr,N) rrrr+rcrfrhrjrlrr,r*r^r^sy999AAA::: LLL   HHHHHr,r^ceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdS)DriveLetterSupportTestcjtjd|_d|j_d|j_dS)Nr,r^T)rrrrrJr(s r*r+zDriveLetterSupportTest.setUps1)8LLL582(,%%%r,ctj}|jr||jdS||jdSr.)rrr0r2rJrrs r*rcz)DriveLetterSupportTest.test_initial_valuesR$355 ? 7 OOJ4 5 5 5 5 5   Z5 6 6 6 6 6r,cb|d|jddS)Nrz c:!!foo!!barrr(s r*test_collapse_pathz)DriveLetterSupportTest.test_collapse_paths. t'?'?'O'OPPPPPr,cb|d|jddS)N !!foo!bar!bazz!!foo!bar!!baz!!rr(s r*test_collapse_unc_pathz-DriveLetterSupportTest.test_collapse_unc_path s/ $/*B*BCU*V*VWWWWWr,cd|j_|d|jdd|j_|d|jddS)Nrlrz c:!foo!!barrrrr(s r*test_normalize_path_strz.DriveLetterSupportTest.test_normalize_path_strsh  t'B'B='Q'QRRR& t'B'B5'I'IJJJJJr,cd|j_|d|jdd|j_|d|jddS)Nr, c:!foo!bars c:!foo!!barrrrr(s r*test_normalize_path_bytesz0DriveLetterSupportTest.test_normalize_path_bytessh! (C(CN(S(STTT' (C(CF(K(KLLLLLr,c|d|jd|d|jd|d|jd|d|jd|d |jd |d |jd |d |jddS)N)rrr)rrr)rrrQ)r,rr)rrr)rrrrrrjrr(s r*test_split_path_strz*DriveLetterSupportTest.test_split_path_strs *DO,E,El,S,STTT )B)B8)L)LMMM $/*C*CJ*O*OPPP t'@'@'H'HIII )4?+D+D[+Q+QRRR (A(A'(J(JKKK )B)B9)M)MNNNNNr,c.|d|jd|d|jd|d|jd|d|jd|d|jd |d|jd dS) N)za^br$za^b^c)za^b!cr9za^b!c^dza^b!c!d)sa^bcsa^b^c)sa^b!cdsa^b!c^dsa^b!c!drr(s r*test_split_with_alt_separatorz4DriveLetterSupportTest.test_split_with_alt_separator#s t'@'@'I'IJJJ )B)B9)M)MNNN )B)B9)M)MNNN )B)B8)L)LMMM )4?+D+DZ+P+PQQQ )4?+D+DZ+P+PQQQQQr,c|d|jd|d|jd|d|jd|d|jd|d |jd |d |jd |d |jddS)N)rrrz)rr<r)rr!foo!bar)rTr<r)rrs c:foo!bar)rr<r)r<rrrr(s r*test_split_path_bytesz,DriveLetterSupportTest.test_split_path_bytes+s ,do.G.G .V.VWWW )4?+D+DY+O+OPPP *DO,E,Ek,R,RSSS )B)B7)K)KLLL +T_-F-F|-T-TUUU $/*C*CH*M*MNNN )4?+D+DZ+P+PQQQQQr,cf|d|jddddS)Nzc:dr rr9r2r(s r*1test_characters_before_root_ignored_in_join_pathszHDriveLetterSupportTest.test_characters_before_root_ignored_in_join_paths4s2  9 9#tS I IJJJJJr,cb|d|jddS)NrP)r7rrr(s r*rz(DriveLetterSupportTest.test_resolve_path7s. t'C'CL'Q'QRRRRRr,c|gd|jd|dg|jddS)N)rrrrrrr(s r*test_get_path_componentsz/DriveLetterSupportTest.test_get_path_components:sf  O , ,\ : :    $!A!A$!G!GHHHHHr,cv|d|jd|d|jd|d|jd|d|jddS) N)rrQr)rlrQrQ)rrjr)rlrjrjr7r splitdriver(s r*test_split_drive_strz+DriveLetterSupportTest.test_split_drive_strAs +T_-G-G -U-UVVV )4?+E+Ej+Q+QRRR *DO,F,F{,S,STTT $/*D*DY*O*OPPPPPr,c|d|jd|d|jddS)N)rrrz)r,rrrr(s r*test_split_drive_bytesz-DriveLetterSupportTest.test_split_drive_bytesGs^  $/"<"<]"K"K    +T_-G-G -T-TUUUUUr,c.|d|jd|d|jd|d|jd|d|jd|d |jd |d |jd dS) N)rz^foo^barz c:^foo^bar)rlfoo^barr)rl foo^bar!bazr)r^foo^bars c:^foo^bar)r,rr)r, ^foo^bar!bazrrr(s r*test_split_drive_alt_sepz/DriveLetterSupportTest.test_split_drive_alt_sepMs +T_-G-G -U-UVVV $/*D*DY*O*OPPP ,do.H.H.W.WXXX  $/"<"<]"K"K    +T_-G-G -T-TUUU  "DO$>$>$O$O     r,cv|d|jd|d|jd|d|jd|d|jddS) N) !!foo!bar!bazru)rl!!foor)rlrr)rr !!foo!bar!!rr(s r*test_split_drive_with_unc_pathz5DriveLetterSupportTest.test_split_drive_with_unc_pathY  !4?#=#=o#N#N    (B(B7(K(KLLL +T_-G-G -U-UVVV ,do.H.H.W.WXXXXXr,cv|d|jd|d|jd|d|jd|d|jddS) N) ^^foo^barrz ^^foo^bar!baz)rl^^foor)rl ^^foo^^barr)rz^^ ^^foo^bar^^rr(s r*&test_split_drive_with_unc_path_alt_sepz=DriveLetterSupportTest.test_split_drive_with_unc_path_alt_separr,c|d|jd|d|jd|d|jd|d|jd|d |jd dS) N)d:!foor  d:!foo!baz)rrlz d:!foo!baz!rrlr)rrlr)c:!!rlrrr(s r*test_split_path_with_drivez1DriveLetterSupportTest.test_split_path_with_drivei *DO,E,El,S,STTT +T_-F-F}-U-UVVV T_%>%>t%D%DEEE do&?&?&F&FGGG t'@'@'H'HIIIIIr,c|d|jd|d|jd|d|jd|d|jd|d |jd dS) N)zd:^foor  d:^foo^baz)rrlz d:^foo^baz^rr)c:^rlr)c:^^rlrrr(s r*"test_split_path_with_drive_alt_sepz9DriveLetterSupportTest.test_split_path_with_drive_alt_sepprr,c|d|jd|d|jd|d|jddS)N) !!foo!bar!r ru)rrlr)rrlrrr(s r*test_split_path_with_unc_pathz4DriveLetterSupportTest.test_split_path_with_unc_pathw  !4?#<#<_#M#M    *DO,E,Ek,R,RSSS ,do.G.G .V.VWWWWWr,c|d|jd|d|jd|d|jddS)N)z ^^foo^bar^r  ^^foo^bar^baz)rrlr)rrlrrr(s r*%test_split_path_with_unc_path_alt_sepz.create_too_large_files=#?? 34 3*q.1222 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3sAA Arrrrrry) rr}rZrRr7get_disk_usageusedrr)r)rrrs` @r* test_disk_usage_on_file_creationz.DiskSpaceTest.test_disk_usage_on_file_creations  *555 3 3 3 3 3 3  w ' ' $ $ ! ! # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ DG228<<ABBB YY}cFY ; ; )t JJsZ' ( ( ( ) ) ) ) ) ) ) ) ) ) ) ) ) ) ) TW%;%;H%E%E%JKKKKKs$ AAA-CCCcpd|j_|jd|jdd|d|jdjd |j_|d|jd jdS) NTrrrQrrrzD:!zE:!foor)rrJresetrr7rrrr(s r*$test_disk_usage_on_automounted_drivez2DiskSpaceTest.test_disk_usage_on_automounted_drives $   %%% J333 DG22599>???  DG226::?@@@@@r,c|jdd|jdd|jdd|jd d |jd d |d|jd j|d |jdj|d |jdj|d|jdjdS)NrrrrQirrr!foo!bazrrErr,)rr}rr7rrtotalr(s r* test_disk_usage_on_mounted_pathsz.DiskSpaceTest.test_disk_usage_on_mounted_pathss3 3777  s;;; FB/// J333 NC888 TW33C88=>>> TW33F;;@AAA dg44Z@@EFFF dg44Z@@FGGGGGr,ctjdd}|dd|d|dS)Nr,drr r)rrlZ)rrrr7rrs r*/test_file_system_size_after_large_file_creationz=DiskSpaceTest.test_file_system_size_after_large_file_creationss$3+C    z3JKKK    % % ' '      r,c|jdd|d|jdS)NrQxyzzyr)r_rrr7rr(s r*0test_file_system_size_after_binary_file_creationz>DiskSpaceTest.test_file_system_size_after_binary_file_creationsG J::: tw'='='?'?@@@@@r,c|jdd|d|jdS)NrQ complicatedr)r Yrr(s r*6test_file_system_size_after_ascii_string_file_creationzDDiskSpaceTest.test_file_system_size_after_ascii_string_file_creationsG J??? (>(>(@(@AAAAAr,c|jddd|d|jdS)NrQu сложноutf-8rr)r Xrr(s r*6test_filesystem_size_after_2byte_unicode_file_creationzDDiskSpaceTest.test_filesystem_size_after_2byte_unicode_file_creationsI J'RRR (>(>(@(@AAAAAr,c|jddd|d|jdS)NrQu複雑rr)rrs^rr(s r*6test_filesystem_size_after_3byte_unicode_file_creationzDDiskSpaceTest.test_filesystem_size_after_3byte_unicode_file_creationsI JGLLL tw'='='?'?@@@@@r,c|jdd|jdd|jd|d|jdS)NrQrrrrr)rrPrrr0r7rr(s r*)test_file_system_size_after_file_deletionz7DiskSpaceTest.test_file_system_size_after_file_deletionsx J::: J333 j))) (>(>(@(@AAAAAr,c<|jdd|jdd|jdd|jd|d |jdS) NrQrrrr !foo1!barrr)rrrrr(s r*-test_file_system_size_after_directory_removalz;DiskSpaceTest.test_file_system_size_after_directory_removals J333 J333 K444 f%%% (>(>(@(@AAAAAr,c2|j} |jddn%#t$r|dYnwxYw||jdz|jjdS)NrQdaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar@File with contents fitting into disk space could not be written.rrrrrRfailr7rr) initial_usages r*'test_creating_file_with_fitting_contentz5DiskSpaceTest.test_creating_file_with_fitting_contents..00   G   Z  @ @ @ @    IIR       +c1473I3I3K3K3PQQQQQ8AAcfd}j}t5|dddn #1swxYwY|jdS)Nc@jdddS)NrQseaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaarrrr(sr*create_large_filezRDiskSpaceTest.test_creating_file_with_content_too_large..create_large_files$ G   Z  @ @ @ @ @r,rrrZrRr7)r)rrs` r*)test_creating_file_with_content_too_largez7DiskSpaceTest.test_creating_file_with_content_too_larges A A A A A..00   w ' '                      (>(>(@(@AAAAA AAAc2|j} |jddn%#t$r|dYnwxYw||jdz|jjdS)NrQrrz.create_large_file&s$ G   C  8 8 8 8 8r,r)r)rrs` r*&test_creating_file_with_size_too_largez4DiskSpaceTest.test_creating_file_with_size_too_large#s..00  9 9 9 9 9  w ' '                      (>(>(@(@AAAAArc|jdd} |d|ddS#t$r|dYdSwxYw)NrQrrrrz8Resizing file failed although disk space was sufficient.)rrrr{rRrr) file_objects r*"test_resize_file_with_fitting_sizez0DiskSpaceTest.test_resize_file_with_fitting_size.sg))*b)AA  R  + +C 0 0 0  $ $Z 0 0 0 0 0 R R R IIP Q Q Q Q Q Q Rs*A A-,A-cp|jdd}|tj5|ddddn #1swxYwY|tj5|dddddS#1swxYwYdS)NrQrrrږaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)rrr`rarbrr{rs r*$test_resize_file_with_size_too_largez2DiskSpaceTest.test_resize_file_with_size_too_large6s)g))*b)AA  ! !%, / / 1 1  + +C 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1  ! !%, / / 0 0  $ $Y / / / 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s#AA"%A"B++B/2B/c|jdd|jdd|d|jjdS)NrQrrrrrrr!renamer7rrr(s r*,test_file_system_size_after_directory_renamez:DiskSpaceTest.test_file_system_size_after_directory_rename=s` J333 vv&&& TW3355:;;;;;r,c|jdd|jdd|d|jjdS)NrQrrrrr(s r*'test_file_system_size_after_file_renamez5DiskSpaceTest.test_file_system_size_after_file_renameBs` J333 z:... TW3355:;;;;;r,ctd}d}|j|d|d|jj|j|||d|jj|j||d|jj|j||d|jjdS)N test_file1 test_file2rrr)rrr7rrr!linkunlink)r) file1_path file2_paths r*-test_that_hard_link_does_not_change_used_sizez;DiskSpaceTest.test_that_hard_link_does_not_change_used_sizeGs ! !  J333 TW3355:;;;  Z,,, TW3355:;;; z""" TW3355:;;; z""" DG22449:::::r,c|jdd|jd|tj5|jdddddn #1swxYwY|tj5|jdd dddn #1swxYwY |jd d|jdd |jd d dS#t $r|dYdSwxYw)Nz!mount_limitedrrz!mount_unlimitedz!mount_limited!foorr!barrrrz!mount_unlimited!fooi@Br)rr}r`rarbrrRrr(s r*1test_that_the_size_of_correct_mount_point_is_usedz?DiskSpaceTest.test_that_the_size_of_correct_mount_point_is_usedVs  0R@@@  2333  ! !%, / / B B G   4b  A A A B B B B B B B B B B B B B B B  ! !%, / / 5 5 G    4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5  G    3 3 3 G   4b  A A A G   6  H H H H H    IIR       s7A??BB)CCCAD44EEcP|jdd|jdd|jdd|jd d|jd d|d |jd j|d|jd j|d|jdjdS)N!mount1rrz!mount1!bar!mount2rrQrrz!mount1!foo!barz!mount1!bar!mount2!foo!barrr !mount1!foor)rr}rr7rfreer(s r*3test_that_disk_usage_of_correct_mount_point_is_usedzADiskSpaceTest.test_that_disk_usage_of_correct_mount_point_is_usedhs  b999  4DDD J333 -r::: 8"EEE TW33F;;@AAA TW33MBBGHHH TW334HIINOOOOOr,c|jdd|tj5|jdddddn #1swxYwY|jdd|jdd|d|jdj dS) Nr&rrr'rrrrrD) rr}r`rarbrset_disk_usager7rr(r(s r*test_set_larger_disk_sizez'DiskSpaceTest.test_set_larger_disk_sizets  b999  ! !%, / / < < G   s  ; ; ; < < < < < < < < < < < < < < < #I>>> M3777 dg44]CCHIIIIIsA%%A),A)c|jdd|jdd|tj5|jdddddn #1swxYwY|jd d|d|jdj dS) Nr&rrr'rrrr+) rr}rr`rarbr,r7rr(r(s r*test_set_smaller_disk_sizez(DiskSpaceTest.test_set_smaller_disk_size|s  c::: M3777  ! !%, / / B B G " "by " A A A B B B B B B B B B B B B B B B #I>>> TW33MBBGHHHHHsBBBc|jd|jdd|jdd|d|jdjdS)Nr&r'rrr+)rr}rr,r7rr(r(s r* test_disk_size_on_unlimited_diskz.DiskSpaceTest.test_disk_size_on_unlimited_disks}  *** M3777 $Y??? dg44]CCHIIIIIr,cd|j_|jdd|jdd||jdjd dS) NT d:!foo!barrrr2d:r+rr3)rrJrr,r7rr(r(s r*5test_disk_size_on_auto_mounted_drive_on_file_creationzCDiskSpaceTest.test_disk_size_on_auto_mounted_drive_on_file_creationsq $ L#666 $T::: //99>DDDDDr,c`d|j_|jd|jdd|jdd|jdd |d |jd jdS) NTr6zd:!foo!bar!bazrrrr2r7r+i r)rrJrKrr,r7rr(r(s r*:test_disk_size_on_auto_mounted_drive_on_directory_creationzHDiskSpaceTest.test_disk_size_on_auto_mounted_drive_on_directory_creations $ <((( ,c::: L#666 $T::: dg44X>>CDDDDDr,c|jdd}|jd}||j||j|jdS)Nrs somebytesrr)rrr{rr7)r) source_file dest_files r*$test_copying_preserves_byte_contentsz2DiskSpaceTest.test_copying_preserves_byte_contentssjg))%,)GG G''.. {3444 +[-ABBBBBr,c|ddd5}|d|dddn #1swxYwY|d|jddS)Nbar.txtrrrE5E D-! E-D1 1E4D1 5E8 EE E E EE"E=)F33F7:F7c|ddd5}|ddddn #1swxYwY|dd5}||ddddn #1swxYwY|t j5|ddd5}|d|d|t j5|dddn #1swxYwYdddn #1swxYwYdddn #1swxYwY|dd5}||dddddS#1swxYwYdS) Nr@rrrrAzr+rrDrHrKrOrr,r*rrs3444 LLL$AAA H H H    AAABBBBBBAAABBB BBB R R R B B BRRR B B BRRR000<<< <<< ; ; ;$ P P PJJJIIIJJJ EEEEEECCC ::: + + + 1 1 1 1 1 1 1 1r,rcDeZdZdZdZdZdZdZdZdZ dZ d Z d S) MountPointTestc<tjdd|_dSrrr(s r*r+zMountPointTest.setUps$)83   r,c|jd|jd|jddS)Nrr#r)rr}r(s r*add_mount_pointszMountPointTest.add_mount_pointssJ ''/// ''/// '' 33333r,c||d|jdj|d|jdj|d|jdj|d|jdjdS) Nrr,rrrVr#r)rTr7rrLst_devr(s r*0test_that_new_mount_points_get_new_device_numberz?MountPointTest.test_that_new_mount_points_get_new_device_numbers  DO66s;;BCCC DO66v>>EFFF DO66v>>EFFF DO66zBBIJJJJJr,c`||d|jdj|d|jdj|d|jdjdSNrrrrQrVz!foo!baz!foo!bar)rTr7rrKrWr(s r*3test_that_new_directories_get_correct_device_numberzBMountPointTest.test_that_new_directories_get_correct_device_numbers  DO66{CCJKKK DO66zBBIJJJ DO667IJJQRRRRRr,c`||d|jdj|d|jdj|d|jdjdSrZ)rTr7rrrWr(s r*-test_that_new_files_get_correct_device_numberz>> ##J ::: j11:A>>> ..y99:::::r,ct|d}|dd}|j|d|j||||j|||j|dS)Nrrrz symlink testr)rrjrrrr2rrrms r*,test_create_symlink_with_non_existent_parentzBConvenienceMethodTest.test_create_symlink_with_non_existent_parents%'''^^L11 NN=,??  ##J#HHH &&y*=== ..y99::: ..y99:::::r,N)rrrrnrprr,r*rhrhs2 ; ; ;;;;;;r,rhceZdZdZdZdZdZejdZ dZ dZ dZ d Z d Zd Zd)d ZdZdZdZdZdZdZdZdZdZejdZedZdZdZdZdZ dZ!dZ"dZ#d Z$d!Z%d"Z&e'j(e)d ud#e'j(e*j+d$kd%e'j(d&e*j,vd'd(Z-d S)*RealFileSystemAccessTestctj|_tj|j|_t jt jt j td|_ t j|j d|_ dSr) rrrrrr!rDrGrvr.rW pyfakefs_path root_pathr(s r*r+zRealFileSystemAccessTest.setUp+s)8::(5doFFW]]27??27??8;T;T+U+UVV  t'9::1=r,c8tjdd}|t5|j|dddn #1swxYwY||j|dS)N nonexistingtest.txt) r!rDrJrZrRr add_real_filerrr)nonexisting_paths r*&test_add_non_existing_real_file_raisesz?RealFileSystemAccessTest.test_add_non_existing_real_file_raises4s7<< zBB   w ' ' < < O ) )*: ; ; ; < < < < < < < < < < < < < < < //0@AABBBBBsA""A&)A&cd}|tj5|j|dddn #1swxYwY||j|dS)Nz /nonexisting)r`rar-rrXrrrzs r*+test_add_non_existing_real_directory_raiseszDRealFileSystemAccessTest.test_add_non_existing_real_directory_raises:s)  ! !%, / / A A O . ./? @ @ @ A A A A A A A A A A A A A A A //0@AABBBBBsA  A A ct}|j||tj5|j|ddddS#1swxYwYdSr.)rWrrr`rar^ryr)real_file_paths r*test_existing_fake_file_raisesz7RealFileSystemAccessTest.test_existing_fake_file_raises@s! ##N333  ! !%, / / : : O ) ). 9 9 9 : : : : : : : : : : : : : : : : : :r c#6Ktj}tj|d} dD])}tj||}tj|dt tj|ddd5}|d dddn #1swxYwYtj|d }tj|dt tj|d dd5}|d dddn #1swxYwY+|Vtj |d dS#tj |d wxYw) NrCr}T)exist_okrxrrrtestsubsub.txt) ignore_errors) tempfilemkdtempr!rDrJmakedirsrrshutilrmtree)r)temp_directory real_dir_rootdir_namereal_dirrsub_dirs r*create_real_pathsz*RealFileSystemAccessTest.create_real_pathsFs!)++ ^V<<  >* # #7<< x@@ Ht4444GLL:66f$GGFOOO$$$$$$$$$$$$$$$',,x77 Gd3333"',,w ::C&QQQ#UVGGENNN###############    M. = = = = = =FM. = = = = =sUA+F"C8 FC F C A)F5E FE FE  FFc |jtjdddd|jtjdd|5}|j|d||j tjddd||j tjddd||j tjdd d d ||j tjddddddS#1swxYwYdS) NrrCr test1.txtr /rootrHrxrrr rrr!rDrJrKrrXr2rrEs r*-test_existing_fake_directory_is_merged_lazilyzFRealFileSystemAccessTest.test_existing_fake_directory_is_merged_lazilyZs ##BGLLfe[$Q$QRRR ""27<<#>#>???  # # % % Q O . .xW . M M M OO&&rw||FE:'N'NOO    OO&&rw||FE;'O'OPP    OO&&rw||FE5)'T'TUU    OODO2227<<3N3NOO P P P Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q QsE G!!G%(G%c |jtjdddd|jtjdd|5}|j|dd||j tjddd ||j tjddd||j tjdd d d ||j tjddddddS#1swxYwYdS) NrrCrrr rFrH lazy_readrxrrrrrEs r*&test_existing_fake_directory_is_mergedz?RealFileSystemAccessTest.test_existing_fake_directory_is_mergedjs ##BGLLfe[$Q$QRRR ""27<<#>#>???  # # % % Q O . .g /    OO&&rw||FE:'N'NOO    OO&&rw||FE;'O'OPP    OO&&rw||FE5)'T'TUU    OODO2227<<3N3NOO P P P Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q Q QsEG""G&)G&cz|jtjdddd|5}|tj5|j |ddddn #1swxYwYddddS#1swxYwYdS)NrrCrrxrr) rrr!rDrJrr`rar^rXrEs r*%test_fake_files_cannot_be_overwrittenz>RealFileSystemAccessTest.test_fake_files_cannot_be_overwritten|sI ##BGLLfeZ$P$PQQQ  # # % % R%%el33 R R2282QQQ R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R R Rs6 B0/B B0B B0B B00B47B4cx|jtjddd|5}|tj5|j |ddddn #1swxYwYddddS#1swxYwYdS)NrrCr/root/r) rrr!rDrJrr`rar;rXrEs r*#test_cannot_overwrite_file_with_dirzB; ?CCCct|jtjddd|5}tj|d}tjddd}tj|||j|dtjddd}| |j || |j |ddddS#1swxYwYdS) NrrCrzlink.txtrrrr) rrrKr!rDrJrrrXr2rr)r)rFrrHfake_link_paths r*test_symlink_is_mergedz/RealFileSystemAccessTest.test_symlink_is_mergedsp%''' ""27<<VU#C#CDDD  # # % % D Xz::I',,ueY??K J{I . . . O . .xW . M M MW\\#vzBBN OODO22>BB C C C OODO22>BB C C C D D D D D D D D D D D D D D D D D DsC.EEENc|||kr.||j|nZ||j|||j|t j|}||j||j |j | |j |j d| |j |j d| |j |j d||j|j||j|jdS)Nr)places)r2rrrr!r3rb_byte_contentsr7rassertAlmostEqualst_ctimest_atimerrr)r)r%rrH real_stats r*check_fake_file_statz-RealFileSystemAccessTest.check_fake_file_stats`  +"?"? OODO22>BB C C C C   T_33NCC D D D OODO22;?? @ @ @GN++  )2333 *I,=>>> y193EaPPP y193EaPPP y193EaPPP )9+;<<< )9+;<<<<RealFileSystemAccessTest.test_add_existing_real_file_read_onlysz22O11.AA  !!)^<<< *U2A666 !!)^<<<<22 %%n%FFF ^^NC&^ A A Q GGENNN               ^^ND 1 1 /Q   VQVVXX . . . / / / / / / / / / / / / / / / / / /s$A;;A?A?)CCCc|j|j||j|j||jt j|jd||jt j|jdt j|jd}|j|}| ||| ||dS)Nfake_filesystem.pyfake_pathlib.pyzfake_filesystem_shutil.py) rrXrtr2rr!rDrJrrrr)rr%s r**test_add_existing_real_directory_read_onlyzCRealFileSystemAccessTest.test_add_existing_real_directory_read_onlys# **4+=>>> ..t/ABBCCC  O " " T/1EFF      O " "27<<0BDU#V#V W W   GLL!35PQQ O++I66  !!)Y777 !!)Y77777r,c ,|j|j||jt j|jddd||jt j|jdd||jt j|jdddS)Npyfakefstestsfake_filesystem_test.pyrrV)rrXrur2rr!rDrJr(s r*%test_add_existing_real_directory_treez>RealFileSystemAccessTest.test_add_existing_real_directory_trees **4>:::  O " " N-      O " " T^Z9MNN      O " " T^ZGG       r,c#K|D]#}tj|d|d$ dV|D]}tj|ddS#|D]}tj|dwxYw)Nrr)r!rr)r)symlinksrs r*create_symlinksz(RealFileSystemAccessTest.create_symlinks s ) )D JtAwQ ( ( ( ( # EEE  # # $q'"""" # # # # $q'"""" #s A!A0c"tj}tjtj|dt tj|ddd5 dddn #1swxYwY|S)Nfixtures all_tests.pyrrr)rrr!mkdirrDrJr)real_directorys r*_setup_temp_directoryz.RealFileSystemAccessTest._setup_temp_directory s!)++ nj99::: "',,~~>>f U U U                  s6BB Bc tj|j}|}dtj|ddfdtj|ddf|tj|ddftj|dtj|ddfd tj|dd fg}|jd |d d d 5}|ddddn #1swxYwY | |5|j |ddddn #1swxYwYn*#t$r|j rtjdwxYw|D]5}||j|d6||jtj|d||jtj|d||jtj|d||jtj|d||jtj|d||jtj|d||jtj|d||tj|dd ddS)NrFrsymlink_dir_relative../all_tests.pysymlink_file_relativesymlink_dir_absolutersymlink_file_absolutez/etc/somethingsymlink_file_absolute_outsiderrrz good morningFrz,Symlinks under Windows need admin privilegesrzfixtures/symlink_dir_relativez*fixtures/symlink_dir_relative/all_tests.pyzfixtures/symlink_file_relativezfixtures/symlink_dir_absolutez*fixtures/symlink_dir_absolute/all_tests.pyzfixtures/symlink_file_absolutez&fixtures/symlink_file_absolute_outside)rrrrr!rDrJrrrrXrRr0rSkipTestr2rrr7r)r)rrrrrs r*(test_add_existing_real_directory_symlinkzARealFileSystemAccessTest.test_add_existing_real_directory_symlink% s#0AA 3355 ^Z9OPP  " ^Z9PQQ   ^Z9OPP   ^^<< ^Z9PQQ  ! "J0O # 2 ##$4555 Y'v > > > $! GGN # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ %%h// T T22>U2SSS T T T T T T T T T T T T T T T    X'(VWWW    = =D OODO2247;; < < < <  O " " "3       O " " "@       O " " "4       O " " "3       O " " "@       O " " "4       O " " "<       I "<     dff  sB EE EF#F  F FFFF'F?cxt|}dtj|ddfdtj|ddfg}||5|j|dddddn #1swxYwY||j d ||j d ||j d dS) NrFrrrr/pathFr#/path/fixtures/symlink_dir_relative0/path/fixtures/symlink_dir_relative/all_tests.py$/path/fixtures/symlink_file_relative rrr!rDrJrrrXr2rr)rrs r*4test_add_existing_real_directory_symlink_target_pathzMRealFileSystemAccessTest.test_add_existing_real_directory_symlink_target_path sq%'''3355 ^Z9OPP  " ^Z9PQQ    ! !( + +   O . .Gu /                   ../TUUVVV  O " "#U V V    ../UVVWWWWWs>B((B,/B,czt|}dtj|ddfdtj|ddfg}||5|j|dd||j d ||j d ||j d ddddS#1swxYwYdS) NrFrrrrrTrrrrrrs r*2test_add_existing_real_directory_symlink_lazy_readzKRealFileSystemAccessTest.test_add_existing_real_directory_symlink_lazy_read s%'''3355 ^Z9OPP  " ^Z9PQQ    ! !( + +   O . .Gt /    OO&&'LMM    OO&&F    OO&&'MNN                     s>B%D00D47D4c |j|jd||jt j|jdd| |jt jddddd||jt j|jdd| |jt jdddd dS) NrrrrrrrrrV) rrXrurrr!rDrJrtr2r(s r*3test_add_existing_real_directory_tree_to_other_pathzLRealFileSystemAccessTest.test_add_existing_real_directory_tree_to_other_path sI **4>z*RRR  O " " T/:STT      O " " -      O " " T^Z9MNN      O " " UE:}EE       r,c d|j_|j|j||jt j|jdd||jt j|jdddS)NTrrrV) rrrXrur2rLr!rDrJr(s r*0test_get_object_from_lazily_added_real_directoryzIRealFileSystemAccessTest.test_get_object_from_lazily_added_real_directory s,0) **4>:::  O & & T^Z9MNN      O & & T^ZGG       r,c d}tj|jd}|j|||j||||j|j | |j tj|d| ||j|j dS)N@rr) r!rDrJrurr,rXr7rr(r2rL assertGreater)r) disk_sizerZs r*'test_add_existing_real_directory_lazilyz@RealFileSystemAccessTest.test_add_existing_real_directory_lazily s&  T^Z@@  &&y-@@@ **=999 DO$B$B=$Q$Q$VWWW  O & & ],@AA      t55mDDI     r,cd}|j||j|j|jd|||j|jjdS)NrFr)rr,rtrXrrr()r)rs r*+test_add_existing_real_directory_not_lazilyzDRealFileSystemAccessTest.test_add_existing_real_directory_not_lazily s&  &&y$2DEEE **4+=*OOO  t55d6HIIN     r,c|j|jd||j|j||jt j|jd||jt j|jdt j|jd}|j|}| ||| ||dS)NFrrrzpytest_plugin.py) rrXrtr2rr!rDrJrrrrs r*+test_add_existing_real_directory_read_writezDRealFileSystemAccessTest.test_add_existing_real_directory_read_write s( **4+=*OOO ..t/ABBCCC  O " " T/1EFF      O " "27<<0BDU#V#V W W   GLL!35GHH O++I66  !!)Y777   I66666r,c*tjt}tj|jdd}|j||g|j|}| ||| ||tj|d}|j|}| ||| ||dS)Nrrmodule_with_attributes.py) r!rDrdrWrJrtradd_real_pathsrrrr)r fixture_pathr%s r*&test_add_existing_real_paths_read_onlyz?RealFileSystemAccessTest.test_add_existing_real_paths_read_only, s))(33w||D$6LL  && 'EFFFO++N;;  !!)^<<< !!)^<<<l4OPPO++N;;  !!)^<<< !!)^<<<<>>CCC CCC ::: >>>&QQQ QQQ$RRR SSS SSS D D D====    1 1 1===<<<RRR UUU///888"   .###\r r r hXXX2>   :       (    777" = = = < < <X_Vt^%>??X_S%.0RSSX_Z3;.0NOOEEPOTS@?EEEr,rrc&eZdZdZdZdZdZdS)FileSideEffectTestsc$|d_fd}|S)NFc.d_|j_dSr>)side_effect_calledrside_effect_file_object_content)r test_cases r* __side_effectz6FileSideEffectTests.side_effect..__side_effectZ s+/I (8C8LI 5 5 5r,)r)r)!_FileSideEffectTests__side_effectrs @r* side_effectzFileSideEffectTests.side_effectV s6 ', $ M M M M Mr,ctj|_|jd|dS)Nr)r)rrrrrr(s r*r+zFileSideEffectTests.setUp` s?)8:: ##OAQAQASAS#TTTTTr,ctj|j}d|_|ddd5}|ddddn #1swxYwY||jdSNFrrrrr)rrrrrr2r)rhandles r*test_side_effect_calledz+FileSideEffectTests.test_side_effect_callede s#0AA "' Yf = = =  LL                   /00000AAActj|j}d|_|ddd5}|ddddn #1swxYwY||jddSr)rrrrrr7rr s r*test_side_effect_file_objectz0FileSideEffectTests.test_side_effect_file_objectl s#0AA "' Yf = = =  LL                   =uEEEEEr#N)rrrrr+r"r%rr,r*rrU sXUUU 111FFFFFr,r__main__)7r'rrar!rrr3rXrr unittest.mockrr ImportErrorrrrrpyfakefs.fake_filesystemrrr r r pyfakefs.helpersr pyfakefs.tests.test_utilsr rrrrrrrrrrr r)rrrr0rHrLr^rnrrQrhrrrrmainrr,r*r-s+*  MMMM FFF9888888888$#####]F]F]F]F]FH]F]F]F@=====8===&%L%L%L%L%L%L%L%LPWWWWWHWWW0kHkHkHkHkHXkHkHkH\ N@N@N@N@N@N@N@N@b</</</</</h</</</~+B+B+B+B+BH+B+B+B\S?S?S?S?S?S?S?S?l MMMMMxMMM .U.U.U.U.U$<.U.U.UbPPPPP,PPPDLLLLL+LLLD77777777*T*T*T*T*T*T*T*TZ"H"H"H"H"H8"H"H"HJnXnXnXnXnXXnXnXnXb`1`1`1`1`1H`1`1`1F ATATATATATXATATATH;;;;;N;;;.hEhEhEhEhE~hEhEhEVFFFFF(FFF> zHMOOOOOs 3==