!Os jdZddlZddlZddlZddlZddlZddlmZmZm Z m Z ddl m Z m Z mZmZddlmZmZmZmZmZddlmZmZmZGddeZGd d eZGd d eZGd deZGddeZGddeZGddeZ Gdde Z!GddeZ"Gdde"Z#GddeZ$Gdde$Z%Gdd eZ&Gd!d"eZ'Gd#d$e'Z(Gd%d&e'Z)Gd'd(e)Z*ej+ej,d)Gd*d+e'Z-Gd,d-e-Z.Gd.d/e-Z/Gd0d1e/Z0Gd2d3eZ1Gd4d5eZ2Gd6d7e2Z3dS)8z$Unit tests for fake_os.FakeOsModule.N)fake_filesystemfake_os fake_open fake_file) FakeFileOpenis_rootset_uidset_gid) IN_DOCKERIS_PYPYget_uidget_gid reset_ids)TestCaseRealFsTestCaseskip_if_symlink_not_supportedc0eZdZfdZdZdZdZxZS)FakeOsModuleTestBasect|jd|_dS)N)supersetUposumaskself __class__s m/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pyfakefs/tests/fake_os_test.pyrzFakeOsModuleTestBase.setUp(s-  W]]5)) cD|j|jdSN)rrrs rtearDownzFakeOsModuleTestBase.tearDown,s  dj!!!!!rc||||jj||j|}|jrdnd}||t j|j ||j t j z| |j t j zdS)N) create_file assertTruerpathexistsstat is_windows_fs assertEqualS_IMODEst_modeS_IFREG assertFalseS_IFDIRrr)stmodes rcreateTestFilez#FakeOsModuleTestBase.createTestFile/s   ++D11222 W\\$  *6uu t|BJ77888  T\1222 dl233333rc||||jj||j|}|jrdnd}||t j|j | |j t j z||j t j zdS)N) create_dirr(rr)r*r+r,r-r.r/r1r0r2r3s rcreateTestDirectoryz(FakeOsModuleTestBase.createTestDirectory9s   ++D11222 W\\$  *5uu t|BJ77888 dl2333  T\122222r)__name__ __module__ __qualname__rr#r6r; __classcell__rs@rrr'se*****"""4443333333rrcX eZdZfdZdZdZdZdZdZdZ 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/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:e;j<e=e>d9 d:d;Z?e;j<e=e>d< d=d>Z@e;j<e=e>d< d=d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_d^Z`d_Zad`ZbdaZcdbZddcZeddZfdeZgdfZhdgZidhZjdiZkdjZldkZmdlZndmZodnZpdoZqdpZrdqZsdrZtdsZudtZvduZwdvZxdwZydxZzdyZ{dzZ|d{Z}d|Z~d}Zd~ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd„ZdÄZdĄZdńZdƄZdDŽZdȄZdɄZdʄZd˄Zd̄Zd̈́Zd΄ZdτZdЄZdфZd҄ZdӄZdԄZdՄZe;j<ejdkdצd؄ZdلZdڄZdۄZd܄Zd݄ZdބZd߄ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%e;j<e&d$d%Z'e;j<e& d&d'Z(d(Z)d)Z*d*Z+d+Z,d,Z-d-Z.d.Z/d/Z0d0Z1d1Z2d2Z3d3Z4e;j<eؐj5d4vd5d6Z6d7Z7d8Z8d9Z9d:Z:d;Z;d<Z<d=Z=d>Z>d?Z?d@Z@e;j<ejdAkdBdCZAxZBS(DFakeOsModuleTestct|jj|jjz|jjz|_|jj|jjz|_dSr!)rrrR_OKW_OKX_OKrwxrwrs rrzFakeOsModuleTest.setUpDsI  7<$',.=',-rc|d}|||j|dS)z!chdir should work on a directory.fooN) make_pathr:rchdirr directorys r test_chdirzFakeOsModuleTest.test_chdirIs?NN5))   """  i     rc|ddd}|tj|jj|dS)z8chdir should raise OSError if the target does not exist.nosuchrNN)rKassert_raises_os_errorerrnoENOENTrrLrMs rtest_chdir_fails_non_existz+FakeOsModuleTest.test_chdir_fails_non_existOs;NN4==  ##EL$'-KKKKKrc|dd}|||tj|jj|dS)>%// """ ##EM47=(KKKKKrc|d}d}|jj||}|||j||j||tj|jtj|dS)z-Consecutive relative chdir calls should work.rJrYN) rKrr)joinr:rLr-realpathgetcwd)rdir1dir2 full_dirnames rtest_consecutive_chdirz'FakeOsModuleTest.test_consecutive_chdirZs~~e$$w|((t44   %%%  d  d  G  TW^^-- . .0@0@0N0N     rc||j}d}|jj|}|j||j||||j|jd|||j|j|jj |d|||jdS)z,chdir into '..' should behave appropriately.rJ..N) skip_real_fsrrbr)abspath filesystemr:rLr-r`)rrootdirdirname abs_dirnames rtest_backwards_chdirz%FakeOsModuleTest.test_backwards_chdirgs '..""gl**733  ""7+++  g dgnn&6&6777  d $'.."2"2333  dgl''66777 $'.."2"233333rc||dd}||||jj|j|j||||jdSNrJrY) rirKr:r-rk root_dir_namerrbrL)rrms r test_get_cwdzFakeOsModuleTest.test_get_cwdvs ....     68H8HIII  g $'.."2"233333rc|tj|jjd|dd}gd}|D]5}||jj||6| | |t|j|dS)Nnon_existing/fake_dirxyzzyplughrJrYbaz) rSrTrUrlistdirrKr'r)r`sortr-sortedrrNfilesfs r test_listdirzFakeOsModuleTest.test_listdirs ## L$'/+B   NN7G44 %%% > >A   TW\..y!<< = = = =  twy'A'A B BCCCCCrch|tjtjvr||t j|jjd|dd}gd}|D]5}| |jj ||6| |j |tj}||t!|j|dS)Nrvrwrx)check_posix_onlyrrz supports_fdrirSrTEBADFrKr'r)r`r{openO_RDONLYr-r|)rdir_pathr~rpath_dess r!test_listdir_uses_open_fd_as_pathz2FakeOsModuleTest.test_listdir_uses_open_fd_as_paths  :R^ + +       ##EK#FFF>>'733%%% = =A   TW\..x;; < < < < 7<<"+66 twx'@'@ A ABBBBBrc|d}|j||jj|d}|j||||d|dg|j|dS)NrvbugrJrKrmkdirr)r`r'r-rz)rdirectory_rootrNs rtest_listdir_returns_listz*FakeOsModuleTest.test_listdir_returns_lists00  n%%%GL%%ne<<   i     599::: %$'//)"<"<=====rc t|d}gd}|D]+}||||,||d|d|||t |j|ddS)Nrvrxsymlink rrKr'create_symlinkr{r-r|rrzr}s rtest_listdir_on_symlinkz(FakeOsModuleTest.test_listdir_on_symlink%'''NN7++ %%% ; ;A   T^^Iq99 : : : : DNN955t~~g7N7NOOO  twt~~i7P7P'Q'Q R RSSSSSrc|ddd}|||tj|jj|dS)NrJrYry)rKr'rSrTr[rrzr file_paths rtest_listdir_errorz#FakeOsModuleTest.test_listdir_errorsONN5%77  ### ##EM47?INNNNNrcj||jjddSN.)r(rr)r*r"s rtest_exists_current_dirz(FakeOsModuleTest.test_exists_current_dirs,  ++C0011111rcgd}|D]*}|||+|||t |j|jdS)Nrx)r'rKr{r-r|rrz base_path)rr~rs rtest_listdir_currentz%FakeOsModuleTest.test_listdir_currents%%% 0 0A   T^^A.. / / / /  twt~'F'F G GHHHHHrc||d}||d||dd5}|}|j|d}|||dddn #1swxYwY|t5|jddddn #1swxYwY|t5|jdddddS#1swxYwYdS)N some_file1contents here1contentsrutf8encodingza string) rKr'rfilenorfdopenassertNotEqual assertRaises TypeError)r file_path1 fake_file1r fake_file2s r test_fdopenzFakeOsModuleTest.test_fdopens^^L11  .>??? YYz3Y 8 8 8J&&((F@@J    J 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8   y ) ) ! ! GNN4  ! ! ! ! ! ! ! ! ! ! ! ! ! ! !   y ) ) ' ' GNN: & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' ' 's7ABBB=C$$C(+C( D11D58D5cVddi}|jtj|jjdfi|dS)Nrrr)rSrTrrr)rkwargss rtest_out_of_range_fdopenz)FakeOsModuleTest.test_out_of_range_fdopens7f%##EKOOOOOOOrc|d}|d}|d}||d||d||d||dd }||dd }||dd }|}|}|} |j||tj|jj|| ||| | ||j |d 5} | | |udddn #1swxYwY|j | d 5} | | |udddn #1swxYwYd d i} |jtj|jj |fi| dS) Nr some_file2 some_file3rrzcontents here2zcontents here3rrrr) rKr'rrrcloserSrTrr-rr1) r first_path second_path third_pathrr fake_file3fileno1fileno2fileno3rrs rtest_closed_file_descriptorz,FakeOsModuleTest.test_closed_file_descriptors^^L11 nn\22 ^^L11  .>??? /?@@@ .>???YYz3Y@@ YY{C&YAA YYz3Y@@ ##%%##%%##%%  g ##EKHHH *"3"3"5"5666 *"3"3"5"5666 W^^Gf^ 5 5 .   Q*_ - - - . . . . . . . . . . . . . . . W^^Gf^ 5 5 .   Q*_ - - - . . . . . . . . . . . . . . .f%##EKSSFSSSSSs$:GG"%G"H))H-0H-c<|d}||d||dd}|j}||d}||d}|j|dS)Nrrrrrr)rKr'rrrr)rrrfdfile1file2s rtest_fdopen_twicez"FakeOsModuleTest.test_fdopen_twicesNN<00  -=>>>IIivI>> Y    "v .. "v ..  brc|d}|j|tjtjzd}||dd5}|ddddn #1swxYwY||d5}|dksJ dddn #1swxYwY|j|ddS)Nfile.txtmwrrhey)rKrrO_CREATO_WRONLYwritereadchmod)rrroutrs r#test_open_fd_write_mode_for_ro_filez4FakeOsModuleTest.test_open_fd_write_mode_for_ro_filesONN:.. W\\)RZ"+%=u E E YYr3Y 0 0 C IIe                   YYy6Y 2 2 %a6688u$$$$$ % % % % % % % % % % % % % % %  i'''''s$!BB B%C  CCc|d}|j|tjtjzd}||d}||d|t5}|dddn #1swxYwY|j j tj ksJ|t5}| dddn #1swxYwY|j j tj ksJ| |j |ddS)NriUwbar)rKrrrrflushrrOSError exceptionrTrrr)rrrrcms r"test_open_fd_read_mode_for_ro_filez3FakeOsModuleTest.test_open_fd_read_mode_for_ro_filesNN:.. W\\)RZ"+%=u E EiiD!!  $   w ' ' 2 IIKKK               |!U[0000  w ' ' 2 IIKKK               |!U[0000   i'''''s$"CC CD%%D),D)c|d}|jj|d}||d||d5}|}|tj |j |tj z|tj |j |j z| d|j |tjddddS#1swxYwYdS)NrvrwABCDErrr)rKrr)r`r'rrr(r+r0fstatST_MODEr/r-ST_SIZE)rrNrfile_objrs r test_fstatzFakeOsModuleTest.test_fstatsaNN7++ GL%%i99  W555 YYy6Y 2 2 Eh__&&F OODL47==+@+@+NN O O O OODL47==+@+@+HH I I I   Q f 5 5dl C D D D  E E E E E E E E E E E E E E E E E Es$CE  EEc|d}|jj|d}||d|t j|j|t jz|t j |j|t jz|t j |j|j z| d|j|t j dS)Nrvrwrrr rKrr)r`r'r(r+r2rr0r/r-rrrNrs r test_statzFakeOsModuleTest.test_statsNN7++ GL%%i99  W555  tw||I'>'>t|'LLMMM  tw||I'>'>t|'LLMMM  tw||I'>'>'FFGGG DGLL33DLABBBBBrc||d}||d|d|j|j|d}||d|d|j|j|d}||d |d|j|j|d }||d |d|j|j|d }||dd z|d|j|jdS)Nfoo1rrrfoo2tfoo3stttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttfoo4sttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttfoo5i)rrKr'r-rr+ st_blocksrs rtest_st_blockszFakeOsModuleTest.test_st_blocks's NN6**  S111 DGLL33=>>>NN6**  T222 DGLL33=>>>NN6**  [999 DGLL33=>>>NN6**  [999 DGLL33=>>>NN6**  TD[999 TW\\)44>?????rc*||d}||d|t5|j|jddddS#1swxYwYdS)NrJrr)check_windows_onlyrKr'rAttributeErrorrr+rrs rtest_no_st_blocks_in_windowsz-FakeOsModuleTest.test_no_st_blocks_in_windows9s !!!NN5))  S111   ~ . . . . GLL # # - - . . . . . . . . . . . . . . . . . .s BB B c||d}|jj|d}||d|tj|j|tj z|tj |j|tj z|tj |j|j z| d|j|tj dS)Nz//root/share/dirrwrrrrirrr)r`r'r(r+r2rr0r/r-rrs rtest_stat_with_unc_pathz(FakeOsModuleTest.test_stat_with_unc_path@s  !!!& GL%%i99  W555  tw||I'>'>t|'LLMMM  tw||I'>'>t|'LLMMM  tw||I'>'>'FFGGG DGLL33DLABBBBBrc||d}|jj|d}||d|tj|j|tj z|tj |j|tj z|tj |j|j z| d|j|tj dS)Nz C:/foo/dirrwrrrrrs rtest_stat_with_drivez%FakeOsModuleTest.test_stat_with_driveKs  !!! GL%%i99  W555  tw||I'>'>t|'LLMMM  tw||I'>'>t|'LLMMM  tw||I'>'>'FFGGG DGLL33DLABBBBBrc||tj|jjd|dd}||||d5}| t j |j|j t j zddddS#1swxYwYdS)NrrJrYrr) rirSrTrrr+rKr'rr(r0filedesrrrrs rtest_stat_uses_open_fd_as_pathz/FakeOsModuleTest.test_stat_uses_open_fd_as_pathVs  ##EKqAAANN5%00  ### YYy6Y 2 2 Ra OODL47<< +B+B4<+PP Q Q Q R R R R R R R R R R R R R R R R R RsACC#&C#c||d}d}d}|t|t||jj||}|jj|d}||||||| t||j |dtj | t||j |dtj dS =Test that stat with follow_symlinks=False behaves like lstat.rvrwfrobozzlinkrFfollow_symlinksN) rrKrlenrr)r`r'rr-r+rrrN base_name file_contentsr link_paths r"test_stat_no_follow_symlinks_posixz3FakeOsModuleTest.test_stat_no_follow_symlinks_posix_s< NN7++  !  C NNC ,>,>???GL%%i;; GL%%i88  ];;; Iy111     GLLEL : :4< H      NN GLLEL : :4< H     rc|t|d}d}d}|t |t ||jj||}|jj|d}|||| ||| t ||j |dtj | d|j |dtj d S) rrvrwrrrFrrN) rrrKrrrr)r`r'rr-r+rr s r$test_stat_no_follow_symlinks_windowsz5FakeOsModuleTest.test_stat_no_follow_symlinks_windowstsA !!!%'''NN7++  !  C NNC ,>,>???GL%%i;; GL%%i88  ];;; Iy111     GLLEL : :4< H     tw||Iu|==dlK     rc||d}d}d}|t|t||jj||}|jj|d}||||||| t||j |tj | t||j |tj dSNrvrwrrr) rrKrrrr)r`r'rr-lstatr+rr s rtest_lstat_size_posixz&FakeOsModuleTest.test_lstat_size_posixs NN7++  !  C NNC ,>,>???GL%%i;; GL%%i88  ];;; Iy111 ]++TW]]9-E-Edl-STTT Yy)A)A$,)OPPPPPrc|t|d}d}d}|t |t ||jj||}|jj|d}|||| ||| t ||j |tj | d|j |tj dS)Nrvrwrrrr)rrrKrrrr)r`r'rr-rr+rr s rtest_lstat_size_windowsz(FakeOsModuleTest.test_lstat_size_windowss$ !!!%'''NN7++  !  C NNC ,>,>???GL%%i;; GL%%i88  ];;; Iy111 ]++TW]]9-E-Edl-STTT DGMM)44T\BCCCCCrc|j|j}|||j|j|z|||j|j|z|zdSr!)rrrr-path_separator)r stat_results rtest_lstat_trailing_sepz(FakeOsModuleTest.test_lstat_trailing_sepsgmmDN33   t~8K8K8M8M'MNN      GMM!4!4!6!669L9L9N9NN       rc|j|j}|jd}|j|}|||dSNr)rr+rencoder-rstat_strbase_path_bytes stat_bytess rtest_stat_with_byte_stringz+FakeOsModuleTest.test_stat_with_byte_strings[7<<//.//77W\\/22  X.....rc|j|j}|jd}|j|}|||dSr)rrrrr-rs rtest_lstat_with_byte_stringz,FakeOsModuleTest.test_lstat_with_byte_strings[7==00.//77W]]?33  X.....rc|jd}|jd}|||dSr)rr+rr-)rr lstat_results rtest_stat_with_current_dirz+FakeOsModuleTest.test_stat_with_current_dirsDgll3'' w}}S))  l33333rc|d}||||jj||jjzdSNalpha)rKr'r1rr)r*seprs rtest_exists_with_trailing_sepz.FakeOsModuleTest.test_exists_with_trailing_seps\NN7++  ### ,,Y-DEEFFFFFrc|d}|j||jjz|jjz||jj|dSNrJ)rKrrr*r(r)r*rrs rtest_mkdir_with_trailing_sepz-FakeOsModuleTest.test_mkdir_with_trailing_sepsc>>%((  h,tw{:;;;  ++H5566666rc||tj|jjddSN)rrSrTrUrreadlinkr"s rtest_readlink_empty_pathz)FakeOsModuleTest.test_readlink_empty_paths9  ##EL$'2BBGGGGGrc||d}|j|j||t j|jj||jj zdSr-) rrKrrrrSrTEINVALr3r*rr s r#test_readlink_ending_with_sep_posixz4FakeOsModuleTest.test_readlink_ending_with_sep_posixsv NN5))   222 ## L$'*I ,C     rc2|t|d}|j|j|||j||jjzj dSr-) check_linux_onlyrrKrrrr(rr*r/r7s r*test_lstat_symlink_with_trailing_sep_linuxz;FakeOsModuleTest.test_lstat_symlink_with_trailing_sep_linux{ %'''NN5))   222  i$'+&=>>FGGGGGrc2|t|d}|j|j|||j||jjzj dSr-) check_macos_onlyrrKrrrr(rr*r/r7s r*test_lstat_symlink_with_trailing_sep_macosz;FakeOsModuleTest.test_lstat_symlink_with_trailing_sep_macosr<rc4|t|d}|j|j|||j|j||jjzdSr-) rrrKrrrassert_equal_pathsr3r*r7s r%test_readlink_ending_with_sep_windowsz6FakeOsModuleTest.test_readlink_ending_with_sep_windowss !!!%'''NN5))   222  NDG,,Y-DEE     rc<|t|d}|j|j|||jj||jjj zdSr-) rrrKrrrr(r)islinkr*r7s r%test_islink_with_trailing_sep_windowsz6FakeOsModuleTest.test_islink_with_trailing_sep_windowss !!!%'''NN5))   222  ++I 8H,HIIJJJJJrc||d}|j|j|||jj||jjzdSr-) r:rKrrrr1r)rDr*r7s r#test_islink_with_trailing_sep_linuxz4FakeOsModuleTest.test_islink_with_trailing_sep_linuxr NN5))   222 ,,Y-DEEFFFFFrc||d}|j|j|||jj||jjzdSr-) r>rKrrrr1r)rDr*r7s r#test_islink_with_trailing_sep_macosz4FakeOsModuleTest.test_islink_with_trailing_sep_macosrHrc|d}|||tj|jjj||jjzdSNrY) rKr'rSrTr[rr)getsizer*rs r+test_getsize_raises_with_trailing_separatorzUVVVVVrcl||tjdSr!)r:rRrTr[r"s r&test_remove_link_ending_with_sep_linuxz7FakeOsModuleTest.test_remove_link_ending_with_sep_linuxs0  ..u}=====rcl||tjdSr!)r>rRrTEPERMr"s r&test_remove_link_ending_with_sep_macosz7FakeOsModuleTest.test_remove_link_ending_with_sep_macoss0  ..u{;;;;;rc|t|tjdSr!)rrrRrTEACCESr"s r(test_remove_link_ending_with_sep_windowsz9FakeOsModuleTest.test_remove_link_ending_with_sep_windows!s< !!!%''' ..u|<<<< ) )       ##EKBBBNN5%00 NN5&11 #  ];;; Iy111 YYy6Y 2 2 Ya   S//qy1I1I$,1W X X X Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y YsAD66D:=D:c|ddd}||jj| |j||ddS#t$rK}|tj |j |||j Yd}~dSd}~wwxYw)NnonexistentfileException is expected.) rKr1rr)r*r+failrr-rTrUr])rros_errors rtest_stat_non_existent_filez,FakeOsModuleTest.test_stat_non_existent_file4sNN5*f==  ,,Y77888 ; GLL # # # II. / / / / / ; ; ;   U\8> : : :   Y(9 : : : : : : : : : ;s /A<< CAC  Cc|d|jjz}|||jj|tjtjztjzdSrL)rKrr*rSrrrO_TRUNC)rrQrs r)check_open_raises_with_trailing_separatorz:FakeOsModuleTest.check_open_raises_with_trailing_separatorAs^NN5))DGK7  ##  GL  J $rz 1      rcl||tjdSr!)r:rhrTEISDIRr"s r.test_open_raises_with_trailing_separator_linuxz?FakeOsModuleTest.test_open_raises_with_trailing_separator_linuxJ0  66u|DDDDDrcl||tjdSr!)r>rhrTrUr"s r.test_open_raises_with_trailing_separator_macosz?FakeOsModuleTest.test_open_raises_with_trailing_separator_macosNrlrcl||tjdSr!)rrhrTr6r"s r0test_open_raises_with_trailing_separator_windowszAFakeOsModuleTest.test_open_raises_with_trailing_separator_windowsRs0 !!! 66u|DDDDDr O_DIRECTORYopening directory not supportedc4||t5|jdtjtjzdddn #1swxYwY|d}||d|t5|j|tjtjzdddn #1swxYwY|d}| ||t5|j|tj tjzddddS#1swxYwYdS)NbogusrrJrdir) rrFileNotFoundErrorrrrrqrKr'NotADirectoryErrorr:IsADirectoryErrorO_RDWR)rrrs rtest_open_with_o_directoryz+FakeOsModuleTest.test_open_with_o_directoryVs-    0 1 1 @ @ GLL"+"> ? ? ? @ @ @ @ @ @ @ @ @ @ @ @ @ @ @NN:..  U333   1 2 2 B B GLLBK".$@ A A A B B B B B B B B B B B B B B B>>%(( !!!   0 1 1 ? ? GLL29r~#= > > > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?s53A..A25A2?3C>>DD 3F  FF O_NOFOLLOWz NOFOLLOW attribute not supportedct|d}||d|d}||||t 5}|j|t jt j zdddn #1swxYwY|j j tj ksJdS)NrrJrr) rrKr'rrrrrrr{rrTELOOP)rrr rs r!test_open_nofollow_symlink_raisesz2FakeOsModuleTest.test_open_nofollow_symlink_raisesds%'''NN:..  U333NN6**  Iy111   w ' ' A2 GLLBK"-$? @ @ @ A A A A A A A A A A A A A A A|!U[000000s3B??CCct|d}|||d}||||jj|d}||d|j|tj tj z}| |d|j |dS)NrurrrJrr) rrKr:rrr)r`r'rrr{ assertGreaterr)rrr rrs r*test_open_nofollow_symlink_as_parent_worksz;FakeOsModuleTest.test_open_nofollow_symlink_as_parent_worksos%'''>>%(( !!!NN6**  Ix000GL%%i<<  U333 W\\)R[2=%@ A A 2q!!!  brc(|t|d}|j||||jj||jjzdSr-) check_linux_and_windowsrrKrrr1r)lexistsr*rs r2test_lexists_with_trailing_separator_linux_windowszCFakeOsModuleTest.test_lexists_with_trailing_separator_linux_windows|s| $$&&&%'''NN5))   9--- --i$'+.EFFGGGGGrc ||d}|j||||jj||jjzdSr-)r>rKrrr(r)rr*rs r*test_lexists_with_trailing_separator_macosz;FakeOsModuleTest.test_lexists_with_trailing_separator_macossn NN5))   9---  ,,Y-DEEFFFFFrc(|t|d}|j||||jj||jjzdSr-) rrrKrrr1r)rDr*rs r1test_islink_with_trailing_separator_linux_windowszBFakeOsModuleTest.test_islink_with_trailing_separator_linux_windowss| $$&&&%'''NN5))   9--- ,,Y-DEEFFFFFrc ||d}|j||||jj||jjzdSr-)r>rKrrr(r)rDr*rs r)test_islink_with_trailing_separator_macosz:FakeOsModuleTest.test_islink_with_trailing_separator_macossn NN5))   9---  ++I ,CDDEEEEErc||d}||||jj||jjzdSr-)rrKr'r1rr)isfiler*rs r1test_isfile_with_trailing_separator_linux_windowszBFakeOsModuleTest.test_isfile_with_trailing_separator_linux_windowssn $$&&&NN5))  ### ,,Y-DEEFFFFFrc||d}||||jj||jjzdSr-)r>rKr'r1rr)rr*rs r)test_isfile_with_trailing_separator_macosz:FakeOsModuleTest.test_isfile_with_trailing_separator_macossn NN5))  ### ,,Y-DEEFFFFFrc|d}||d||jj|dS)NrJrperm)rKr'r(rr)rrs rtest_isfile_not_readable_filez.FakeOsModuleTest.test_isfile_not_readable_filesVNN5))  +++  ++I6677777rc|d}|||tj|jj||jjzdSr-)rKr'rSrTr[rr+r*rs r!test_stat_with_trailing_separatorz2FakeOsModuleTest.test_stat_with_trailing_separators_NN5))  ### ## M47<TW[)@     rc|d}|||tj|jj||jjzdSr-)rKr'rSrTr[rrPr*rs r#test_remove_with_trailing_separatorz4FakeOsModuleTest.test_remove_with_trailing_separators_NN5))  ### ## M47>9tw{+B     rct|ddd}|d}|||||j||dSNrJrYrytarJAY)rrKrrArr3rr targets r test_readlinkzFakeOsModuleTest.test_readlinksv%'''NN5%77 )) Iv...  0 0 ; ;VDDDDDrc|ddd}|||tj|jj|dSNrJrY eleventyone)rKr'rSrTr6rr3rs r+check_readlink_raises_if_path_is_not_a_linkzFakeOsModuleTest.test_readlink_raises_if_path_has_file_windows< !!!%''' 33ELAAAAArcl||tjdSr!rrrTr[r"s r+test_readlink_raises_if_path_has_file_posixzrKrrr*rs r1test_broken_symlink_with_trailing_separator_macoszBFakeOsModuleTest.test_broken_symlink_with_trailing_separator_macossz NN5)) NN6**   9---  DGK/TW[1HIIIIIrc`|t|d}|d}|j|||t j|jj||jjz||jjzdSr) rrrKrrrSrTr[r*rs r3test_broken_symlink_with_trailing_separator_windowszDFakeOsModuleTest.test_broken_symlink_with_trailing_separator_windowss !!!%'''NN5)) NN6**   9--- ## M GO  #  #      rc||d}|j|||t j|jj||jjzdSr- r:rKrrrSrTr}r3r*rs r4test_circular_readlink_with_trailing_separator_linuxzEFakeOsModuleTest.test_circular_readlink_with_trailing_separator_linux st NN5))   9--- ## K)9tw{+B     rc||d}|j|||j||jjzdSr-)r>rKrrr3r*rs r4test_circular_readlink_with_trailing_separator_macoszEFakeOsModuleTest.test_circular_readlink_with_trailing_separator_macoss` NN5))   9--- TW[011111rc|t|d}|j|||t j|jj||jj zdSr- rrrKrrrSrTr[r3r*rs r6test_circular_readlink_with_trailing_separator_windowszGFakeOsModuleTest.test_circular_readlink_with_trailing_separator_windowss !!!%'''NN5))   9--- ## M47+Y-D     rc t||ddd|d||dd|d||d|j|dddddS)NmeyerlemonpieyumgeometrorrrKrArr3r"s r test_readlink_with_links_in_pathz1FakeOsModuleTest.test_readlink_with_links_in_path%%'''  NN7GU 3 3T^^E5J5J    DNN5'::DNN7t||dddd|d||d|dd||d|dd||d|j|dddS)Neasterneuropean wolfhoundschasecatsrussiandogsrr"s r(test_readlink_with_chained_links_in_pathz9FakeOsModuleTest.test_readlink_with_chained_links_in_path0%'''  NN9j, H H NN6 " "     NN9 % %t~~i'L'L     NN6 " "DNN9l$K$K     NN6 " " G  T^^FG<< = =     rc|d}|jj|d}||||jj||||jj|||jj||j ||||jj|||jj||tj |jjddS)Nrvrwz/plugh) rKrr)r`r:r(r*rSrPrLrTrUr dir_errorrNrs rcheck_remove_dirz!FakeOsModuleTest.check_remove_dirAsNN7++ 7<$$Y88 !!!  ++H55666 ##Itw~xHHH  ++H55666  i    ##Itw~xHHH  ++H55666 ##EL$'.(KKKKKrcl||tjdSr!)r:rrTrjr"s rtest_remove_dir_linuxz&FakeOsModuleTest.test_remove_dir_linuxMs0  el+++++rcl||tjdSr!r>rrTrVr"s rtest_remove_dir_mac_osz'FakeOsModuleTest.test_remove_dir_mac_osQ0  ek*****rcl||tjdSr!rrrTrYr"s rtest_remove_dir_windowsz(FakeOsModuleTest.test_remove_dir_windowsU0 !!! el+++++rc |||jjdd}|j||tj |jj |dS)NzC:test) rrirr)r`rkr:rSrTrYrPr.s rtest_remove_dir_with_drivez+FakeOsModuleTest.test_remove_dir_with_driveYsy !!! 7<$$T622 ""8,,, ##EL$'.(KKKKKrc|d}|jj|d}||||jj||j|||jj|dSNzzyrw) rKrr)r`r'r(r*rPr1rs rtest_remove_filez!FakeOsModuleTest.test_remove_fileasNN5)) GL%%i99  ###  ++I66777 y!!! ,,Y7788888rc|d}d}|jj||}||||jj||j||j|| |jj|dSr) rKrr)r`r'r(r*rLrPr1rrN file_namers rtest_remove_file_no_directoryz.FakeOsModuleTest.test_remove_file_no_directoryisNN5))  GL%%i;;  ###  ++I66777  i    y!!! ,,Y7788888rcn|||dd}|||j|d|tj|jj ||j|ddS)NrJrY$r%) r skip_rootrKr'rrrSrTrYrPrr)s r7test_remove_file_with_read_permission_raises_in_windowszHFakeOsModuleTest.test_remove_file_with_read_permission_raises_in_windowsss !!! ~~eU++   dE""" ##EL$'.$GGG  dE"""""rcR||dd}|||j|d|j|||jj|dS)NrJrYr) rrKr'rrrPr1r)r*rs rrrTrVr"s r#test_remove_dir_raises_error_mac_osz4FakeOsModuleTest.test_remove_dir_raises_error_mac_os0  **5;77777rcl||tjdSr!rrrTrYr"s r$test_remove_dir_raises_error_windowsz5FakeOsModuleTest.test_remove_dir_raises_error_windows0 !!! **5<88888rct|d}|d}|||j||||jj|||jj||j|||jj|| |jj|dSNr link_to_dir) rrKr:rrr(r)r*rPr1rrNrs rtest_remove_symlink_to_dirz+FakeOsModuleTest.test_remove_symlink_to_dirs%'''NN5)) ~~m,,  """  4(((  ++I66777  ++D11222 t  ++I66777 ,,T2233333rc|dddd}||jj||t j|jj|dS)Nradoesnotexist) rKr1rr)r*rSrTrUunlinkrs rtest_unlink_raises_if_not_existz0FakeOsModuleTest.test_unlink_raises_if_not_existscNN665'BB  ,,Y77888 ##EL$'.)LLLLLrc|d}|jj|d}|jj|d}||d||jj|||jj||j||||jj|||jj|| |ddS)z$Can rename a file to an unused name.rv plugh_old plugh_new test contentsrN) rKrr)r`r'r(r*r1renamecheck_contentsrrN old_file_path new_file_paths rtest_rename_to_nonexistent_filez0FakeOsModuleTest.test_rename_to_nonexistent_files$NN7++  )))[AA  )))[AA  AAA  ++M::;;; ,,];;<<< }m444 ,,];;<<<  ++M::;;; M?;;;;;rcz||d}|d}|jj|d}|||j|||tj |jj ||dSNrru link_target) rrKrr)r`r:rrSrTr[r+rr rr3s r test_rename_dir_to_symlink_posixz1FakeOsModuleTest.test_rename_dir_to_symlink_posixs NN6** >>%((gl''-@@  !!!  Y/// ##EM47>8YWWWWWrc|t|d}|d}|jj|d}|||j|||tj |jj ||dSr2) rrrKrr)r`r:rrSrTrr+r4s r"test_rename_dir_to_symlink_windowsz3FakeOsModuleTest.test_rename_dir_to_symlink_windowss !!!%'''NN6** >>%((gl''-@@  !!!  Y/// ##EL$'.(IVVVVVrcD||d}|d}|j|||||j||||jj|| |jj|| |jj |dSN file_linkra) rrKrrr'r+r1r)r*r(rrr rs rtest_rename_file_to_symlinkz,FakeOsModuleTest.test_rename_file_to_symlinks NN;// NN6**   9--- ### y),,, ,,Y77888  ++I66777  ++I6677777rcn||dd}|||jj|d}|jj|d}|j|||j|||j||||jj || |jj |dSNrJrYlink1link2) rrKr:rr)r`rr+r1r*r(rr link_path1 link_path2s rtest_rename_symlink_to_symlinkz/FakeOsModuleTest.test_rename_symlink_to_symlink s NN5%00   """W\&&y':: W\&&y'::   :...  :... z:... ,,Z88999  ++J7788888rc||d}|d}|jj|d}|||j|||||tj |jj ||dSNdir_linkru inner_dir) rrKrr)r`r:rrSrTr6r+rrGrdir_in_dir_paths r0test_rename_symlink_to_symlink_for_parent_raiseszAFakeOsModuleTest.test_rename_symlink_to_symlink_for_parent_raisess >>*-->>%((',++HkBB !!! (+++ ((( ## L$'.(O     rc(t||d}|||d}|j|j||jj|d}|d}|j ||| |t|j |jdS)NbetabBeta) rcheck_case_insensitive_fsrKr:rrrr)r`r+r-r|rz)rresultdir_path_lowerr path1dir_path_uppers rcheck_rename_case_with_symlinkz/FakeOsModuleTest.check_rename_case_with_symlink"s%''' &&(((// '''NN3''   222 !!)V44// un--- (G(G!H!HIIIIIrc\||ddgdS)NrNrM)r>rUr"s r!test_rename_case_with_symlink_macz2FakeOsModuleTest.test_rename_case_with_symlink_mac.s2  ++S&M:::::rc\||ddgdS)NrOrN)rrUr"s r%test_rename_case_with_symlink_windowsz6FakeOsModuleTest.test_rename_case_with_symlink_windows3s2 !!! ++VSM:::::rc||dd}|||jj|d}|tj|jj ||dSNrJrYnew_dir) rrKr:rr)r`rSrTr6r+rrnew_paths rtest_recursive_rename_raisesz-FakeOsModuleTest.test_recursive_rename_raises7sx NN5%00   """7<$$Y :: ##EL$'.)XVVVVVrc$|d}|||d}|jj|d}|||j||dS)Nruold_filenew_file)rKr:rr)r`r'r+)rrrr/s r#test_rename_file_to_parent_dir_filez4FakeOsModuleTest.test_rename_file_to_parent_dir_file>s>>%(( !!!NN:..  ))(J??  ### y-00000rc||dd}|||tj|jj||dzdSNrJryz/new)rrKr'rSrTr[rr+rs r0test_rename_with_target_parent_file_raises_posixzAFakeOsModuleTest.test_rename_with_target_parent_file_raises_posixGsq NN5%00  ### ## M47>9i&6H     rc ||dd}|||tj|jj||jj |ddSNrJrynew) rrKr'rSrTr6rr+r)r`rs r2test_rename_with_target_parent_file_raises_windowszCFakeOsModuleTest.test_rename_with_target_parent_file_raises_windowsOs !!!NN5%00  ### ## L GN  GL  i / /      rc||d}|jj|d}|jj|d}|||j|||j||||jj |dSNrJslinkra) rrKrr)r`r'rr+r1r*rrr rs rtest_rename_symlink_to_sourcez.FakeOsModuleTest.test_rename_symlink_to_sourceZs NN5)) GL%%i99 GL%%i88  ###  9--- y),,, ,,Y7788888rc||dd}|jj|d}|jj|d}|||j|||tj |jj ||dSNrJrYrGru) rrKrr)r`r:rrSrTrjr+rrr rs r!test_rename_symlink_to_dir_raisesz2FakeOsModuleTest.test_rename_symlink_to_dir_raisesds NN5%00 GL%%i<< 7<$$Y66 !!! ),,, ##EL$'.)XVVVVVrc||d}|||jj|d}|jj|d}|j|||j||||jj || |jj |||jj |dSrl) rrKr:rr)r`rr+r1r*r(rrns rtest_rename_broken_symlinkz+FakeOsModuleTest.test_rename_broken_symlinkms  NN5))   """GL%%i99 GL%%i88   9--- y),,, ,,Y77888  ,,Y77888 ,,Y7788888rcdD]\}}||}||}||jj|dd||jj|||jj||j||||jj|||jj|| |jj|dd| s3| d|j |jdSz)Can rename a directory to an unused name.))wxyywrv)abccbcdeedrwrrN)rKr'rr)r`r(r*r1r+r, use_real_fsr-rk get_objectst_nlinkrold_pathr^s rtest_rename_directoryz&FakeOsModuleTest.test_rename_directoryys"J S S Hh~~h//H~~h//H   TW\..xAAF  S S S OODGL//99 : : :   TW\00:: ; ; ; GNN8X . . .   TW\00:: ; ; ; OODGL//99 : : :    1 1(G D Df M M M##%% S  DO$>$>x$H$H$QRRR S Src|d}|d}|||||||jj||dSNrura)rKr:r'rSrr+rrQrrs r.check_rename_directory_to_existing_file_raisesz?FakeOsModuleTest.check_rename_directory_to_existing_file_raisessn>>%((NN6**  !!! ### ##Hdgnh RRRRRrcl||tjdSr!rrrTr[r"s r3test_rename_directory_to_existing_file_raises_posixzDFakeOsModuleTest.test_rename_directory_to_existing_file_raises_posix0  ;;EMJJJJJrcl||tjdSr!rrrTrr"s r5test_rename_directory_to_existing_file_raises_windowszFFakeOsModuleTest.test_rename_directory_to_existing_file_raises_windows0 !!! ;;ELIIIIIrc2||dd}|dd}|||||tj|jj||dSz?Renaming to an existing directory raises OSError under Windows.rJrYryN)rrKr:rSrTrrr+rs r>%//>>%// !!! !!! ##EL$'.(HUUUUUrc|dt|dd}|||d}|j|||j||||jj |||jj |dSNF) skip_posixrurar) skip_real_fs_failurerrKr'rrr+r(r)r*rs r8test_rename_to_a_hardlink_of_same_file_should_do_nothingzIFakeOsModuleTest.test_rename_to_a_hardlink_of_same_file_should_do_nothings !!U!333%'''NN5&11  ###NN6**   Y *** y),,,  ++I66777  ++I6677777rct|d}|||jj|d}|j|||jj|dd}|||jj|dd}|j||| |jj || |jj |dS)NrJrmrMgamma) rrKr:rr)r`rr'rr(r*r1rDrr symlink_pathrr s r test_hardlink_works_with_symlinkz1FakeOsModuleTest.test_hardlink_works_with_symlinks%'''NN5))   """w|((G<<   <000GL%%i&AA  ###GL%%i'BB   Y ***  ++I66777 ,,Y7788888rc2||dd}|dd}|||||tj|jj||dSr)rrKr:rSrTrYrreplacers r:test_replace_existing_directory_should_raise_under_windowszKFakeOsModuleTest.test_replace_existing_directory_should_raise_under_windowss !!!>>%//>>%// !!! !!! ##EL$'/8XVVVVVrcN||dd}|d}||jj|d|||j||||jj|jj|d| |jj|dSURenaming to an existing directory changes the existing directory under Posix.rJrYrvsubN) rrKr:rr)r`r+r(r*r1rs r-test_rename_to_existing_directory_under_posixz>FakeOsModuleTest.test_rename_to_existing_directory_under_posixs >>%//>>'**  ))(E::;;; !!! x***  ++DGL,=,=h,N,NOOPPP ,,X6677777rc2||ddd}|d}|||||t j|jj||dSNrJrYryrv) rrKr'r:rSrTrjrr+rrr^s r9test_rename_file_to_existing_directory_raises_under_posixzJFakeOsModuleTest.test_rename_file_to_existing_directory_raises_under_posixs NN5%77 >>'** ### !!! ##EL$'.)XVVVVVrc||dd}|dd}||jj|d||jj|d|t5|j||ddddS#1swxYwYdS)rrJrYryrN) rrKr:rr)r`rrr+rs r;test_rename_to_existing_dir_under_posix_raises_if_not_emptyzLFakeOsModuleTest.test_rename_to_existing_dir_under_posix_raises_if_not_emptys >>%//>>%//  ))(E::;;;  ))(E::;;;   w ' ' / / GNN8X . . . / / / / / / / / / / / / / / / / / /sC**C.1C.c||jdd}d}|j||t j|jj||dS)z5Renaming to another filesystem device raises OSError.z/mount/foo/barz /mount/barN) rirkadd_mount_pointr'rSrTEXDEVrr+rs r*test_rename_to_another_device_should_raisez;FakeOsModuleTest.test_rename_to_another_device_should_raisesp  ''111 ##H--- ##EK8TTTTTrc&||d}|jj|d}|jj|d}||d||d||jj|||jj||j||| |jj|||jj|| |ddSz,Can rename a file to a used name under Unix.rvr(r)test contents 1rtest contents 2N) rrKrr)r`r'r(r*r+r1r,r-s r"test_rename_to_existent_file_posixz3FakeOsModuleTest.test_rename_to_existent_file_posixsP NN7++  )))[AA  )))[AA  1BCCC 1BCCC  ++M::;;;  ++M::;;; }m444 ,,];;<<<  ++M::;;; M+<=====rcT||d}|jj|d}|jj|d}||d||d||jj|||jj||tj |jj ||dSz >CB> CCC3)D))D-0D-cX||ddSN)rrr"s r#test_append_mode_tell_linux_windowsz4FakeOsModuleTest.test_append_mode_tell_linux_windowsUs. $$&&& 22155555rcX||ddSr)r>rr"s rtest_append_mode_tell_macosz,FakeOsModuleTest.test_append_mode_tell_macosZs.  22155555rc |d}||dd5}|d|d|ddddS#1swxYwYdS)NrJrrr)rKrrr-rrs r#test_tell_after_seek_in_append_modez4FakeOsModuleTest.test_tell_after_seek_in_append_mode_sNN5)) YYy#Y 7 7 *1 FF1III   Q ) ) ) * * * * * * * * * * * * * * * * * *s>A99A=A=c6|d}||dd5}|d|d|d|ddddS#1swxYwYdS)NrJrrraar)rKrrrr-rrs r'test_tell_after_seekback_in_append_modez8FakeOsModuleTest.test_tell_after_seekback_in_append_modefsNN5)) YYy#Y 7 7 *1 GGDMMM FF1III   Q ) ) ) * * * * * * * * * * * * * * * * * *sABBBc|||jj|j|jjzdSr!)r(rr)isdirrr*r"s r!test_dir_with_trailing_sep_is_dirz2FakeOsModuleTest.test_dir_with_trailing_sep_is_dirns9 dgl00$'+1MNNOOOOOrc|d|jjz}|j||||jj||jdSNru)rKrr*rrSr+r)rerrorrs r"check_rename_dir_with_trailing_sepz3FakeOsModuleTest.check_rename_dir_with_trailing_seprsV>>%((47;6  h ##E47>8T^TTTTTrcl||tjdSr!)rrrT ENOTEMPTYr"s r'test_rename_dir_with_trailing_sep_posixz8FakeOsModuleTest.test_rename_dir_with_trailing_sep_posixws0  //@@@@@rcl||tjdSr!)rrrTrr"s r)test_rename_dir_with_trailing_sep_windowsz:FakeOsModuleTest.test_rename_dir_with_trailing_sep_windows|s0 !!! // =====rc|d}|jj|d}|jj|dd}|jj|d}|jj|dd}||||d||jj|||jj|||jj|||jj||j ||||jj|||jj|||jj|||jj|| |ddSzTest a rename of a directory.rvbeforeraafterpayloadrN) rKrr)r`r:r'r(r*r1r+r,rrNr before_filer after_files rtest_rename_dirz FakeOsModuleTest.test_rename_dirsNN7++ W\&&y(;; gl'' 8VDD GL%%i99 W\&&y'6BB   ### y999  ++J77888  ++K88999 ,,Y77888 ,,Z88999 z9--- ,,Z88999 ,,[99:::  ++I66777  ++J77888 J 22222rc|||d}|jj|d}|jj|d}|||j|}|j dz |_ |j |dd|j |d|||j|}| |j |j |j |||j|}||j |j ||j|j||j|j||j|jdS)zTest if rename preserves mtime.rvr(r)iN)rrirKrr)r`r'rkr}st_mtimechownrrr+r-r/st_uidst_gid)rrNr.r/rarbs rtest_rename_preserves_statz+FakeOsModuleTest.test_rename_preserves_stats  NN7++  )))[AA  )))[AA  '''?--m<<$-4  mS#...  mU+++ '''?--m<< H-x/@AAA }m444?--m<< *H,=>>> )8+;<<< (/::: (/:::::rc|d}d}|jj|d}||||j|||||dSz2Test renaming when old and new names are the same.rvz Spam eggseggsrN)rKrr)r`r'r+r,rrNr rs rtest_rename_same_filenamesz+FakeOsModuleTest.test_rename_same_filenamess|NN7++ # GL%%i88  ];;; y),,, I}55555rc|d}|dd}|dd}||||jj||j|||jj||||||j||jd||jj||jd|jd||jj|dS)Can remove a directory.rvabccdrzz../cdeedrhN rKr:r(rr)r*rmdirr1rLrrNsub_dir other_dirs r test_rmdirzFakeOsModuleTest.test_rmdiroNN7++ ..'22NN7G44   """  ++I66777  i    ,,Y77888      """  g  j!!! ,,Y77888  d  g ,,W5566666rcT|d}|jj|d}||||jj||tj |jj |dS)z9Raises an exception if the target directory is not empty.rvrwN) rKrr)r`r'r(r*rSrTrrrs rtest_rmdir_raises_if_not_emptyz/FakeOsModuleTest.test_rmdir_raises_if_not_emptysNN7++ GL%%i99  ###  ++I66777 ##EOTW]INNNNNrc|d}|jj|d}||||jj||tj |jj ||||jj ddS)z5Raises an exception if the target is not a directory.rvrwrN) rKrr)r`r'r(r*rSrTr[r)rrQrNrs r#check_rmdir_raises_if_not_directoryz4FakeOsModuleTest.check_rmdir_raises_if_not_directorysNN7++ GL%%i99  ###  ++I66777 ##EM47=)LLL ##HdgmSAAAAArcl||tjdSr!)rrrTr6r"s r(test_rmdir_raises_if_not_directory_posixz9FakeOsModuleTest.test_rmdir_raises_if_not_directory_posixs0  00>>>>>rcl||tjdSr!)rrrTrYr"s r*test_rmdir_raises_if_not_directory_windowsz;FakeOsModuleTest.test_rmdir_raises_if_not_directory_windowss0 !!! 00>>>>>rc|d}||jj||t j|jj|dS)z1Raises an exception if the target does not exist.rvN) rKr1rr)r*rSrTrUrrMs rtest_rmdir_raises_if_not_existz/FakeOsModuleTest.test_rmdir_raises_if_not_exists]NN7++  ,,Y77888 ##EL$'-KKKKKrc|t|dd}|jj|d}|||jj|d}|j|||j|dz| |jj |dS)NrJrYr)rMz/alpha rrrKrr)r`r:rrr1r*rrrr s rtest_rmdir_via_symlinkz'FakeOsModuleTest.test_rmdir_via_symlink !!!%'''NN5%00 7<$$Y88 !!!GL%%i88   9---  i(*+++ ,,X6677777rc||jj||j||jj| Sr!)r(rr)r* removedirsrMs rremove_dirs_checkz"FakeOsModuleTest.remove_dirs_checksW  ++I66777 9%%%7<&&y1111rc|gd}|D]o}|||||jj||p|tj |j ||d|tj |j ||d|| ||d||jj||d| |jj||d||jj||d|tj |j ||d| |jj||d||dd|j |d|| |dd| |jj|dd| |jj|ddS) N)test1)rtest2)rextra)rr test3rrr{rrr r")rir:rKr(rr)r*rSrTrrr1EBUSYrk)rdatarNs rtest_removedirsz FakeOsModuleTest.test_removedirss       L LI OODNN955 6 6 6 OODGL//y0I0IJJ K K K K ## OT3T^^DG5L5L    ## OT3T^^DG5L5L    ..t~~d1g/F/FGGHHH  ++DNN47,C,CDDEEE ,,T^^DG-D-DEEFFF  ++DNN47,C,CDDEEE ## K/Q1H1H   ,,T^^DG-D-DEEFFF w88999 ""4>>'#:#:;;; ..t~~gw/O/OPPQQQ ,,T^^GW-M-MNNOOO ,,T^^G-D-DEEFFFFFrc||j|j|jj|jd|jjjz}||jj|| tj |jj |dS)z(Raises exception if asked to remove '/'.rN) rirrrr) splitdriver*r(r*rSrTr#rrMs r'test_removedirs_raises_if_removing_rootz8FakeOsModuleTest.test_removedirs_raises_if_removing_roots   dn%%%GL++DN;;A>AQQ   ++I66777 ##EK1CYOOOOOrc||dd}||||jj||tj |jj ||jj |\}}|jj |d|jjj kr||jj||jj |\}}|jj |d|jjj kdSdS)zRaises exception if asked to remove '/' as part of a larger operation. All of other directories should still be removed, though. rJrYrN)rirKr:r(rr)r*rSrTr#rsplitr'r*r1)rrNhead unused_tails r/test_removedirs_raises_if_cascade_removing_rootz@FakeOsModuleTest.test_removedirs_raises_if_cascade_removing_root$s< NN5%00   """  ++I66777 ##EK1CYOOO GL..y99kgl%%d++A.$',2BBB   TW\00;; < < < $ 2 24 8 8 D+gl%%d++A.$',2BBBBBBBrc||d|dd}||||jj||j|||jj|dS)z:removedirs works on directory names with trailing slashes.ryrJrYN)r:rKr(rr)r*rr1rMs r#test_removedirs_with_trailing_slashz4FakeOsModuleTest.test_removedirs_with_trailing_slash4s u--...NN5%00   """  ++I66777 9%%% ,,Y7788888rc8||d}|d}|||j|||t j|jj|dS)NrurG) rrKr:rrrSrTr[r)rrrGs r'test_remove_dirs_with_top_symlink_failsz8FakeOsModuleTest.test_remove_dirs_with_top_symlink_fails>s >>%((>>*-- !!! (+++ ##EM473ExPPPPPrcH||d}|d}|||j|||jj|d}|||j|||jj || |jj |dSNrurGrd) rrKr:rrr)r`rr1r*r(rrrG dir_in_dirs r.test_remove_dirs_with_non_top_symlink_succeedsz?FakeOsModuleTest.test_remove_dirs_with_non_top_symlink_succeedsFs >>%((>>*-- !!! (+++W\&&x88   ### :&&& ,,Z88999  ++H5566666rc|d}||j||j|||jd|z|j||j|||jd|d||j||jd||jjd|zdS)z&mkdir can create a relative directory.rvz/%s/z../abccbz /%s/abccbN) rir1rkr*rrr(rLr)rMs r test_mkdirzFakeOsModuleTest.test_mkdirSs*   // ::;;;  i    ..uy/@AABBB  i     i    ../J9/J/Jy/J/JKKLLL  i     j!!!  ++K),CDDEEEEErc|d}||jj||j|||jj|||jj|ddS)z9mkdir can create a directory named with a trailing slash.rJN)rKr1rr)r*rr(rMs rtest_mkdir_with_trailing_slashz/FakeOsModuleTest.test_mkdir_with_trailing_slashasNN5))  ,,Y77888  i     ++I66777  ++DNN5,A,ABBCCCCCrc`d}|tj|jj|dS)z6mkdir raises exception if creating directory named ''.r2N)rSrTrUrrrMs r)test_mkdir_raises_if_empty_directory_namez:FakeOsModuleTest.test_mkdir_raises_if_empty_directory_nameis+  ##EL$'-KKKKKrcd}|d}||jj||t j|jj|dS)z:mkdir raises exception if parent directory does not exist.rv/fooN)r1rr)r*rSrTrUrrparentrNs rtest_mkdir_raises_if_no_parentz/FakeOsModuleTest.test_mkdir_raises_if_no_parentns\OOO  ,,V44555 ##EL$'-KKKKKrc||dd}|jj|d}|jj|d}|||j|||tj |jj |dSNrJrYrru) rrKrr)r`r:rrSrTr[rrrs r%test_mkdir_raises_on_symlink_in_posixz6FakeOsModuleTest.test_mkdir_raises_on_symlink_in_posixus NN5%00 GL%%i?? 7<$$Y66 !!! ),,, ##EM47=)LLLLLrcR|t|dd}|jj|d}|jj|d}|||j|||j|| |jj || |jj |dSrD) rrrKrr)r`r:rrr1r*r(rrs r%test_mkdir_removes_symlink_in_windowsz6FakeOsModuleTest.test_mkdir_removes_symlink_in_windows~s !!!%'''NN5%00 GL%%i?? 7<$$Y66 !!! ),,,  i    ,,Y77888  ++H5566666rc|d}||||jj||tj|jj |dSz3mkdir raises exception if directory already exists.rvN) rKr:r(rr)r*rSrTrrrMs r%test_mkdir_raises_if_directory_existsz6FakeOsModuleTest.test_mkdir_raises_if_directory_existssmNN7++   """  ++I66777 ##EL$'-KKKKKrcT|d}|jj|d}||||jj||tj |jj |dS8mkdir raises exception if name already exists as a file.rvrwN) rKrr)r`r'r(r*rSrTrrrs r test_mkdir_raises_if_file_existsz1FakeOsModuleTest.test_mkdir_raises_if_file_existssNN7++ GL%%i99  ###  ++I66777 ##EL$'-KKKKKrc|d}|jj|d}|||||jj|jj|ddSrMrvrwffN)rKrr)r`r'rSrr error_typerNrs r$check_mkdir_raises_if_parent_is_filez5FakeOsModuleTest.check_mkdir_raises_if_parent_is_filesNN7++ GL%%i99  ### ##  tw|'8'8D'I'I     rcl||tjdSr!rrTrTr[r"s r)test_mkdir_raises_if_parent_is_file_posixz:FakeOsModuleTest.test_mkdir_raises_if_parent_is_file_posix0  11%-@@@@@rcl||tjdSr!rrTrTrUr"s r+test_mkdir_raises_if_parent_is_file_windowsz>%// !!!NN5&11  ),,,',##Iy99  g  ++G4455555rcl|d}|jj|d}||jj||j|||jj|dSz>makedirs can create a directory even if parent does not exist.rvrJN)rKrr)r`r1r*makedirsr(r@s r test_makedirszFakeOsModuleTest.test_makedirss((GL%%fe44  ,,V44555 ###  ++I6677777rc@|d}|jj|d}||||jj||||jj|dSzAmakedirs raises exception if a parent component exists as a file.rvrwN) rKrr)r`r'r(r*rSrorrSrrNs r'check_makedirs_raises_if_parent_is_filez8FakeOsModuleTest.check_makedirs_raises_if_parent_is_filesNN7++ GL%%i99  ###  ++I66777 ##J0@)LLLLLrcl||tjdSr!rrtrTr[r"s r,test_makedirs_raises_if_parent_is_file_posixz=FakeOsModuleTest.test_makedirs_raises_if_parent_is_file_posix0  44U]CCCCCrcl||tjdSr!rrtrTrUr"s r.test_makedirs_raises_if_parent_is_file_windowsz?FakeOsModuleTest.test_makedirs_raises_if_parent_is_file_windows0 !!! 44U\BBBBBrcF||d}|j|d||t j|jj|jj |ddSN broken_linkrtnewdir) rrKrrrSrTrUror)r`r7s r-test_makedirs_raises_if_parent_is_broken_linkz>FakeOsModuleTest.test_makedirs_raises_if_parent_is_broken_link s NN=11  w//;;; ## L G  GL  i 2 2     rct|d}|jj|d}|j|||tj|jj |dS)Nr) rrKrr)r`rrSrTrrorr r3s r.test_makedirs_raises_if_parent_is_looping_linkz?FakeOsModuleTest.test_makedirs_raises_if_parent_is_looping_linkss%'''NN6** gl'' 6::   Y/// ##EL$'2BINNNNNrc||dd}|||jj|d}|j|||jj|d}|j|||jj |dS)NrJrYlinkedrname) rrKr:rr)r`rror(r*)rbase_dirlink_dirr\s r"test_makedirs_if_parent_is_symlinkz3FakeOsModuleTest.test_makedirs_if_parent_is_symlinks >>%// !!!7<$$Xx88 (+++',##Hc22 g&&&  ++G4455555rc@||d}|j||j|d|dd}t sO|t5|j|ddddS#1swxYwYdS|j|| |jj |dS)z+makedirs raises exception if access denied.rrirNN) rrKrrrrrrror(r)r*rMs r%test_makedirs_raises_if_access_deniedz6FakeOsModuleTest.test_makedirs_raises_if_access_denied%s@ NN3''   i     i'''NN3,, yy <""7++ , ,  +++ , , , , , , , , , , , , , , , , , , G  Y ' ' ' OODGL// :: ; ; ; ; ;sCC  C c|dd}||||jj||tj|jj ||j |d||jj|dSz#makedirs uses the exist_ok argumentrvrJTexist_okN) rKr:r(rr)r*rSrTrrorMs rtest_makedirs_exist_okz'FakeOsModuleTest.test_makedirs_exist_ok6sNN7E22   """  ++I66777 ##EL$'2BINNN T222  ++I6677777rc<||d}|j|d|jj|d}t s\|tj |jj |d|tj |jj |ddS|j || |jj |dS)NrJrrrYTrF) rrKrrr)r`rrSrTrYror(r*)rrNsubdirs r$test_makedirs_in_write_protected_dirz5FakeOsModuleTest.test_makedirs_in_write_protected_dir@s  NN5))   ie ,,,""9e44yy 9  ' ' dg. (     ' ' dg. (      G  V $ $ $ OODGL//77 8 8 8 8 8rc|tj|jjdd|tj|jjdddS)Nr2FrT)rSrTrUrror"s r"test_makedirs_raises_on_empty_pathz3FakeOsModuleTest.test_makedirs_raises_on_empty_pathPsR ##EL$'2BBQV#WWW ##EL$'2BBQU#VVVVVrc |dddd}|j|||jj|dd||jj|dd||jj|ddddS)NbaserJrhrY)rKrror(r)rr1rs r!test_makedirs_with_relative_pathsz2FakeOsModuleTest.test_makedirs_with_relative_pathsTs~~feT599   **4>>&%+H+HIIJJJ  **4>>&%+H+HIIJJJ ++DNN65%,P,PQQRRRRRrc|t5|jdddddS#1swxYwYdSNzero)rrrfsyncr"s rtest_fsync_raises_on_non_intz-FakeOsModuleTest.test_fsync_raises_on_non_int]s   y ) ) " " GMM& ! ! ! " " " " " " " " " " " " " " " " " "sAA Acz||t|jjddSr)r:rrr fdatasyncr"s r test_fdatasync_raises_on_non_intz1FakeOsModuleTest.test_fdatasync_raises_on_non_intas7  )TW%6?????rc\|tj|jjddS)Nr)rSrTrrrr"s rtest_fsync_raises_on_invalid_fdz0FakeOsModuleTest.test_fsync_raises_on_invalid_fdes& ##EKDDDDDrc||tj|jjd|tj|jjddS)Nrr)r:rSrTr6rrrr"s r#test_fdatasync_raises_on_invalid_fdz4FakeOsModuleTest.test_fdatasync_raises_on_invalid_fdhsX  ##EL$'2CQGGG ##EK1BCHHHHHrc||d}||d||dd5}|}|j||tj |jj|dzddddS#1swxYwYdSN test_filedummy file contentsrrrrr) rrKr'rrrrrSrTrrtest_file_pathrtest_fds rtest_fsync_pass_posixz&FakeOsModuleTest.test_fsync_pass_posixns  44 2GHHH YY~sVY < < S &&((G GMM' " " "  ' ' TW]GcM R R R  S S S S S S S S S S S S S S S S S SsACC Cc~||d}||d||dd5}|}|j||tj |jj|dzdddn #1swxYwY||dd5}|}|tj |jj|ddddS#1swxYwYdS) Nrrrr+rrrr) rrKr'rrrrrSrTrrs rtest_fsync_pass_windowsz(FakeOsModuleTest.test_fsync_pass_windowsys !!! 44 2GHHH YY~tfY = = S&&((G GMM' " " "  ' ' TW]GcM R R R  S S S S S S S S S S S S S S S YY~sVY < < M &&((G  ' ' TW]G L L L M M M M M M M M M M M M M M M M M Ms&ACC C%AD22D69D6cn||d}||d||dd}|}|j||tj |jj|dzdSr) r:rKr'rrrrrSrTrrs rtest_fdatasync_passz$FakeOsModuleTest.test_fdatasync_passs  44 2GHHHIIncFICC ""$$ '""" ##EK1BGcMRRRRRrcD||d}|||j|d|d|j|j||j ||jj ||j ||jj ||j ||jj ||j ||jj ||j ||jdS)N some_file)rrKr6rrassert_mode_equalr+r/r(accessF_OKrDrErFrGrs rtest_access700zFakeOsModuleTest.test_access700s8 ~~k** D!!!  dE""" udgll4&8&8&@AAA tTW\::;;; tTW\::;;; tTW\::;;; tTW\::;;; tTX6677777rc||d}|||j|d|d|j|j||j ||jj ||j ||jj ||j ||jj | |j ||jj| |j ||j||j ||jdS)Nr)rrKr6rrrr+r/r(rrrDrEr1rFrGrHrs rtest_access600zFakeOsModuleTest.test_access600s` ~~k** D!!!  dE""" udgll4&8&8&@AAA tTW\::;;; tTW\::;;; tTW\::;;; dgl;;<<< dh77888 tTW5566666rc||d}|||j|d|d|j|j||j ||jj ||j ||jj | |j ||jj | |j ||jtrm||j ||jj||j ||jdS| |j ||jj| |j ||jdS)Nrri)rrKr6rrrr+r/r(rrrDr1rFrGrrErHrs rtest_access400zFakeOsModuleTest.test_access400s ~~k** D!!!  dE""" udgll4&8&8&@AAA tTW\::;;; tTW\::;;; dgl;;<<< dh77888 99 < OODGNN4>> ? ? ? OODGNN499 : : : : :   TW^^D$',?? @ @ @   TW^^D$':: ; ; ; ; ;rcrt||d}|||d}||||j|d||j||jj ||j||jj trl||j||jj ||j||j nk||j||jj ||j||j ||j||jj||j||j|jrdnd}||j||jj |||j||jj |||j||jj ||jso||j||jjd||j||jd||j||j |dS)Nrlink_to_some_fileriFr)rrirKr6rrrr(rrrDrrErHr1rFrGr,)rr)r rs rtest_access_symlinkz$FakeOsModuleTest.test_access_symlinks%''' ~~k** D!!!NN#677  It,,,  i''' y$',??@@@ y$',??@@@ 99 A OODGNN9dglCC D D D OODGNN9dg>> ? ? ? ?   TW^^Itw|DD E E E   TW^^Itw?? @ @ @  47<@@AAA  48<<===#'"4?$$%  GNN9dglON T T     GNN9dglON T T     GNN9dglON T T   ! X OOy$',NN    OODGNN9dhPUNVV W W W  GNN9dgN O O     rc$|ddd}||jj|||j||jj||j||jj||j||jj||j||jj ||j||j ||j||j dS)Nr_r`ra) rKr1rr)r*rrrDrErFrGrHrs rtest_access_non_existent_filez.FakeOsModuleTest.test_access_non_existent_files/~~eZ88 ,,T22333 dgl;;<<< dgl;;<<< dgl;;<<< dgl;;<<< dh77888 dg6677777rc||dd}|t5|j||jjddddn #1swxYwY|t5|j||jjdddddS#1swxYwYdS)NrJrYT) effective_idsFr)rrKrNotImplementedErrorrrrrs r*test_arguments_not_supported_under_windowsz;FakeOsModuleTest.test_arguments_not_supported_under_windowssk !!!~~eU++   2 3 3 C C GNN4TN B B B C C C C C C C C C C C C C C C   2 3 3 F F GNN4uN E E E F F F F F F F F F F F F F F F F F Fs$(A99A=A=(CCCc|||d}|||j|d|j|}|d|j| |jt j z| |jt j zdSNrc ) rrirKr6rrr+rr/r(r0r1r2rr)r4s r test_chmodzFakeOsModuleTest.test_chmods  ~~k** D!!!  dF### W\\$   vrz222  T\1222 dl233333rc.tjdkr|||t j|jjdd| d}| || |d5}|j | }|j|jd|j |}|d|j|j|jd|j |}|d|jddddS#1swxYwYdS) Nr{ rrrrrrr%)sys version_inforrirSrTrrrrKr6rr+rrrr/fchmodrr)rr4s rtest_chmod_uses_open_fd_as_pathz0FakeOsModuleTest.test_chmod_uses_open_fd_as_path s  g % %  ! ! # # #  ##EK6JJJ~~k** D!!! YYtfY - - 6ahhjj))B GMM!)U + + +d##B  " "5"* 5 5 5 GNN19e , , ,d##B  " "5"* 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s&CF  FFrz.also available under Windows since Python 3.13c|||d}||||d5}|t 5|j| ddddn #1swxYwY|t5|j | ddddn #1swxYwYddddS#1swxYwYdS)Nrrrr%) rrirKr6rrrrrrrr)rr)rs r;test_chmod_uses_open_fd_as_path_not_available_under_windowszLFakeOsModuleTest.test_chmod_uses_open_fd_as_path_not_available_under_windows s !!! ~~k** D!!! YYtfY - - 2""9-- 1 1 ahhjj%000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"">22 2 2qxxzz5111 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2sZ*D6.B?3 D6?C D6C D6$.D D6D" "D6%D" &D66D:=D:c4||d}|||d}||||j|d|j|}|d|j|j|d}| t j dt j |jdzdS)NrrrFrr) rrKr6rrrr+rr/r-r.rr)r r4s rtest_chmod_follow_symlinkz*FakeOsModuleTest.test_chmod_follow_symlink.s ~~k** D!!!NN#677  It,,,  i((( W\\) $ $ vrz222 W\\)U\ ; ; e,,dl2:.F.F.NOOOOOrc6tjdkr|nt|d}|||d}||||jj|jj vstrR| t5|j|ddddddS#1swxYwYdS|j|dd|j |}|jrdnd}|||j|j |d}|jrd nd}|||jdS) NrrrrFrr&r%r)rrrrrKr6rrrsupports_follow_symlinksr rrr+is_macosrr/r,)rr)r r4r5s rtest_chmod_no_follow_symlinkz-FakeOsModuleTest.test_chmod_no_follow_symlink<s  g % %  ! ! # # # # ) + + +~~k** D!!!NN#677  It,,, 7= @ @ @G @""#677 H H i GGG H H H H H H H H H H H H H H H H H H GMM)VUM C C Ci((B M455uD  " "4 4 4 4i??B .:55FD  " "4 4 4 4 4 4sC--C14C1c |||d}|||d}||||j|d|j|}|d|j |j |}|d|j dS)z9lchmod shall behave like chmod with follow_symlinks=True.rrrr&N) rrirKr6rrlchmodr+rr/rrs r test_lchmodzFakeOsModuleTest.test_lchmodQs  ~~k** D!!!NN#677  It,,, y&))) W\\) $ $ ubj111 W]]9 % % vrz22222rc|||d}|||j|d|j|}|d|j| |jt j z| |jt j zdS)Nsome_diri) rrirKr;rrr+rr/r1r0r(r2rs rtest_chmod_dirzFakeOsModuleTest.test_chmod_dir`s  ~~j))   &&&  dF### W\\$   vrz222 dl2333  T\122222rc|ddd}||jj| |j|d|ddS#t$rK}|tj |j |||j Yd}~dSd}~wwxYw)Nr_r`rar8rb) rKr1rr)r*rrcrr-rTrUr])rr)rds rtest_chmod_non_existentz(FakeOsModuleTest.test_chmod_non_existentms~~eZ88 ,,T22333 6 GMM$ & & & II. / / / / / 6 6 6   U\8> : : :   T8#4 5 5 5 5 5 5 5 5 5 6s 0A== CAC  Cc||d}|||j|dd|j|}||t jd||t jd|j|dd|j|}||t jd||t jd|j|dd|j|}||t jd||t jddS)Nrder) rirKr'rrr+r-ST_UIDST_GIDrrr4s rtest_chown_existing_filez)FakeOsModuleTest.test_chown_existing_filezsh NN;//  ###  ic*** W\\) $ $ DK#... DK#...  ic*** W\\) $ $ DK#... DK#...  iR((( W\\) $ $ DK#... DK#.....rc(|||tj|jjddd|dd}||| |d5}|j|j dd|j |}| |tj dddddS#1swxYwYdS)NrrrrJrYrr)rrirSrTrrrrKr'rrr+r-r)rrrr4s rtest_chown_uses_open_fd_as_pathz0FakeOsModuleTest.test_chown_uses_open_fd_as_paths/   ##EK3LLLNN5%00  ### YYy6Y 2 2 3a GMM!)S# . . .i((B   R _c 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3sA"DD D c||d}|||d}||||j|dd|j|}||t jd||t j d|j|d}| |t jd| |t j ddSNrrrrFr) rirKr'rrrr+r-rrrrrr r4s rtest_chown_follow_symlinkz*FakeOsModuleTest.test_chown_follow_symlinks NN;//  ###NN#677  Iy111  ic*** W\\) $ $ DK#... DK#... W\\)U\ ; ; Bt{OS111 Bt{OS11111rc||d}|||d}||||j|ddd|j|}||t jd||t j d|j|d}| |t jd| |t j ddSr) rirKr'rrrr+rrrr-rs rtest_chown_no_follow_symlinkz-FakeOsModuleTest.test_chown_no_follow_symlinks NN;//  ###NN#677  Iy111  ic5 AAA W\\) $ $ Bt{OS111 Bt{OS111 W\\)U\ ; ; DK#... DK#.....rc"||d}|||t|jj|dd|t|jj|dddS)z$os.chown() with bad args (Issue #30)rusernamer groupnameN)rrKr'rrrrrs rtest_chown_bad_argumentsz)FakeOsModuleTest.test_chown_bad_argumentss NN;//  ### )TW]Iz2NNN )TW]Ir;OOOOOrc||d}||jj||tj|jj |dddS)Nrr) rrKr1rr)r*rSrTrUrrs r1test_chown_nonexisting_file_should_raise_os_errorzBFakeOsModuleTest.test_chown_nonexisting_file_should_raise_os_errorst NN;//  ,,Y77888 ##EL$'-CQTUUUUUrc$||tr|d|d}||d|j|dd|t5| |ddd 5 dddn #1swxYwYdddn #1swxYwY|d }| ||t5|j ||jj |d ddddS#1swxYwYdS) NzNon-root test onlyz readonly-dirr9rrz /file.txtrrrr)rrirskipTestrKr:rrrPermissionErrorrr'rr)r`)rro_dirrs r#test_fail_add_entry_to_readonly_dirz4FakeOsModuleTest.test_fail_add_entry_to_readonly_dirsG   99 0 MM. / / /// U+++  fa###   / /  f///vFF                                NN:..  ###    / / K K GLLDGL$5$5fj$I$I J J J K K K K K K K K K K K K K K K K K KsH.C/ C C/C C/C C//C36C3>:FF  F c|d}ddg}gd}|||D]7}|jj||}||8|D]7}|jj||}||8|||j|}t|\}}} || | ||| ||| || dS)z/Directory classification should work correctly.rJbar1baz2)baz1bar2baz3N) rKr:rr)r`r'r{walknextr-) rroot_directorytest_directories test_filesrNr generatorrootdirsr~s r test_classify_directory_contentsz1FakeOsModuleTest.test_classify_directory_contentssa.."F+---  ''') ' 'I )).)DDI OOI & & & &# ( (I )).)DDI   Y ' ' ' 'GLL00  OOdE   ... )4000 U+++++rc||d}||jj||j|||jj||tj dz|j |j dS)NrJr) r:rKr1rr)r*mknodr(r-r+r0r/r\s rtest_mk_nod_can_create_a_filez.FakeOsModuleTest.test_mk_nod_can_create_a_files >>%(( ,,X66777  h  ++H55666 -tw||H/E/E/MNNNNNrc|d}|tj|jj|dSr1r:rSrTrUrrr\s r%test_mk_nod_raises_if_empty_file_namez6FakeOsModuleTest.test_mk_nod_raises_if_empty_file_name=  ##EL$'-JJJJJrcR||d}|jj|d}||jj||tj |jj |dS)NrvrJ) r:rKrr)r`r1r*rSrTrUr)rrAr]s r-test_mk_nod_raises_if_parent_dir_doesnt_existz>FakeOsModuleTest.test_mk_nod_raises_if_parent_dir_doesnt_exist s ((7<$$VU33 ,,V44555 ##EL$'-JJJJJrc>||dd}||||jj||tj |jj |dSNtmprJ r:rKr'r(rr)r*rSrTrrr\s r!test_mk_nod_raises_if_file_existsz2FakeOsModuleTest.test_mk_nod_raises_if_file_exists s >>%// """  ++H55666 ##EL$'-JJJJJrc||dd}|tj|jj|dS)Nrrr:rKrSrTrUrrr\s r%test_mk_nod_raises_if_filename_is_dotz6FakeOsModuleTest.test_mk_nod_raises_if_filename_is_dot sK >>%-- ##EL$'-JJJJJrc||dd}|tj|jj|dS)Nrrhr!r\s r,test_mk_nod_raises_if_filename_is_double_dotz=FakeOsModuleTest.test_mk_nod_raises_if_filename_is_double_dot sK >>%.. ##EL$'-JJJJJrc<||d}||||jj||tj |jj |dSr-rr\s r.test_mknod_empty_tail_for_existing_file_raisesz?FakeOsModuleTest.test_mknod_empty_tail_for_existing_file_raises s >>%(( """  ++H55666 ##EL$'-JJJJJrc||dd}|tj|jj|dSrr!r\s r1test_mknod_empty_tail_for_nonexistent_file_raiseszBFakeOsModuleTest.test_mknod_empty_tail_for_nonexistent_file_raises! sK >>%// ##EL$'-JJJJJrc|d}|tj|jj|dSr1rr\s r-test_mknod_raises_if_filename_is_empty_stringz>FakeOsModuleTest.test_mknod_raises_if_filename_is_empty_string& rrcd||d}ts8|tj|jj|tj dS|j|tj |j |dS)Nr) rrirrSrTrVrrr+S_IFCHRrPr\s r(test_mknod_raises_if_unsupported_optionsz9FakeOsModuleTest.test_mknod_raises_if_unsupported_options+ s  yy %  ' ' TW]Hdl      GMM(DL 1 1 1 GNN8 $ $ $ $ $rch||d}||||jj||dd}|tj |jj |dSrq) r:rKr'r(rr)r*rSrTr[r)r filename1 filename2s r.test_mknod_raises_if_parent_is_not_a_directoryz?FakeOsModuleTest.test_mknod_raises_if_parent_is_not_a_directory9 s NN5))  ###  ++I66777NN5%00  ##EM47=)LLLLLrct|ddd}||dd|jd|||jj|||jj || |ddd||jj|||jj |dS)NrJrYryrt) rrKr:rrr(r)rr1r*r'rs r test_symlinkzFakeOsModuleTest.test_symlinkA s%'''NN5%77  ue44555 +++  ,,Y77888 ,,Y77888 ug>>???  ,,Y77888  ++I6677777rcH||d}|jj|d}|t j|jj|||t j|jj||dSrL) rrKrr)r`rSrTrUrrrr s r'test_symlink_on_nonexisting_path_raisesz8FakeOsModuleTest.test_symlink_on_nonexisting_path_raisesL s >>%((GL%%h66  ##EL$'/9iXXX ##EL$'/8YWWWWWrc||d}|||tj|jj|j||jj z|d}|tj |jj|j||jj zdSNrurY) rrKr:rSrTrrrrr*rUr.s r/test_symlink_with_path_ending_with_sep_in_posixz@FakeOsModuleTest.test_symlink_with_path_ending_with_sep_in_posixS s >>%(( !!! ## L GO N tw{ "    >>%(( ## L GO N tw{ "      rc|t|d}|||t j|jj|j ||jj z|d}|j|j ||jj zdSr8) rrrKr:rSrTrrrrr*r.s r1test_symlink_with_path_ending_with_sep_in_windowszBFakeOsModuleTest.test_symlink_with_path_ending_with_sep_in_windowsf s !!!%'''>>%(( !!! ## L GO N tw{ "    >>%(( 47;(>?????rc||d|jjz}|t j|jj||dSr-)r:rKrr*rSrTrUrrpath0s r+test_broken_symlink_with_trailing_sep_posixzFakeOsModuleTest.test_broken_symlink_with_trailing_sep_windows| s` !!!%'''u%% 3 ##EM47?E5QQQQQrc||d}|j|j||t j|jj||jj z|jdSr-) r:rKrrrrSrTr[r+r*rs r+test_rename_symlink_with_trailing_sep_linuxz4$'++=t~     rc||d}|j|j||j||jjz|jdSr-)r>rKrrrr+r*rs r+test_rename_symlink_with_trailing_sep_macosz:::::rc0|t|d}|j|j||tj|jj ||jj z|jdSr-) rrrKrrrrSrTrr+r*rs r-test_rename_symlink_with_trailing_sep_windowsz>FakeOsModuleTest.test_rename_symlink_with_trailing_sep_windows s !!!%'''~~e$$ --- ## L$'.$*rOrSrTrUrrr7s r.test_lstat_broken_link_with_trailing_sep_macosz?FakeOsModuleTest.test_lstat_broken_link_with_trailing_sep_macos rRrc||}|tj|jj|dSr!)rrOrSrTr[rrr7s r0test_lstat_broken_link_with_trailing_sep_windowszAFakeOsModuleTest.test_lstat_broken_link_with_trailing_sep_windows sI !!!BBDD  ##EM47=)LLLLLrc||}|tj|jj||tj|jj|dSr!)rrOrSrTrrrror7s r6test_mkdir_broken_link_with_trailing_sep_linux_windowszGFakeOsModuleTest.test_mkdir_broken_link_with_trailing_sep_linux_windows sh $$&&&BBDD  ##EL$'-KKK ##EL$'2BINNNNNrc||}|j|dSr!)r>rOrrr7s r.test_mkdir_broken_link_with_trailing_sep_macosz?FakeOsModuleTest.test_mkdir_broken_link_with_trailing_sep_macos s? BBDD   i     rc||}|j|dSr!)r>rOrror7s r1test_makedirs_broken_link_with_trailing_sep_macoszBFakeOsModuleTest.test_makedirs_broken_link_with_trailing_sep_macos sA BBDD  #####rc||}|tj|jj|dSr!)r:rOrSrTr[rrPr7s r/test_remove_broken_link_with_trailing_sep_linuxz@FakeOsModuleTest.test_remove_broken_link_with_trailing_sep_linux sI BBDD  ##EM47>9MMMMMrc||}|tj|jj|dSr!)r>rOrSrTrUrrPr7s r/test_remove_broken_link_with_trailing_sep_macosz@FakeOsModuleTest.test_remove_broken_link_with_trailing_sep_macos sI BBDD  ##EL$'.)LLLLLrc||}|tj|jj|dSr!)rrOrSrTr[rrPr7s r1test_remove_broken_link_with_trailing_sep_windowszBFakeOsModuleTest.test_remove_broken_link_with_trailing_sep_windows sI !!!BBDD  ##EM47>9MMMMMrc||}|tj|jj||ddSNr)r:rOrSrTr[rr+rKr7s r/test_rename_broken_link_with_trailing_sep_linuxz@FakeOsModuleTest.test_rename_broken_link_with_trailing_sep_linux sb BBDD  ## M47>9dnnX6N6N     rc||}|tj|jj||ddSrd)r>rOrSrTrUrr+rKr7s r/test_rename_broken_link_with_trailing_sep_macosz@FakeOsModuleTest.test_rename_broken_link_with_trailing_sep_macos sb BBDD  ## L$'.)T^^H5M5M     rc||}|tj|jj||ddSrd)rrOrSrTr[rr+rKr7s r1test_rename_broken_link_with_trailing_sep_windowszBFakeOsModuleTest.test_rename_broken_link_with_trailing_sep_windows sb !!!BBDD  ## M47>9dnnX6N6N     rc||}|tj|jj|dSr!)rrOrSrTrUrr3r7s r1test_readlink_broken_link_with_trailing_sep_posixzBFakeOsModuleTest.test_readlink_broken_link_with_trailing_sep_posix sJ BBDD  ##EL$'2BINNNNNrc||}|tj|jj|dSr!)rrOrSrTr[rr3r7s r3test_readlink_broken_link_with_trailing_sep_windowszDFakeOsModuleTest.test_readlink_broken_link_with_trailing_sep_windows sJ !!!BBDD  ##EM473CYOOOOOrc|}||jj|dSr!)rOr1rr)rDr7s r)test_islink_broken_link_with_trailing_sepz:FakeOsModuleTest.test_islink_broken_link_with_trailing_sep s?BBDD  ,,Y7788888rc|}||jj|dSr!)rOr1rr)rr7s r*test_lexists_broken_link_with_trailing_sepz;FakeOsModuleTest.test_lexists_broken_link_with_trailing_sep s?BBDD  --i8899999rc|t|d}|j|j||j||jjz|dSr-)rrrKrrrr+r*rs r2test_rename_link_with_trailing_sep_to_self_windowszCFakeOsModuleTest.test_rename_link_with_trailing_sep_to_self_windows sn !!!%'''~~e$$ --- tdgk)400000rc ||d}|j|j||t j|jj||jj z|dSr-) rrKrrrrSrTr[r+r*rs r0test_rename_link_with_trailing_sep_to_self_posixzAFakeOsModuleTest.test_rename_link_with_trailing_sep_to_self_posix sw ~~e$$ --- ## M47>4$'++=t     rc:t|d|jjz}|d}|j|||||j|d|||j|ddS)Nrrrr)rrKrr*rrSr)rrrNr s r3check_open_broken_symlink_to_path_with_trailing_sepzDFakeOsModuleTest.check_open_broken_symlink_to_path_with_trailing_sep s%'''nnX..< NN6**   Y/// ##E49iEEE ##E49iEEEEErcl||tjdSr!)r:rwrTrjr"s r8test_open_broken_symlink_to_path_with_trailing_sep_linuxzIFakeOsModuleTest.test_open_broken_symlink_to_path_with_trailing_sep_linux 0  @@NNNNNrcl||tjdSr!)r>rwrTrUr"s r8test_open_broken_symlink_to_path_with_trailing_sep_macoszIFakeOsModuleTest.test_open_broken_symlink_to_path_with_trailing_sep_macos! rzrcl||tjdSr!)rrwrTr6r"s r:test_open_broken_symlink_to_path_with_trailing_sep_windowszKFakeOsModuleTest.test_open_broken_symlink_to_path_with_trailing_sep_windows% s0 !!! @@NNNNNrcJt|d}|d}||dd5|tj|jj||jjz|ddddS#1swxYwYdS)NrJrrrr) rrKrrSrTr[rrr*rs rtest_link_path_ending_with_sepz/FakeOsModuleTest.test_link_path_ending_with_sep) s%'''NN5)) NN6** YYy#Y 7 7    ' ' tw|Y-Di                     s:BBBcV||d|jjz}|d}||dd5|t j|jj||ddddS#1swxYwYdSNrJrYrrr) rrKrr*rrSrTrUrrr>rSs r'test_link_to_path_ending_with_sep_posixz8FakeOsModuleTest.test_link_to_path_ending_with_sep_posix3 s u%% 3u%% YYucFY 3 3 R R  ' ' dglE5 Q Q Q R R R R R R R R R R R R R R R R R Rs$-BB"%B"c|t|d|jjz}|d}||dd5|j||||jj |ddddS#1swxYwYdSr) rrrKrr*rrr(r)r*rs r)test_link_to_path_ending_with_sep_windowsz:FakeOsModuleTest.test_link_to_path_ending_with_sep_windows; s !!!%'''u%% 3u%% YYucFY 3 3 8 8 GLL & & & OODGL//66 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8s2AC  CCc|d}||dd5|tj|jj||jjz|ddddS#1swxYwYdS)NrJrrr)rKrrSrTr[rr+r*rs r#test_rename_to_path_ending_with_sepz4FakeOsModuleTest.test_rename_to_path_ending_with_sepD sNN5)) YYy#Y 7 7    ' ' tw~y47;/F                      s:A55A9<A9c\||d}|j||d}|j|||t j|jj||jj zdSr) r:rKrrrrSrTr[rr*r5s r'test_rmdir_link_with_trailing_sep_linuxz8FakeOsModuleTest.test_rmdir_link_with_trailing_sep_linuxL s >>%((  hNN6**  ),,, ## M47=)dgk*A     rc||d}|j||d}|j|||j||jjz||jj |dSr) r>rKrrrrr*r1r)r*r5s r'test_rmdir_link_with_trailing_sep_macosz8FakeOsModuleTest.test_rmdir_link_with_trailing_sep_macosV s >>%((  hNN6**  ),,,  i$'+-... ,,Y7788888rc|t|d}|j||d}|j|||j||jjz||jj |dSr) rrrKrrrrr*r1r)r*r5s r)test_rmdir_link_with_trailing_sep_windowsz:FakeOsModuleTest.test_rmdir_link_with_trailing_sep_windows` s !!!%'''>>%((  hNN6**  ),,,  i$'+-... ,,Y7788888rc^||d}|d}|j|||j|||t j|jj||jjzdSrqrrrSr>s r3test_readlink_circular_link_with_trailing_sep_linuxzDFakeOsModuleTest.test_readlink_circular_link_with_trailing_sep_linuxj s u%%u%% u%%% u%%% ##EK1A547;CVWWWWWrcd||d}|d}|j|||j|||||j||jjzdSrq)r>rKrrr-r3r*rs r3test_readlink_circular_link_with_trailing_sep_macoszDFakeOsModuleTest.test_readlink_circular_link_with_trailing_sep_macosr s u%%u%% u%%% u%%%  0 01D E EFFFFFrcz|t|d}|d}|j|||j|||t j|jj||jj zdSrqrrs r5test_readlink_circular_link_with_trailing_sep_windowszFFakeOsModuleTest.test_readlink_circular_link_with_trailing_sep_windows{ s !!!%'''u%%u%% u%%% u%%% ## M47+UTW[-@     rczt|tj|jjdddS)Nz/nonexistent_sourcez /link_dest)rrSrTrUrrr"s rtest_link_bogusz FakeOsModuleTest.test_link_bogus s@%''' ## L$',(=|     rc&t|d}|d}d}||||j|||j|||jj|| |d5}| | |ddddS#1swxYwYdSN test_file1 test_file2abcdefrrr) rrKr'rrr%r(r)r*rr-rr file1_path file2_path contents1rs rtest_link_deletez!FakeOsModuleTest.test_link_delete s1%'''^^L11 ^^L11   i888  Z,,, z"""  ++J77888 YYzFY 3 3 2q   QVVXXy 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2s)DD  D ct|d}|d}d}d}||||j||||d5}|||dddn #1swxYwY||dd5}||dddn #1swxYwY||d5}|||ddddS#1swxYwYdS) Nrrrghijklrrrr) rrKr'rrrr-rr)rrrr contents2rs rtest_link_updatez!FakeOsModuleTest.test_link_update s%'''^^L11 ^^L11    i888  Z,,, YYzFY 3 3 2q   QVVXXy 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2YYz3Y 8 8 A GGI                  YYzFY 3 3 2q   QVVXXy 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2s6)B;;B?B?DDD")EEEct|d}|dd}d}||||tj|jj||dS)Nr nonexistentrrr)rrKr'rSrTrUrr)rrbreaking_link_pathrs rtest_link_non_existent_parentz.FakeOsModuleTest.test_link_non_existent_parent s%'''^^L11 !^^M<HH  i888 ## L$', 4F     rct|dd}|||tj|jj||dSrq)rrKr'rSrTrrrrs rtest_link_is_existing_filez+FakeOsModuleTest.test_link_is_existing_file s[%'''NN5%00  ### ##EL$', 9UUUUUrc8|t|dd}|jj|d}|||tj |jj ||dSNrJrYr) rrrKrr)r`r:rSrTrYrr5s rtest_link_target_is_dir_windowsz0FakeOsModuleTest.test_link_target_is_dir_windows s !!!%'''>>%//GL%%h77  !!! ##EL$',)TTTTTrc||dd}|jj|d}|||tj|jj ||dSr) rrKrr)r`r:rSrTrVrr5s rtest_link_target_is_dir_posixz.FakeOsModuleTest.test_link_target_is_dir_posix sx >>%//GL%%h77  !!! ##EKxSSSSSrc4t|d}|d}|d}||||j|jd|j||||j|jd||j|jd|j||||j|jd||j|jd||j|jd|j|||j|jd||j|jd|j|||j|jddS)z1Test that hard link counts are updated correctly.rr test_file3rrr{N) rrKr'r-rr+r~rr%)rrr file3_paths rtest_link_count1z!FakeOsModuleTest.test_link_count1 s%'''^^L11 ^^L11 ^^L11  $$$ j11:A>>>  Z,,, j11:A>>> j11:A>>>  Z,,, j11:A>>> j11:A>>> j11:A>>> z""" j11:A>>> j11:A>>> z""" j11:A>>>>>rz%follow_symlinks not supported in PyPict|d}||d|d}||||d}|j||d||jj|dSNrNrJrsymlink_to_filelink_to_symlinkFr) rrKr'rrrr(r)rD)rrNrr s rtest_link_no_follow_symlinkz,FakeOsModuleTest.test_link_no_follow_symlink s%'''nn]33  u555~~&788  L+666NN#455   \9e DDD  ++I6677777rz*follow_symlinks only not supported in PyPict|d}||d|d}||||d}|t 5}|j||ddddn #1swxYwY|tj |j j dSr) rrKr'rrrrrr-rTr6r)rrNrr rs r-test_link_follow_symlink_not_supported_inPypyz>FakeOsModuleTest.test_link_follow_symlink_not_supported_inPypy s%%'''nn]33  u555~~&788  L+666NN#455   w ' ' I2 GLLy%L H H H I I I I I I I I I I I I I I I r|'9:::::sB??CCc |||dd||dd|d|j|ddj|d|j|dj||dd|d|j|djdS)NrJrYryrrr)rir:rKr'r-rkr}r~r"s rtest_nlink_for_directoriesz+FakeOsModuleTest.test_nlink_for_directories s)  ue44555 u55666  O & &t~~eU'C'C D D M    DO66t~~e7L7LMMVWWW v66777 DO66t~~e7L7LMMVWWWWWrc||jd}|||jd|j|dS)Nr )rrrr-rrs r test_umaskzFakeOsModuleTest.test_umask se  d##  d 3 3444  erc||jd|d}|j||d|j|j|jd|d}|j||d|j|jdS)z-mkdir creates a directory with umask applied.rrcr97rdN)rrrrKrrr+r/)rrcrds rtest_mkdir_umask_appliedz)FakeOsModuleTest.test_mkdir_umask_applied s   d~~f%%  d udgll4&8&8&@AAA  d~~f%%  d udgll4&8&8&@AAAAArc ||jd}|j|dd|d|j|dj|d|j|ddj|jd|j|dd|d|j|dj|d|j|ddj|j|d S) z2makedirs creates a directories with umask applied.rp1rcr9rp2rdrN)rrrrorKrr+r/rs rtest_makedirs_umask_appliedz,FakeOsModuleTest.test_makedirs_umask_applied$ s  d## f55666 udgll4>>$3G3G&H&H&PQQQ  47<<tV < <==E     d f55666 udgll4>>$3G3G&H&H&PQQQ  47<<tV < <==E     ercV||jd|d}|j|t jdz|d|j|j|jd|d}|j|t jdz|d|j|jdS) z*mkdir creates a device with umask applied.rnod1r%r&nod2N) r:rrrKrr+r0rr/)rnode1node2s rtest_mknod_umask_appliedz)FakeOsModuleTest.test_mknod_umask_applied5 s   dv&&  eT\E1222 udgll5&9&9&ABBB  dv&&  eT\E1222 udgll5&9&9&ABBBBBrc^||jd|d}||dd|d|j|j|jd|d}||dd|d |j|jd S) z'open creates a file with umask applied.rrrrrr&rrrN) rrrrKrrrr+r/)rrrs rtest_open_umask_appliedz(FakeOsModuleTest.test_open_umask_appliedB s   dw'' %v ..44666 udgll5&9&9&ABBB  dw'' %v ..44666 udgll5&9&9&ABBBBBrc|j\}}|j||j|dSr!)rpiperrread_fdwrite_fds rtest_open_pipezFakeOsModuleTest.test_open_pipeN sD GLLNN  g  hrcz|d}|j|tj}|j\}}||||j||j||j|dSNr)rKrrrrrr)rrrrrs rtest_open_pipe_with_existing_fdz0FakeOsModuleTest.test_open_pipe_with_existing_fdS sw'' W\\% , , GLLNN 7B'''  b  g  hrcz|j\}}|d}|j|tj}||||j||j||j|dSr)rrrKrrrr)rrrrrs r!test_open_file_with_existing_pipez2FakeOsModuleTest.test_open_file_with_existing_pipe\ s GLLNNw'' W\\% , , 2x(((  g  h  brcb|j\}}|d|j|d|d|j|d|j||j|dS)Nrtest)rrr-rrrrs rtest_read_write_pipez%FakeOsModuleTest.test_read_write_pipee s GLLNN DGMM(G<<=== $',,w":":;;;  g  hrcjg}tdD]_}|dt|z}||j|tj`|d}||||d5|j\}}||d5}| d| ddddn #1swxYwY||d 5}| d| dddn #1swxYwYdddn #1swxYwY|D]}|j |dS) Nrrarrrrrrr) rangerKstrappendrrrr'rr-rrr) rfdsir)rrrrrs rtest_open_existing_pipez(FakeOsModuleTest.test_open_existing_pipel sBq 7 7A>>&3q66/22D JJtw||D"*55 6 6 6 6NN:..  ### YYy6Y 2 2 4 4 $  GX8T** 6a  AGGG$4$4555 6 6 6 6 6 6 6 6 6 6 6 6 6 6 67D)) 4Q  !&&((333 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4  4 4 4 4 4 4 4 4 4 4 4 4 4 4 4   B GMM"      sZ33F &*D F D F #D $F =)E2& F 2E6 6F 9E6 :F  F F c:|j\}}|j|d|d|j|d|j||j|dS)Nrr)rrrr-rrrs rtest_write_to_pipez#FakeOsModuleTest.test_write_to_pipe~ s GLLNN  h((( $',,w":":;;;  g  hr)win32darwinlinuxz1Pipe implementation may differ on other platformsc|j\}}|tj|jj|d|j||j|dS)Nr)rrrSrTrrrrs rtest_write_to_read_fdz&FakeOsModuleTest.test_write_to_read_fd sf !GLLNN ##EKQQQ  g  hrcF|dd}||d|j|d||d5}|d|ddddS#1swxYwYdS) NrJrY012345678901234567rrrr 0123456789)rKr'rrrr-rrs r test_truncatezFakeOsModuleTest.test_truncate sNN5%00  -ABBB B''' YYy6Y 2 2 5a   \16688 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s )BBBc^|tj|jjdddS)NrJr)rSrTrUrrr"s rtest_truncate_non_existingz+FakeOsModuleTest.test_truncate_non_existing s) ##EL$'2BE2NNNNNrc|dd}||d|j|tj}|j|d|d|j|j||d5}|d| ddddS#1swxYwYdS) NrJrYrrrrz0123456789) rKr'rrryrr-r+st_sizerrrrrs rtest_truncate_to_largerz(FakeOsModuleTest.test_truncate_to_larger s-NN5%00  \::: W\\)RY / / R    TW\\)44<=== YYy6Y 2 2 Aa   5qvvxx @ @ @ A A A A A A A A A A A A A A A A A As8)C..C25C2ctjtjvr||t j|jjdd|d}| |d|j |tj }|j|d| d|j |j| |d5}| d|ddddS#1swxYwYdS) N2rr01234567890123456789rrrr)rrrrirSrTr ftruncaterKr'rryr-r+rrrs rtest_truncate_with_fdz&FakeOsModuleTest.test_truncate_with_fd sZ ;bn , ,       ##EK1BBKKKNN;//  -CDDD W\\)RY / / R    TW\\)44<=== YYy6Y 2 2 5a   \16688 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s)EE  E c|jr||tj|jjdd|d}||d|j |t j }|j |d| d|j |j| |d5}| d|ddddS#1swxYwYdS) Nrrr0123456789012345rrrr)is_pypyrirSrTrrrrKr'rryrr-r+rrrs rtest_ftruncatezFakeOsModuleTest.test_ftruncate sU <       ##EK1BBKKKNN;//  -?@@@ W\\)RY / / R    TW\\)44<=== YYy6Y 2 2 5a   \16688 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5s>)D44D8;D8c||jj|jjvtjtjv||jj|jjvtjtjv||jj|jjvtjtjv||jj|jjvtjtjvdS)zCMake sure that the fake capabilities are the same as the real ones.N)r-rr+rrsupports_dir_fdsupports_effective_idsr"s rtest_capabilitiesz"FakeOsModuleTest.test_capabilities s  GLDG< < Gr2 2    )<WXXX  GLDG3 3RW@R5R     GLDG: : Gr0 0     rc|t5}|jddddn #1swxYwY|t j|jj|d}| |d|j |tj }|j|}|d|j |d|d|j |d|j ||j |dS) Nrztest.txtheytherersheyr{stherer)rrrdupr-rTrrrKr'rrrr)rrrfd1fd2s rtest_dupzFakeOsModuleTest.test_dup sg   w ' ' 2 GKK                   bl&8999NN:..  Z888gll9bk22gkk# c1!5!5666 47<<R#8#8999  c  csAA Ac|d}|d}||d||d|j|tj}|j|tj}|j||j|}||||j|dS)Nfoo.txtbar.txtfoo hererbar here)rKr'rrrrr r-)rr file_path2r r fd3s rtest_dup_uses_freed_fdz'FakeOsModuleTest.test_dup_uses_freed_fd s^^I.. ^^I..  j999 j999gll:r{33gll:r{33  cgkk# c"""  crc|t5}|jdddddn #1swxYwY|t j|jj|d}|d}| |d| |d|j |tj }|j |tj }|d|j |d |j||}|d |j |d |j |d d |d |j |d |j|dS) Nrrrrrrsbarr{foor)rrrdup2r-rTrrrKr'rrrlseekr)rrrrr r s rtest_dup2_uses_existing_fdz+FakeOsModuleTest.test_dup2_uses_existing_fd s   w ' ' #2 GLLc " " " # # # # # # # # # # # # # # # bl&8999^^I.. ^^I..  j999 j999gll:r{33gll:r{33 c1!5!5666gll3$$ c1!5!5666  c1a    c1!5!5666  csAA Ac|d}|d}|||||j|tj}|dz}|||j|||j|tj}|j|}|j||j|||dz|||dz|dS)Nrrrrr{) rKr'rrrr-rr r)rrrr r rfd4s rtest_dup2_with_new_fdz&FakeOsModuleTest.test_dup2_with_new_fd s^^I.. ^^I..  $$$ $$$gll:r{33Ag dgll344555gll:r{33gkk#  c  c q#&&& q#&&&&&r)r{zIntroduced in Python 3.14c|dd}d}||||j|tj} t d}|d|j||t d}|t||j|||d||d|j|||j |d tj |t|d z |j|||d ||j |dS#|j |wxYw) NrJrsTesting readintorrrs sTesting readinto rsng readintodinto ) rKr'rrr bytearrayr-readintorrSEEK_SETr)rrrrbuffers r test_readintozFakeOsModuleTest.test_readinto sNN5)44 & X666 W\\)R[ 1 1 s^^F   Q 0 0V < < = = =y))F   S]]DG,<,rrOrVr^rfrorsrrrrrrrrrrrrrrrrrrrrr rrrrr!r#r&r+r/r4r8r;r?rBrErGrJrNrRrTrWrZr]rerhrkrnrpunittestskipIfhasattrrrzr~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrr r&r0r5r7r<rDrKrUrWrYr_rcrfrjrorsrurrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrr%r(r-r/r1r6r9r;r=rBrErGrJrNrTrWr[r_rarergrjrlrprtrwr{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"r$r&r(r*r-r1r3r6r9r;r?rArCrErGrLrOrQrTrVrXrZr\r^r`rbrergrirkrmrorqrsrurwryr|r~rrrrrrrrrrrrrrrrrrr rrrrrrrrrrrrrrplatformrrrrrrrrrrrr&r?r@s@rrBrBCs=..... !!! LLL LLL     4 4 4444 D D D C C C>>>TTTOOO 222III ' ' 'PPP TTT6   ((((((,EEECCC@@@$... C C C C C CRRR   *   * Q Q Q D D D    /// /// 444 GGG 777 HHH   HHHHHH   KKKGGG GGG    WWW >>><<<=== Y Y Y ; ; ;   EEEEEEEEEX_]3335VWW ? ?XW ?X_\2224VWW11XW1X_\2224VWW  XW HHHGGGGGGFFFGGG GGG888       EEEOOO ;;; ;;;PPPBBB CCC   ###    JJJ       222          " L L L,,,+++,,,LLL999999###444444.333444999$JJJ 999888999 4 4 4MMM < < <XXXWWW 8 8 8 9 9 9     J J J;;; ;;;WWW111       999WWW 9 9 9 S S SSSSKKKJJJVVV 8 8 8 9 9 9WWW 8 8 8WWW / / /UUU > > >     > > > < < <    P P P < < < 5 5 5666 666 ******PPPUUU AAA >>>333(;;;,666777$OOOBBB??????LLL 8 8 8222 &G&G&GPPPP999 999QQQ 7 7 7 F F FDDDLLL LLLMMM 7 7 7LLLLLL   AAA@@@LLLLLLLLL L L L<<< 666888MMMDDDCCC   OOO666<<<"888999 WWWSSS"""@@@EEEIII S S S M M M S S S 8 8 8 7 7 7<<<&' ' ' R 8 8 8FFF 4 4 4666&X_ G#%U 2 2 2 P P P555* 3 3 3 3 3 3 6 6 6///* 3 3 3 2 2 2 / / /PPPVVV KKK*,,,2OOOKKK KKKKKKKKK KKK KKKKKK KKK % % %MMM 8 8 8XXX   &@@@ QQQ RRR    ;;;    Y Y YLLL LLL MMM OOO !!! $$$ NNN MMM NNN          OOO PPP 999:::111   FFFOOOOOOOOORRR888   999999XXXGGG       222"222(    VVV UUUTTT???4X_WEFF88GF8X_["NOO ; ;PO ; X X X B B B" C C C C C C         $   X_ 88;   555OOOAAA 5 5 5 5 5 5          $''' X_S%/1LMMNMrrBceZdZdZdS)RealOsModuleTestcdSNTr"s rr|zRealOsModuleTest.use_real_fs trNr<r=r>r|r/rrr,r, #rr,cReZdZfdZdZdZdZdZdZdZ 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/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Zd=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_d^Z`d_ZaxZbS)`!FakeOsModuleTestCaseInsensitiveFSct||jj|jjz|jjz|_|jj|jjz|_dSr!) rrrPrrDrErFrGrHrs rrz'FakeOsModuleTestCaseInsensitiveFS.setUp! s[   &&(((7<$',.=',-rc|dd}|||dd}|tj|jj|dS)rXrJrYFooBarNrZ)rr]r/s rr^z@FakeOsModuleTestCaseInsensitiveFS.test_chdir_fails_non_directory' s`>>%// """NN5%00  ##EM47=)LLLLLrc|d}|j||jj|d}|j||dd}|||d|dg|j|dS)NrvrXYZZYBUGrJr)rrrNdirectory_uppers rrz;FakeOsModuleTestCaseInsensitiveFS.test_listdir_returns_list. s00  n%%%GL%%ne<<   i   ..%88  599::: %$'///"B"BCCCCCrc t|d}gd}|D]+}||||,||d|d|||t |j|ddS)NrvrxrSymLinkrr}s rrz9FakeOsModuleTestCaseInsensitiveFS.test_listdir_on_symlink7 rrc|||d}|jj|d}||dd|j|d|d}||d|t5|j ||jj|ddddn #1swxYwY|j |dgksJtt|j|d ksJ|t5|j|dddn #1swxYwY|t5||d 5}|dddn #1swxYwYddddS#1swxYwYdS) Ntestdirrrr8rrrrlink.txtrrr)rrrKrr)r`r'rrrrrzrlistscandirr+rrrrNr another_filers r,test_listdir_possible_without_exe_permissionzNFakeOsModuleTestCaseInsensitiveFS.test_listdir_possible_without_exe_permissionA s   NN9-- GL%%i<<  U???  i'''~~j11  666    / / Q Q GLLtw|'8'8J'O'O P P P Q Q Q Q Q Q Q Q Q Q Q Q Q Q Qwy))j\99994 2233449999   / / $ $ GLL # # # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $    / /  9v66 !                                 sZ:DD!$D!GG G)H:H" H:"H& &H:)H& *H::H>H>c|||d}|jj|d}||dd|j|d|d}||d|j||jj|d| t5|j |dddn #1swxYwY| t5|j |dddn #1swxYwY|j |jdzd ksJ||d 5}|dksJ ddddS#1swxYwYdS) Nr@rrr8rArrBr9rr)rrrKrr)r`r'rrrrrzrDr+r/rrrEs r/test_listdir_impossible_without_read_permissionzQFakeOsModuleTestCaseInsensitiveFS.test_listdir_impossible_without_read_permission[ s  NN9-- GL%%i<<  U???  i'''~~j11  666  \47<#4#4Y #K#KLLL    / / ' ' GOOI & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' '    / / ' ' GOOI & & & ' ' ' ' ' ' ' ' ' ' ' ' ' ' 'w||I&&.6%???? YYy6Y 2 2 %a6688u$$$$$ % % % % % % % % % % % % % % % % % %s6D77D;>D;FF F G66G:=G:c*|d}|d}|jj|d}||d|t j|j|t jz|jj|d}|t j |j|t jz|t j |j|j z| d|j|t j dS)Nrvr:rwrrPlughrr)rrN directory1rrs rrz+FakeOsModuleTestCaseInsensitiveFS.test_statp s&NN7++ ^^G,, GL%%i99  W555  tw||J'?'? 'MMNNNW\&&z7;;   tw||J'?'? 'MMNNN  tw||J'?'?'GGHHH DGLL44T\BCCCCCrc||d}d}d}|t|t||jj||}|jj|d}||||||| t||j | dtj | t||j | dtj dSr) rrKrrrr)r`r'rr-r+upperrr s rr zDFakeOsModuleTestCaseInsensitiveFS.test_stat_no_follow_symlinks_posix{ sP NN7++  !  C NNC ,>,>???GL%%i;; GL%%i88  ];;; Iy111     GLL**EL B B4< P      NN GLL**EL B B4< P     rc||d}d}d}|t|t||jj||}|jj|d}||||||| t||j | tj | t||j | tj dSr)rrKrrrr)r`r'rr-rrOr+rr s rtest_lstat_posixz2FakeOsModuleTestCaseInsensitiveFS.test_lstat_posix s; NN7++  !  C NNC ,>,>???GL%%i;; GL%%i88  ];;; Iy111     ioo.?.? @ @ N    Yy7H7H)I)I$,)WXXXXXrc&t|ddd}|d}|||||j||dSr)rrKrrArr3rOrs rrz/FakeOsModuleTestCaseInsensitiveFS.test_readlink s%'''NN5%77 )) Iv...  0 01B1B C CVLLLLLrc|ddd}|||tj|jj|dSr)rKr'rSrTr6rr3rOrs r(check_readlink_raises_if_path_not_a_linkzJFakeOsModuleTestCaseInsensitiveFS.check_readlink_raises_if_path_not_a_link sZNN5%??  ### ##EL$'2BIOODUDUVVVVVrcr|t|dSr!)rrrTr"s r/test_readlink_raises_if_path_not_a_link_windowszQFakeOsModuleTestCaseInsensitiveFS.test_readlink_raises_if_path_not_a_link_windows s8 !!!%''' 5577777rcV||dSr!)rrTr"s r-test_readlink_raises_if_path_not_a_link_posixzOFakeOsModuleTestCaseInsensitiveFS.test_readlink_raises_if_path_not_a_link_posix s,  5577777rc|||d|dd}|||jj||ddd}|||jj|dSr)r'rKrSrr3rOrs rrzHFakeOsModuleTestCaseInsensitiveFS.check_readlink_raises_if_path_has_file s 11222NN8U33  ##M473CY__EVEVWWWNN8UE::  ##M473CY__EVEVWWWWWrc|t|tjdSr!rr"s rrzOFakeOsModuleTestCaseInsensitiveFS.test_readlink_raises_if_path_has_file_windows rrcl||tjdSr!rr"s rrzMFakeOsModuleTestCaseInsensitiveFS.test_readlink_raises_if_path_has_file_posix rrc t||ddd|d||dd|d||d|j|dd d d dS) NrrrrrrMeyerGeoMetroLemonPierr"s rrzBFakeOsModuleTestCaseInsensitiveFS.test_readlink_with_links_in_path rrc >t||dddd|d||d|dd||d |d d ||d|j|d d dS)NrrrrrrEasternEuropeanrRussian WolfhoundsDOGSChaserr"s rrzJFakeOsModuleTestCaseInsensitiveFS.test_readlink_with_chained_links_in_path rrc |d}|jj|d}|||}||jj||||jj |||jj||j ||||jj |||jj||tj |jj ddS)Nrvrwz/Plugh) rKrr)r`r:rOr(r*rSrPrLrTrUrs rrz2FakeOsModuleTestCaseInsensitiveFS.check_remove_dir s3NN7++ 7<$$Y88 !!!>>##  ++HNN,<,<==>>> ##Itw~xHHH  ++H55666  i    ##Itw~xHHH  ++H55666 ##EL$'.(KKKKKrcl||tjdSr!rr"s rrz8FakeOsModuleTestCaseInsensitiveFS.test_remove_dir_mac_os rrcl||tjdSr!rr"s rrz9FakeOsModuleTestCaseInsensitiveFS.test_remove_dir_windows rrc|d}|jj|d}||||jj||j|| |jj|dSr) rKrr)r`r'r(r*rOrPr1rs rrz2FakeOsModuleTestCaseInsensitiveFS.test_remove_file sNN5)) GL%%i99  ###  ++IOO,=,=>>??? y(())) ,,Y7788888rc|d}d}|jj||}||||jj||j||j || |jj|dSr) rKrr)r`r'r(r*rLrOrPr1rs rrz?FakeOsModuleTestCaseInsensitiveFS.test_remove_file_no_directory sNN5))  GL%%i;;  ###  ++I66777  ioo''((( y(())) ,,Y7788888rc||dd}||||dd5|t j|jj| dddn #1swxYwY| |jj |dSr) rrKr'rrSrTrYrrPrOr(r)r*rs rrzKFakeOsModuleTestCaseInsensitiveFS.test_remove_open_file_fails_under_windows s  !!!~~eU++  YYtS6Y 2 2 T T  ' ' dgndjjll S S S T T T T T T T T T T T T T T T  ++D1122222s>B""B&)B&cp||dd}||||dd|j|||jj |dSr) rrKr'rrrPrOr1r)r*rs rrzLFakeOsModuleTestCaseInsensitiveFS.test_remove_open_file_possible_under_posix s ~~eU++  $f --- tzz||$$$ ,,T2233333rc^||j}|d}|jj|d}d}|jj||}|jjd|}||||jj || |||jj ||j ||j || |jj ||j || |jj |dSr)rirrbrKr)r`r'rOr(r*r:rLrPr1r s rr z@FakeOsModuleTestCaseInsensitiveFS.test_remove_file_relative_path s w~~'' NN5)) w|((E::  GL%%i;; !W\..tY?? **+++  ++I66777  %%%  ++L99:::  l((**+++ )//11222 ,,-?@@AAA  l((**+++ ,,Y7788888rc|d}|||||jj|dSr)rKr:rSrrPrOrs rrz?FakeOsModuleTestCaseInsensitiveFS.check_remove_dir_raises_error* sQNN5))   """ ##Itw~y?P?PQQQQQrcl||tjdSr!rr"s rrzEFakeOsModuleTestCaseInsensitiveFS.test_remove_dir_raises_error_mac_os/ rrcl||tjdSr!rr"s rrzFFakeOsModuleTestCaseInsensitiveFS.test_remove_dir_raises_error_windows3 rrct|d}|d}|||j||||jj|||jj||j| ||jj|| |jj|dSr) rrKr:rrr(r)r*rPrOr1rs rr z>%((gl''-@@  !!!  ))++Y__->->??? ##EM47>8YWWWWWrc|t|d}|d}|jj|d}|||j||| tj |jj ||dSr2) rrrKrr)r`r:rrOrSrTrr+r4s rr7zDFakeOsModuleTestCaseInsensitiveFS.test_rename_dir_to_symlink_windowsL s !!!%'''NN6** >>%((gl''-@@  !!!  ))++Y__->->??? ##EL$'.(IVVVVVrc||d}||d}|j||d}|j||j|||dg|j|jdS)NDestdestsrc) rrKrirrr+r-rzr)r dest_dir_pathnew_dest_dir_pathsource_dir_paths rtest_rename_dir_to_existing_dirzAFakeOsModuleTestCaseInsensitiveFS.test_rename_dir_to_existing_dirV s v..   NN622  m$$$..//  o&&& (9::: &47??4>#B#BCCCCCrc||d}|d}|j|||||j||||jj || |jj || |jj |dSr9) rrKrrr'r+rOr1r)r*r(rr;s rr<z=FakeOsModuleTestCaseInsensitiveFS.test_rename_file_to_symlinkc s NN;// NN6**   9--- ### y(()444 ,,Y77888  ++IOO,=,=>>???  ++IOO,=,=>>?????rc||dd}|||jj|d}|jj|d}|j|||j|||j||| |jj || |jj |dSr>) rrKr:rr)r`rrOr+r1r*r(rAs rrDz@FakeOsModuleTestCaseInsensitiveFS.test_rename_symlink_to_symlinkn s NN5%00   """W\&&y':: W\&&y'::   )):666  :... z'')):+;+;+=+=>>> ,,Z88999  ++J7788888rc||d}|d}|jj|d}|||j|||||tj |jj ||dSrF) rrKrr)r`r:rrOrSrTr6r+rIs rrKzRFakeOsModuleTestCaseInsensitiveFS.test_rename_symlink_to_symlink_for_parent_raisesz s >>*-->>%((',++HkBB !!! (((333 ((( ## L$'.(O4I4I4K4K     rct|d}|j|j||jj|d}|d}|j||j||| ddgt|j |jdS)NrruDir) rrKrrrr)r`rr+r-r|rz)rr  link_subdirrs r#test_rename_directory_to_linked_dirzEFakeOsModuleTestCaseInsensitiveFS.test_rename_directory_to_linked_dir s%'''NN6**   222gl'' 599 >>%((  h x--- %&1P1P*Q*QRRRRRrc@||dd}|||jj|d}|tj|jj | |dSr[) rrKr:rr)r`rSrTr6r+rOr]s rr_z>FakeOsModuleTestCaseInsensitiveFS.test_recursive_rename_raises s NN5%00   """7<$$Y :: ## L$'.)//*;*;X     rc||dd}|||tj|jj||dzdSre) rrKr'rSrTr[rr+rOrs rrfzRFakeOsModuleTestCaseInsensitiveFS.test_rename_with_target_parent_file_raises_posix s~ NN5%00  ### ## M GN  OO   &      rc <||dd}|||tj|jj||jj | ddSrh) rrKr'rSrTr6rr+r)r`rOrs rrjzTFakeOsModuleTestCaseInsensitiveFS.test_rename_with_target_parent_file_raises_windows s !!!NN5%00  ### ## L GN  GL  ioo// 7 7      rcJt|d}|d}|j|||j|||dg|j|jdS)NryBAZ)rrKrrr+r-rzr)r path_lower path_uppers rtest_rename_looping_symlinkz=FakeOsModuleTestCaseInsensitiveFS.test_rename_looping_symlink s%'''^^E** ^^E**   J/// z:... %$'//$."A"ABBBBBrc||d}|jj|d}|jj|d}|||j|||j||| |jj |dSrl) rrKrr)r`r'rr+rOr1r*rns rroz?FakeOsModuleTestCaseInsensitiveFS.test_rename_symlink_to_source s NN5)) GL%%i99 GL%%i88  ###  9--- y(()//*;*;<<< ,,Y7788888rc||dd}|jj|d}|jj|d}|||j|||tj |jj ||dSrq) rrKrr)r`r:rrOrSrTrjr+rrs rrszCFakeOsModuleTestCaseInsensitiveFS.test_rename_symlink_to_dir_raises s NN5%00 GL%%i<< 7<$$Y66 !!! )//"3"3444 ## L$'.)X^^5E5E     rc||d}|||jj|d}|jj|d}|j|||j||| |jj || |jj || |jj |dSrl) rrKr:rr)r`rrOr+r1r*r(rrns rruz>++X^^-=-= > > >   TW\00:: ; ; ; OODGL//99 : : :    1 1(G D Df M M M##%% S  DO$>$>x$H$H$QRRR S Src|d}|d}|||||||jj||dSr)rKr:r'rSrr+rOrs rrzPFakeOsModuleTestCaseInsensitiveFS.check_rename_directory_to_existing_file_raises s>>%((NN6**  !!! ### ## dgnh 0A0A     rcl||tjdSr!rr"s rrzUFakeOsModuleTestCaseInsensitiveFS.test_rename_directory_to_existing_file_raises_posixrrcl||tjdSr!rr"s rrzWFakeOsModuleTestCaseInsensitiveFS.test_rename_directory_to_existing_file_raises_windows rrcz||dd}|dd}|||||tj|jj||dSr) rrKr:rSrTrrr+rOrs rrz^FakeOsModuleTestCaseInsensitiveFS.test_rename_to_existing_directory_should_raise_under_windowss !!!>>%//>>%// !!! !!! ## L$'.(..*:*:HNNrSs r&test_rename_with_incorrect_source_casezHFakeOsModuleTestCaseInsensitiveFS.test_rename_with_incorrect_source_case%sNN5))  !!)U33 !!)U33  ue$$$  ++E2233333rc||d}|j|j||dd}|d}|j|||dgt|j|dSNrMrO) r>rKrrrr+r-r|rzrs r8test_rename_symlink_to_other_case_does_nothing_in_mac_oszZFakeOsModuleTestCaseInsensitiveFS.test_rename_symlink_to_other_case_does_nothing_in_mac_os.s v&& ...vv..v&& ue$$$ &6$'//%*@*@#A#ABBBBBrc|t|d}|j|j||dd}|d}|j|||dgt|j |dSr) rrrKrrrr+r-r|rzrs r2test_rename_symlink_to_other_case_works_in_windowszTFakeOsModuleTestCaseInsensitiveFS.test_rename_symlink_to_other_case_works_in_windows8s !!!%'''v&& ...vv..v&& ue$$$ &6$'//%*@*@#A#ABBBBBrc|d}|||ddd}|j||||jj|||jj|dS)Nrrirur)rKr'rrenamesr(r)r*r1rs r!test_renames_creates_missing_dirszCFakeOsModuleTestCaseInsensitiveFS.test_renames_creates_missing_dirsBs>>),, """>>% :: (+++  ++H55666 ,,X6677777rc&|d}|dddd}|jj|d}|||||dd}|j||||jj|||jj|||jj||jj|d}||jj|dS)Noldrcrdrzfoo.pngrir) rKrr)r`r'rr(r*r1)r old_base_pathr other_filer^ removed_paths rtest_renames_removes_empty_dirszAFakeOsModuleTestCaseInsensitiveFS.test_renames_removes_empty_dirsJsGu-- >>%CCW\&&}i@@  """ $$$>>%33 (+++  ++H55666 ,,X66777  ++M::;;;w|((??  ,,\::;;;;;rct|d}|jj|d}|||jj|d}|j|||jj|d}|j|dSr)rrKrr)r`r:rr+)rrr)s rtest_stat_with_mixed_casez;FakeOsModuleTestCaseInsensitiveFS.test_stat_with_mixed_caseXs%'''NN5)) w|  E22 w|  u--  4(((w|  u--  TrcXt|d}|||jj|d}|j|||jj|dd}|||jj|dd}|j ||| |jj |dS)NrJrmrMSlinkr) rrKr:rr)r`rrOr'rr(r*rs rrzBFakeOsModuleTestCaseInsensitiveFS.test_hardlink_works_with_symlinkds%'''NN5))   """w|((G<<   ))<888GL%%i&AA  ###GL%%i'BB   Y ***  ++I6677777rcV||dd}|dd}|||||tj|jj||dSr) rrKr:rSrTrYrrrOrs rrz\FakeOsModuleTestCaseInsensitiveFS.test_replace_existing_directory_should_raise_under_windowsps !!!>>%//>>%// !!! !!! ## L$'/8X^^5E5E     rc||dd}|d}||jj|d|||j||||jj |jj|d| |jj |dSr) rrKr:rr)r`r+rOr(r*r1rs rrzOFakeOsModuleTestCaseInsensitiveFS.test_rename_to_existing_directory_under_posix{s >>%//>>'**  ))(E::;;; !!! x~~'')9)9:::  ++DGL,=,=h,N,NOOPPP ,,X6677777rcz||ddd}|d}|||||t j|jj| | dSr) rrKr'r:rSrTrjrr+rOrs rrz[FakeOsModuleTestCaseInsensitiveFS.test_rename_file_to_existing_directory_raises_under_posixs NN5%77 >>'** ### !!! ## L$'.)//*;*;X^^=M=M     rcn||d}|jj|d}|jj|d}||d||d||jj|||jj||j| | | |jj|||jj|| |ddSr) rrKrr)r`r'r(r*r+rOr1r,r-s rrzDFakeOsModuleTestCaseInsensitiveFS.test_rename_to_existent_file_posixsh NN7++  )))[AA  )))[AA  1BCCC 1BCCC  ++M::;;;  ++M::;;; }**,,m.A.A.C.CDDD ,,];;<<<  ++M::;;; M+<=====rc||d}|jj|d}|jj|d}||d||d||jj|||jj||tj |jj | | dSr) rrKrr)r`r'r(r*rSrTrr+rOr-s rrzFFakeOsModuleTestCaseInsensitiveFS.test_rename_to_existent_file_windowss !!!NN7++  )))[AA  )))[AA  1BCCC 1BCCC  ++M::;;;  ++M::;;; ## L GN    ! !    ! !      rcF|d}|jj|d}|jj|d}||d||d||jj|||jj||j||| |jj|||jj|| |ddSr) rKrr)r`r'r(r*rrOr1r,r-s rrz?FakeOsModuleTestCaseInsensitiveFS.test_replace_to_existent_filesXNN7++  )))[AA  )))[AA  1BCCC 1BCCC  ++M::;;;  ++M::;;;  ++--}/B/B/D/DEEE ,,];;<<<  ++M::;;; M+<=====rc<|d}|jj|d}|jj|dd}||d||jj|||jj||tj |jj | | ||jj|||jj|| |ddSr)rKrr)r`r'r(r*r1rSrTrUr+rOr,r-s rrz@FakeOsModuleTestCaseInsensitiveFS.test_rename_to_nonexistent_dirsTNN7++  )))[AA  )))^[QQ  AAA  ++M::;;; ,,];;<<< ## L GN    ! !    ! !     ++M::;;; ,,];;<<< M?;;;;;rc|j|j|d|dd}|j||d}|j|||ddgt|j|jdS)NrAlphar)) rrrrKrr+r-r|rz)r dir_upper dir_lowers r*check_rename_case_only_with_symlink_parentzLFakeOsModuleTestCaseInsensitiveFS.check_rename_case_only_with_symlink_parents v(>(>???NN6733   i   NN7++  y),,, '6*F47??4>3R3R,S,STTTTTrcr|t|dSr!)rrrr"s r1test_rename_case_only_with_symlink_parent_windowszSFakeOsModuleTestCaseInsensitiveFS.test_rename_case_only_with_symlink_parent_windowss8 !!!%''' 7799999rcV||dSr!)r>rr"s r/test_rename_case_only_with_symlink_parent_macoszQFakeOsModuleTestCaseInsensitiveFS.test_rename_case_only_with_symlink_parent_macoss,  7799999rcR|d}|jj|d}|jj|dd}|jj|d}|jj|dd}||||d||jj|||jj|| |jj|| |jj||j ||| |jj|| |jj|||jj|||jj|| |ddSr) rKrr)r`r:r'r(r*rOr1r+r,rs rrz1FakeOsModuleTestCaseInsensitiveFS.test_rename_dirshNN7++ W\&&y(;; gl'' 8VDD GL%%i99 W\&&y'6BB   ### y999  ++J,<,<,>,>??@@@  ++K,=,=,?,?@@AAA ,,Y__->->??@@@ ,,Z-=-=-?-?@@AAA z''))9555 ,,Z-=-=-?-?@@AAA ,,[->->-@-@AABBB  ++IOO,=,=>>???  ++J,<,<,>,>??@@@ J 22222rc(|d}d}|jj|d}||||j|||||dSr)rKrr)r`r'r+rOr,rs rrz>%((>>*-- !!! (+++W\&&x88   ### :++--... ,,Z88999  ++H5566666rc||dd}|jj|d}|jj|d}|||j|||tj |jj |dSrD) rrKrr)r`r:rrOrSrTr[rrrs rrEzGFakeOsModuleTestCaseInsensitiveFS.test_mkdir_raises_on_symlink_in_posix+s NN5%00 GL%%i?? 7<$$Y66 !!! (()//*;*;<<< ##EM47=)LLLLLrc|t|dd}|jj|d}|jj|d}|||j|||j || |jj || |jj |dSrD) rrrKrr)r`r:rrOrr1r*r(rrs rrGzGFakeOsModuleTestCaseInsensitiveFS.test_mkdir_removes_symlink_in_windows4s !!!%'''NN5%00 GL%%i?? 7<$$Y66 !!! (()//*;*;<<<  i    ,,Y77888  ++H5566666rc8|d}||||jj||tj|jj | dSrI) rKr:r(rr)r*rSrTrrrOrMs rrJzGFakeOsModuleTestCaseInsensitiveFS.test_mkdir_raises_if_directory_exists@swNN7++   """  ++I66777 ##EL$'-ARARSSSSSrcx|d}|jj|d}||||jj||tj |jj | dSrL) rKrr)r`r'r(r*rSrTrrrOrs rrNzBFakeOsModuleTestCaseInsensitiveFS.test_mkdir_raises_if_file_existsGsNN7++ GL%%i99  ###  ++I66777 ##EL$'-ARARSSSSSrct|d}|j|||d}|t j|jj|dS)NryBaz)rrKrrrSrTrr)rrSpath2s r#test_mkdir_raises_if_symlink_existszEFakeOsModuleTestCaseInsensitiveFS.test_mkdir_raises_if_symlink_existsOsj%'''u%% u%%%u%% ##EL$'-GGGGGrc<|d}|jj|d}|||||jj|jj|ddSrP)rKrr)r`r'rSrrOrRs rrTzFFakeOsModuleTestCaseInsensitiveFS.check_mkdir_raises_if_parent_is_fileWsNN7++ GL%%i99  ### ##  GM GL  ioo// 6 6     rcl||tjdSr!rVr"s rrWzKFakeOsModuleTestCaseInsensitiveFS.test_mkdir_raises_if_parent_is_file_posixbrXrcl||tjdSr!rZr"s rr[zMFakeOsModuleTestCaseInsensitiveFS.test_mkdir_raises_if_parent_is_file_windowsfr\rc|d}|jj|d}||jj||j|||jj|dSrn) rKrr)r`r1r*rorOr(r@s rrpz/FakeOsModuleTestCaseInsensitiveFS.test_makedirsjs((GL%%fe44  ,,V44555 **+++  ++I6677777rcd|d}|jj|d}||||jj||||jj| dSrr) rKrr)r`r'r(r*rSrorOrss rrtzIFakeOsModuleTestCaseInsensitiveFS.check_makedirs_raises_if_parent_is_filersNN7++ GL%%i99  ###  ++I66777 ##J0@)//BSBSTTTTTrcl||tjdSr!rvr"s rrwzNFakeOsModuleTestCaseInsensitiveFS.test_makedirs_raises_if_parent_is_file_posixzrxrcl||tjdSr!rzr"s rr{zPFakeOsModuleTestCaseInsensitiveFS.test_makedirs_raises_if_parent_is_file_windows~r|rcj||d}|j|d||t j|jj|jj | ddSr~) rrKrrrSrTrUror)r`rOr7s rrzOFakeOsModuleTestCaseInsensitiveFS.test_makedirs_raises_if_parent_is_broken_links NN=11  w//;;; ## L G  GL  ioo// : :     rc|dd}||||jj||tj|jj | |j | d||jj|dSr) rKr:r(rr)r*rSrTrrorOrMs rrz8FakeOsModuleTestCaseInsensitiveFS.test_makedirs_exist_oksNN7E22   """  ++I66777 ##EL$'2BIOODUDUVVV **T:::  ++I6677777rc|d}||d||dd}|}|j||tj |jj|dz| dS)Nrrrrrrr) rKr'rrOrrrrSrTrrrs rtest_fsync_passz1FakeOsModuleTestCaseInsensitiveFS.test_fsync_passs 44 2GHHHIIn2244dVILL ""$$  g ##EK" MMMrc |||d}|||j|d|j|}|d|j | |j tj z| |j tj zdSr)rrirKr6rrrOr+rr/r(r0r1r2rs rrz,FakeOsModuleTestCaseInsensitiveFS.test_chmods  ~~k** D!!!  djjllF+++ W\\$   vrz222  T\1222 dl233333rct|ddd}||dd|jd|||jj|| |jj || |ddd||jj|||jj |dS)NrJrYryrtr7r8Bogus) rrKr:rrrOr(r)rr1r*r'rs rr3z.FakeOsModuleTestCaseInsensitiveFS.test_symlinks%'''NN5%77  ue44555 !2!2333  ,,Y77888 ,,Y77888 ug>>???  ,,Y77888  ++I6677777rcnt|d}|d}d}||||j|||j|||jj || |d5}| | |ddddS#1swxYwYdSr) rrKr'rrrOr%r(r)r*rr-rrs rrz2FakeOsModuleTestCaseInsensitiveFS.test_link_deletesI%'''^^L11 ^^L11   i888  Z%%''444 z"""  ++J77888 YYz''))FY ; ; 2q   QVVXXy 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2s4)D**D.1D.ct|dd}|||tj|jj||dSrq) rrKr'rSrTrrrrOrs rrzrr^rrrGrJrr rQrrTrVrXrrrrrrrrrrrrr rrrr r5r7r~r<rDrKrr_rfrjrrorsrurrrrrrrrrrrrrrrrrrrrrrrrrrrr rr6rErGrJrNrrTrWr[rprtrwr{rrrrr3rrrrr?r@s@rr4r4 s#..... MMMDDDTTT4%%%* D D D   *YYY MMMWWW 888 888XXXBBB CCC       " L L L+++,,,999999333444999$RRR 888999 4 4 4XXXWWW D D D @ @ @ 9 9 9     S S S           CCC999     9 9 9 H H H333 S S S   KKKJJJ     8 8 8444CCCCCC888 < < <    8 8 8     8 8 8    > > >   " > > ><<<$UUU::: :::333(666777$ 8 8 8 7 7 7MMM 7 7 7TTTTTTHHH    AAA@@@888UUUDDDCCC   888    4 4 4 8 8 8222"    W W W2222222rr4ceZdZdZdS)!RealOsModuleTestCaseInsensitiveFScdSr.r/r"s rr|z-RealOsModuleTestCaseInsensitiveFS.use_real_fsr0rNr1r/rrrrr2rrcPeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d S) FakeOsModuleTimeTestc |d5d}|j|||jj||j|}|d|j |j |d|j|}|d|j ddddS#1swxYwYdS)Nrstartrr) mock_timerkr'r(rr)r*r+r-st_ctimerrs rtest_chmod_st_ctimez(FakeOsModuleTimeTest.test_chmod_st_ctimes% ^^#^ & & / /#I O ' ' 2 2 2 OODGL// :: ; ; ;i((B   S"+ . . . GMM)U + + +i((B   S"+ . . . / / / / / / / / / / / / / / / / / /sCC88C<?C<c|d}|||d5|j|d|j|}|d|j|d|jddddS#1swxYwYdS)Nrrrtimes) rKr6rrutimer+r-st_atimerrs r,test_utime_sets_current_time_if_args_is_nonezAFakeOsModuleTimeTest.test_utime_sets_current_time_if_args_is_nones~~k** D!!! ^^#^ & & / / GMM$dM + + +d##B   S"+ . . .   S"+ . . .  / / / / / / / / / / / / / / / / / /sA-B;;B?B?cf|d}|||j||j|d|j|}|d|j|d|jdS)NrrrrrrrKr6rr+rr-rrrs rtest_utime_sets_specified_timez3FakeOsModuleTimeTest.test_utime_sets_specified_times~~k** D!!!  T  d& ))) W\\$   BK((( BK(((((rc d}|||j|d|j|}|d|j|d|jdS)N /some_dir)?@rrr)r;rrr+r-rrrs rtest_utime_dirz#FakeOsModuleTimeTest.test_utime_dirs|   &&&  d* --- W\\$   bk*** bk*****rcl|d}||d}|j|||j|d|j|}|d|j|d|j dS)Nr/link_to_some_filerrrr) rKr6rkrrrr+r-rrrs rtest_utime_follow_symlinksz/FakeOsModuleTimeTest.test_utime_follow_symlinkss~~k** D!!!(  &&y$777  iv ... W\\) $ $ BK((( BK(((((rc|d}||d}|j|||j|dd|j|}|d|j|d|j |j|d}| d|j| d|j dS) NrrrF)rrrrr) rKr6rkrrrr+rrrr-rs rtest_utime_no_follow_symlinksz2FakeOsModuleTimeTest.test_utime_no_follow_symlinks&s~~k** D!!!(  &&y$777  ivu EEE W\\) $ $ Ar{+++ Ar{+++ W\\)U\ ; ; BK((( BK(((((rcd}||jj||t j|jj|ddS)Nz/non/existent/filer)r1rr)r*rSrTrUrrs rtest_utime_non_existentz,FakeOsModuleTimeTest.test_utime_non_existent4sS# ,,T22333 ##EL$'-vNNNNNrcd}|||t|jj|d|t|jj|ddS)Nr)rrr{)rr)r;rrrrrs r#test_utime_invalid_times_arg_raisesz8FakeOsModuleTimeTest.test_utime_invalid_times_arg_raises9s_   &&& )TW]D)DDD )TW]D*EEEEErcf|d}|||j||j|d|j|}|d|j|d|jdS)Nr) insg?g?rrs r$test_utime_sets_specified_time_in_nsz9FakeOsModuleTimeTest.test_utime_sets_specified_time_in_nsBs~~k** D!!!  T  d5 666 W\\$   bk*** bk*****rc0d}|j||t|jj|d|t|jj|d|t |jj|dddS)Nrr r )rrNr)rr)rr)rkr'rrrr ValueErrorrs r'test_utime_incorrect_ns_argument_raisesz ) )       ##EK6JJJ~~k** D!!! *\$/ * *4& A A A -Q GMM!)6M 2 2 2d##B   Q , , ,   Q , , ,  - - - - - - - - - - - - - - - - - -s"A2D!!D%(D%N)r<r=r>rrrrrrrr rrrr/rrrrs / / //// ) ) )+++ ) ) ) ) ) )OOO FFF + + +    - - - - -rrceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZejej ddZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d"Z'd#Z(d$Z)d%Z*d&Z+d'Z,d(Z-d)Z.d*Z/d+Z0d,Z1d-Z2d.Z3d/Z4d0Z5d1Z6d2Z7ejej8 d3d4Z9d5S)6FakeOsModuleLowLevelFileOpTestzCTest low level functions `os.open()`, `os.read()` and `os.write()`.c|d}||d|j|tj}|d|j|d|tj |jj |d|j |dS)Nrr\rrr) rKr'rrrr-rrSrTrrrrrfile_dess rtest_open_read_onlyz2FakeOsModuleLowLevelFileOpTest.test_open_read_onlyisNN7++  [9997<< 2;77 dgll8Q&?&?@@@ ##EK'RRR  hrc\||d}||d|j|tj}|tj|jj |d|j |dS)Nrr\rr) rrKr'rrrrSrTrrrrs r*test_open_read_only_write_zero_bytes_posixzIFakeOsModuleLowLevelFileOpTest.test_open_read_only_write_zero_bytes_posixrs NN7++  [9997<< 2;77 ##EK'RRR  hrcb||d}||d|j|tj}|d|j|d|j|dS)Nrr\rrr) rrKr'rrrr-rrrs r,test_open_read_only_write_zero_bytes_windowszKFakeOsModuleLowLevelFileOpTest.test_open_read_only_write_zero_bytes_windows{s !!!NN7++  [9997<< 2;77 DGMM(C88999  hrcf|d}||d|j|tj}|d|j|d||d|j|dSNrr\rrrstestents) rKr'rrrr-rr,rrs rtest_open_write_onlyz3FakeOsModuleLowLevelFileOpTest.test_open_write_onlysNN7++  [9997<< 2;77 DGMM(G<<=== I{333  hrcH|d}||d|j|tj}|t j|jj|d|j ||j|tjtj z}|t j|jj|d|j ||d}|j|tj tjz}|t j|jj|d|j ||j|tj tjztj z}|t j|jj|d|j |dS)Nrr\rrr) rKr'rrrrSrTrrrrgr)rrrrs r#test_open_write_only_raises_on_readzBFakeOsModuleLowLevelFileOpTest.test_open_write_only_raises_on_readsNN7++  [9997<< 2;77 ##EKxKKK  h7<< 2;+CDD ##EKxKKK  h^^G,, 7<< BJ,DEE ##EKxKKK  h7<< BJ,Drz,QRR ##EKxKKK  hrcH||d}|j|tjtjz}|tj|jj |d|j |dS)Nrr) rrKrrrrrSrTrrrrs r*test_open_write_only_read_zero_bytes_posixzIFakeOsModuleLowLevelFileOpTest.test_open_write_only_read_zero_bytes_posixs} NN7++ 7<< 2: +CDD ##EKxKKK  hrcN||d}|j|tjtjz}|d|j|d|j|dS)Nrrr) rrKrrrrr-rrrs r,test_open_write_only_read_zero_bytes_windowszKFakeOsModuleLowLevelFileOpTest.test_open_write_only_read_zero_bytes_windowss !!!NN7++ 7<< 2: +CDD dgll8Q77888  hrcf|d}||d|j|tj}|d|j|d||d|j|dSr ) rKr'rrryr-rr,rrs rtest_open_read_writez3FakeOsModuleLowLevelFileOpTest.test_open_read_writesNN7++  [9997<< 2955 DGMM(G<<=== I{333  hrcd|d}|j|tj}|d|j|d|tj|jj |d|j |dSNrrrr) rKrrrr-rrSrTrrrrs rtest_open_create_is_read_onlyz> dgll8Q77888 ##EK#NNN  hrcr||d}|j|tjtjzd}||jj|| tj |jj |d| d|j|d|d|j|j|j|dS)Nrrrrr)rrKrrrrr(r)r*rSrTrrr-rrr+r/rrs rtest_open_create_mode_posixz:FakeOsModuleLowLevelFileOpTest.test_open_create_mode_posixs NN7++ 7<< 2;+CUKK  ++I66777 ##EKxKKK DGMM(G<<=== udgll9&=&=&EFFF  hrcr||d}|j|tjtjzd}||jj|| tj |jj |d| d|j|d|d|j|j|j|dS)Nrrrrrr%)rrKrrrrr(r)r*rSrTrrr-rrr+r/rrs rtest_open_create_mode_windowsz>%(( !!! ##EL$',"+VVV ##EL$',"+VVV ##EL$',")TTTTTrcZ||d}|||tj|jj|t j|tj|jj|t j dSr) rrKr:rSrTrjrrrryr.s r2test_open_directory_for_writing_raises_under_posixzQFakeOsModuleLowLevelFileOpTest.test_open_directory_for_writing_raises_under_posixjs >>%(( !!! ##EL$',"+VVV ##EL$',")TTTTTrcT|||d}|||j|tj}|d||j|dS)Nrur{) rrirKr:rrrr-r)rrrs r)test_open_directory_read_only_under_posixzHFakeOsModuleLowLevelFileOpTest.test_open_directory_read_only_under_posixqs  >>%(( !!!7<<"+66 H%%%  hrc||d}|j||t j|jj|tjdSr() r:rKrrrSrTrjrrr.s r0test_opening_existing_directory_in_creation_modezOFakeOsModuleLowLevelFileOpTest.test_opening_existing_directory_in_creation_modezsa >>'**  h ##EL$',"*UUUUUrc.||d}|j||j|tj}|tj|jj |ddS)Nr)r) r>rKrrrrrSrTrr)rrrs r"test_writing_to_existing_directoryzAFakeOsModuleLowLevelFileOpTest.test_writing_to_existing_directorysv >>'**  h W\\(BJ / / ##EKCHHHHHrc||d}|j||t j|jj|tjdSr() rrKrrrSrTrjrrr.s r-test_opening_existing_directory_in_write_modezLFakeOsModuleLowLevelFileOpTest.test_opening_existing_directory_in_write_modesa >>'**  h ##EL$',"+VVVVVrc|||d}|j|tjtjztjz}|j|}| d|j z|j |j |dS)Nryi) rrirKrrrrrgrr-_umaskr/rrrrstat0s rtest_open_mode_posixz3FakeOsModuleLowLevelFileOpTest.test_open_mode_posixs  NN5)) 7<< 2: +Cbj+PQQ h'' TW^^%5%5$55u}EEE  hrct||d}|j|tjtjztjz}|j|}|d|j |j |dS)Nryi) rrKrrrrrgrr-r/rrbs rtest_open_mode_windowsz5FakeOsModuleLowLevelFileOpTest.test_open_mode_windowss !!!NN5)) 7<< 2: +Cbj+PQQ h'' 5=111  hrc|d}||dd}||d5}|}|t ||j|||||dddn #1swxYwY||d5}|}|d|j |d||dd |j |d ||d d |j |d ||d d|j |d |d|j |d dddn #1swxYwY| tj |jj||| tj |jj |d dS) Nrs orig contentsrs1234567890abcdefrrrrrrrr) rKr'rrr-rrrr,rrSrTr)rr new_contentsfhrs rtest_write_readz.FakeOsModuleLowLevelFileOpTest.test_write_readsNN7++  -=>>>* YYy$ ' ' 92YY[[F   S.. fl0S0S T T T    < 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 YYy$ ' ' <2YY[[F   S$',,vq"9"9 : : :   \!A#. VQ0G0G H H H   \!B$/fa1H1H I I I   \"##. VS0I0I J J J   S$',,vr":": ; ; ;  < < < < < < < < < < < < < < < ##EK UUU ##EKvrJJJJJs&A'B88B<?B<DG==HHc|d}|j|tjtjztjz}|j|tjtjztjz}|j|d|j|d|d|jj || |d|j ||j |dS)Nrysaaaasbbrsbbaa) rKrrrrrgrr-r)rMr,rrrfd0r s rtest_write_from_different_f_dsz=FakeOsModuleLowLevelFileOpTest.test_write_from_different_f_dssNN5)) gll9bj2;&>&KLLgll9bj2;&>&KLL  c7###  c5!!! DGL00;;<<< Iw///  c  crcx|d}|j|tjtjztjz}|j|tjtjz}|j|d|j|d|d|jj || |d|j ||j |dS)Nrysaaasbbbsaaabbb) rKrrrrrgr3rr-r)rMr,rrls r)test_write_from_different_fds_with_appendzHFakeOsModuleLowLevelFileOpTest.test_write_from_different_fds_with_appendsNN5)) gll9bj2;&>&KLLgll9bkBK&?@@  c6"""  c6""" DGL00;;<<< Iy111  c  crc||ddd}||d|j|tj}|j|tjtjztjz}|d|j |d|j ||j |dS)NrJrYryrrrr) rrKr'rrrrrgr-rrrls rtest_read_only_read_after_writez>FakeOsModuleLowLevelFileOpTest.test_read_only_read_after_writes NN5%77  W555gll9bj11gll9bj2;&>&KLL dgll322333  c  crc|d}|j|tjtjztjz}|j|tjtjztjz}|j|tj}|j|d|j||d|j |d|j||j|dS)Nrysabcr{) rKrrrrrgrrr-r)rrrmr r s r(test_read_after_closing_write_descriptorzGFakeOsModuleLowLevelFileOpTest.test_read_after_closing_write_descriptorsNN5)) gll9bj2;&>&KLLgll9bj2;&>&KLLgll9bj11  c6"""  c c1!5!5666  c  crc|d}|j|tj}|j|tj}|j|d|j|tjtjztjz}|d|j |d|j|d|d|j |d|j ||j ||j |dS)Nrymrrsmr) rKrrrryrrrgr-rr)rrr r rs rtest_writing_behind_end_of_filez>FakeOsModuleLowLevelFileOpTest.test_writing_behind_end_of_files NN5)) gll9bj11gll9bi00  c4   gll9bj2;&>&KLL dgll322333  c4    47<<Q#7#7888  c  c  crc||||jj|jjdSr!)r setup_fake_fsr(rr)r*devnullr"s rtest_devnull_posixz1FakeOsModuleLowLevelFileOpTest.test_devnull_posixsT    ++DGO<<=====rcj||tjdkr>||jj|jjdS| |jj|jjdS)N)r{r) rrzrrr1rr)r*r{r(r"s rtest_devnull_windowsz3FakeOsModuleLowLevelFileOpTest.test_devnull_windowss !!!   f $ $   TW\00AA B B B B B OODGL//@@ A A A A ArcD|j|jjtj}|d|j|d|d|j|d|j||j|jjtj}|d|j|d|j|dS)Nrrr) rrr{ryr-rrrr)rrs rtest_write_devnullz1FakeOsModuleLowLevelFileOpTest.test_write_devnulls W\\$'/29 5 5 DGMM"g66777 dgll2q11222  b W\\$'/2; 7 7 dgll2q11222  brc$||tj|jjdddd|d}|d}||d|||j|tj }|j|tj }|tj|jj||dddS)NrrrrJrY testcontentr) r:rSrTrrsendfilerKr'rrr src_file_path dst_file_pathr r s rtest_sendfile_with_invalid_fdz__doc__rrrr!r#r%r'r)r,r.r0r4r6r8r'r(r is_windowsr;r=r?rArCrErGrJrLrNrQrSrUrWrYr[r]r_rdrfrjrnrqrsrurxr|r~rrrrrrrrr/rrrrfsZMM               $               VVV    (      X_,,.STT99UT9               (((            UUUUUU   VVV IIIWWW       KKK*               >>> BBB S S S . . . / / / 3 3 3 2 2 2X_**,IJJ  KJ   rrceZdZdZdS)RealOsModuleLowLevelFileOpTestcdSr.r/r"s rr|z*RealOsModuleLowLevelFileOpTest.use_real_fs^r0rNr1r/rrrr]r2rrcjeZdZddZdZdZdZdZdZd Z d Z d Z d Z d Z dZdZdZdZdS)FakeOsModuleWalkTestTFcBtd|j|||D}t|d}t|d}|t |t |t ||D]\}}||d|d||dt|d||dt|ddS) Nc3K|]}|VdSr!r/).0steps r z9FakeOsModuleWalkTest.assertWalkResults..fs3  D      r)topdown followlinksc|dSNrr/lsts rz8FakeOsModuleWalkTest.assertWalkResults..is Arkeyc|dSrr/rs rrz8FakeOsModuleWalkTest.assertWalkResults..js CFrrrr)rCrr r|r-rzip)rexpectedtoprrrQentryexpected_entrys rassertWalkResultsz&FakeOsModuleWalkTest.assertWalkResultscs/  !W\\#wK\XX     $6$6777((:(:;;; XF 444%(%:%: B B !E>   ^A.a 9 9 9   ^A.uQx0@0@ A A A   ^A.uQx0@0@ A A A A B Brcd|_dS)zReset the last seen errno.FN last_errnor"s r ResetErrnozFakeOsModuleWalkTest.ResetErrnoqs rc|j|_dS)zStore the last errno we saw.N)rTr)rrds r StoreErrnozFakeOsModuleWalkTest.StoreErrnous".rc|jS)zReturn the last errno we saw.rr"s rGetErrnozFakeOsModuleWalkTest.GetErrnoys rc|d}||jj|d||jj|dd||jj|ddd||jj|dd|ddgdgf|jj|ddgdgf|jj|ddgdgf|jj|dgdgfg}|||d S) zWalk down ordering is correct.rJ1.txtr2.txtry3.txtr4.txtNrKr'rr)r`rrrrs rtest_walk_top_downz'FakeOsModuleWalkTest.test_walk_top_down}sU>>%(( **8W==>>> **8VWEEFFF **8VUGLLMMM **8VWEEFFF '' 3 W\  x 0 05'G9 E W\  x 7 7gY G W\  x 0 0"wi @   x22222rc|d}||jj|ddd||jj|dd||jj|dd||jj|d|jj|ddgdgf|jj|ddgdgf|jj|dgdgf|ddgdgfg}|||dd d S) zWalk up ordering is correct.rJrryrrrrrF)rNrrs rtest_walk_bottom_upz(FakeOsModuleWalkTest.test_walk_bottom_upsh>>%(( **8VUGLLMMM **8VWEEFFF **8VWEEFFF **8W==>>>W\  x 7 7gY G W\  x 0 05'G9 E W\  x 0 0"wi @ '' 3   x)>)>NNNNNrc|dd}|d|jj||j|}|tt|dS)zKRaises an exception when attempting to walk non-existent directory.rJrYFN) rKr-rr)r*r r StopIterationr )rrNrs r test_walk_raises_if_non_existentz5FakeOsModuleWalkTest.test_walk_raises_if_non_existentspNN5%00   3 3I > >???GLL++  -y99999rc|dd}|||j|}|t t |dS)z>%// """GLL**  -y99999rc||dd}|d|jj||j||jD]}|| tj tj fvdS)zMCalls onerror with correct errno when walking non-existent directory.rJrYFonerrorN) rrKr-rr)r*r rr(rrTr[rU)rrN_s r(test_walk_calls_on_error_if_non_existentz=FakeOsModuleWalkTest.test_walk_calls_on_error_if_non_existents NN5%00   3 3I > >???iAA  A   EM5<+HHIIIIIrc||d}|||d|jj||j||jD]}| | tj tj fvdS)zFakeOsModuleWalkTest.test_walk_calls_on_error_if_not_directorys >>(++ """ tw|228<<===h@@  A   EM5<+HHIIIIIrc|d}d}d}||jj|d||jj||d||jj||d||jj||d||jj||d|j|d}t |}|d |d }t|D]j\}}}| d | |jjj |z| |jjj |zrd }k| d |d S) z=Caller can modify list of directories to visit while walking.rJvisitno_visitrYrrrrrFTN) rKr'rr)r`r r rPiterr-endswithr*) rrrrr root_contentsvisited_visit_directory_dirs_filess r#test_walk_skips_removed_directoriesz8FakeOsModuleWalkTest.test_walk_skips_removed_directoriess~~e$$ **477888 **4@@AAA **4@@AAA **47CCDDD **47CCDDDGLL!6!677 Y a)))"'#' ?? / / D%   UDMM$',2BX2M$N$N O O O}}TW\-566 /*.' 677777rc||d}|d}||jj|d||jj|dd||jj|ddd||jj|d||ddggf|jj|ddgdgf|jj|ddgdgfg}|||d |jj|dgdgfg}|||jj|dd dS) NrJrsubfilerYryrvrw created_linkFrrrKr'rr)r`rrrrrrs r test_walk_followsymlink_disabledz5FakeOsModuleWalkTest.test_walk_followsymlink_disableds >>%((>>(++ **8Y??@@@ **8UEBBCCC **8UGWMMNNN DGL--hGGRRR~. 3 W\  x / /'UG D W\  x 8 8"wi H  xuEEEW\&&x@@"ykRS   GL  h 7 7      rc(||d}|d}||jj|d||jj|dd||jj|ddd||jj|d|jj||ddggf|jj|ddgdgf|jj|ddgdgf|jj|dgdgfg}|||d |jj|dgdgfg}|||jj|dd dS) NrJrrrYryrvrwrTrrrs rtest_walk_followsymlink_enabledz4FakeOsModuleWalkTest.test_walk_followsymlink_enableds >>%((>>(++ **8Y??@@@ **8UEBBCCC **8UGWMMNNN  GL  h 7 7 GL  h ' '   ~. 3 W\  x / /'UG D W\  x 8 8"wi H W\  x 8 8"yk J   xtDDDW\&&x@@"ykRS   GL  h 7 7      rc||d}|||d|ddggfdgdgfg}||ddS)Nz /foo/bar/bazrYr?rry)rrir'rr)rrrs rtest_walk_linked_file_in_subdirz4FakeOsModuleWalkTest.test_walk_linked_file_in_subdirs  "  ### E9---eWb)JUG+DE x00000rc|ddd}|||dd|dddd|dddd|jjjdzz|d|jjjdzzdzg}|D]9}|j|D]\}}}|||:|dddd}|||D]K}|j|D].\}}}|||/LdS)NrJrYryrhr{ru) rKr'rr)r*r r-r( startswith)rrvariantsrdirpath _dirnames _filenamess rtest_base_dirpathz&FakeOsModuleWalkTest.test_base_dirpathsNN5%77  ### NN5% ( ( NN5$u 5 5 NN5$u 5 5 8H18L L NN5 ! !DGL$4q$8 85 @   ! 4 4H26',,x2H2H 4 4.J  (3333 4NN5%>>  ###  > >H26',,x2H2H > >.J 2 28 < <==== > > >rN)TF)r<r=r>rrrrrrrrrrrrrrrr/rrrrbs B B B B   ))) 3 3 3OOO :::::: J J J J J J8880   .   6 1 1 1>>>>>rrceZdZdZdS)RealOsModuleWalkTestcdSr.r/r"s rr|z RealOsModuleWalkTest.use_real_fs0r0rNr1r/rrrr/r2rrc$eZdZfdZdZdZdZeje e d ddZ dZ d Z d Zd Zd Zd ZdZdZeje e d ddZdZdZdZdZdZdZdZdZxZS)FakeOsModuleDirFdTestc:t||s|jj|d|_| |j|j |jtj |_ d|_ |jj|j|j |_||jdS)NrJry)rrrr|rrclearrK dir_fd_pathr:rrdir_fdfnamer)r`fpathr'rs rrzFakeOsModuleDirFdTest.setUp5s   !! , G # ) ) + + +>>%00 ()))gll4#3R[AA  W\&&t'7DD  $$$$$rcp|s!|jj|dSdSr!)r|rradd)rfcts radd_supported_functionz,FakeOsModuleDirFdTest.add_supported_functionCs?!! - G # ' ' , , , , , - -rcffd}jjjjvr<t5|dddn #1swxYwYjjjjjjvr|dSdS)NcfjjjjjSNr)rrrrrr"sr os_accessz4FakeOsModuleDirFdTest.test_access..os_accessHs%7>>$*dgl4;>OO Or)rrrrrrr()rrs` r test_accessz!FakeOsModuleDirFdTest.test_accessGs P P P P P 7>!8 8 8""#677                   ##DGN333 7>TW4 4 4 OOIIKK ( ( ( ( ( 5 4 AAAcfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvrF|jj}d|j dSdS)NcVjjdjdS)Nrr)rrrrr"sros_chmodz2FakeOsModuleDirFdTest.test_chmod..os_chmodSs' GMM$*fT[M A A A A Arr) rrrrrrr+rrr/)rr r4s` rrz FakeOsModuleDirFdTest.test_chmodRs B B B B B 7= 7 7 7""#677                   ##DGM222 7=DG3 3 3 HJJJdj))B  " "62: 6 6 6 6 6 4 3rrz$chown not on all platforms availablec fd}jjjjvr<t 5|dddn #1swxYwYjj|jj} d|tj  d|tj dS)NcXjjddjdS)Nrrr)rrrrr"sros_chownz2FakeOsModuleDirFdTest.test_chown..os_chownas) GMM$*c3t{M C C C C Crrr) rirrrrrrr+rr-rr)rr r4s` r test_chownz FakeOsModuleDirFdTest.test_chown_s4 D D D D D  7= 7 7 7""#677                   ##DGM222 W\\$* % % bo... bo.....s A$$A(+A(cfd}djjjjvr<t 5|dddn #1swxYwYjjjjjjvr>|jj dSdS)NcVjjjdSN src_dir_fd)rrrr) link_destrsros_linkz7FakeOsModuleDirFdTest.test_link_src_fd..os_linkos' GLLY4;L G G G G Grbat) rKrrrrrrr(r)r*)rrrs` @rtest_link_src_fdz&FakeOsModuleDirFdTest.test_link_src_fdns- H H H H H HNN5)) 7.os_link|s' GLLUt{L C C C C Crr) rrrrrrr)r`rr(r*)rrr s` rtest_link_dst_fdz&FakeOsModuleDirFdTest.test_link_dst_fd{s1 D D D D D 7.os_symlinks' GOODJdkO B B B B Brr) rrrrrrr)r`rr(r*)rrr s` rr3z"FakeOsModuleDirFdTest.test_symlinks1 C C C C C 7?$'"9 9 9""#677                   ##DGO444 7?dg5 5 5 JLLL ))$*:EBBI OODGL// :: ; ; ; ; ; 6 5rcXfd}jjjd}|jj|djjjjjvr< t5|dddn #1swxYwY jjjjjjvr% j|dSdS)NcFjdjS)Nz lemon/treer)rr3rr"sr os_readlinkz8FakeOsModuleDirFdTest.test_readlink..os_readlinks 7##L#EE Errtree) rr)r`rr:rrr3rrrrr-)rr!rs` rrz#FakeOsModuleDirFdTest.test_readlinksa F F F F F7<$$T%5w?? !!! DGL--h??LLL 7 47#: : :""#677                   ##DG$4555 7 tw6 6 6   TZ 7 7 7 7 7 7 6s, CC Ccrfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvr%|jddSdS)NcPjjjSr)rr+rrr"sros_statz0FakeOsModuleDirFdTest.test_stat..os_stats7<< 4;<?? ?r餁)rr+rrrrr-r/)rr%s` rrzFakeOsModuleDirFdTest.test_stats @ @ @ @ @ 7| jj |dSdS)NcJjdjdSNrr)rrrr"sros_mkdirz2FakeOsModuleDirFdTest.test_mkdir..os_mkdir# GMM(4;M 7 7 7 7 7rr) rr)r`rrrrrrr(r*)rr, newdir_paths` rr9z FakeOsModuleDirFdTest.test_mkdirs, 8 8 8 8 8gl''(8(CC 7= 7 7 7""#677                   ##DGM222 7=DG3 3 3 HJJJ OODGL// << = = = = = 4 3s A55A9<A9c|fd}jjjd}|jj|jjjjvr< t5|dddn #1swxYwY jjjjjjvr>| jj|dSdS)NcJjdjdS)Nrur)rrrr"sros_rmdirz2FakeOsModuleDirFdTest.test_rmdir..os_rmdirs# GMM% M 4 4 4 4 4rru) rr)r`rr:r(r*rrrrrr1)rr1rs` rr z FakeOsModuleDirFdTest.test_rmdirsd 5 5 5 5 57<$$T%5u== !!!  ++H55666 7= 7 7 7""#677                   ##DGM222 7=DG3 3 3 HJJJ   TW\00:: ; ; ; ; ; 4 3s% B<<CCrz$mknod not on all platforms availablecbfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvrjr3tjdkr#ts d|jj j d}jj |dSdS)NcJjdjdSr+)rrrr"sros_mknodz2FakeOsModuleDirFdTest.test_mknod..os_mknodr-rrzNeeds root rights under macosr)rrrrrrrrrrrr)r`rr(r*)rr4r.s` r test_mknodz FakeOsModuleDirFdTest.test_mknods_ 8 8 8 8 8 7= 7 7 7""#677                   ##DGM222 7=DG3 3 3} ?!1W!>> HJJJ',++D,| jj dSdS)NcVjjjdSr)rr+rr)new_namersr os_renamez;FakeOsModuleDirFdTest.test_rename_src_fd..os_renames' GNN4:xDKN H H H H Hrbatz) rr)r`rr+rrrrr(r*)rr9r8s` @rtest_rename_src_fdz(FakeOsModuleDirFdTest.test_rename_src_fds8 I I I I I I7<$$T%5v>> 7>!8 8 8""#677                   ##DGN333 7>TW4 4 4 IKKK OODGL//99 : : : : : 5 4s A77A;>A;cfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvrc|jjjd} jj |dSdS)NcVjjdjdSNr:r)rr+rrr"srr9z;FakeOsModuleDirFdTest.test_rename_dst_fd..os_renames' GNN4:v$+N F F F F Frr:) rr+rrrrr)r`rr(r*)rr9r^s` rtest_rename_dst_fdz(FakeOsModuleDirFdTest.test_rename_dst_fds1 G G G G G 7>!8 8 8""#677                   ##DGN333 7>TW4 4 4 IKKKw|(()96BBH OODGL//99 : : : : : 5 4rc|jj|jd}|j|j||j||jj|dS)Nr:r) rr)r`rrrrr(r*)rr8s rtest_replace_src_fdz)FakeOsModuleDirFdTest.test_replace_src_fdsf7<$$T%5v>>  HEEE  ++H5566666rc|j|jd|j|jj|jd}||jj|dSr>) rrrrr)r`rr(r*)rr^s rtest_replace_dst_fdz)FakeOsModuleDirFdTest.test_replace_dst_fdsf  Ft{CCC7<$$T%5v>>  ++H5566666rc|j|j|j||jj|jdSr)rrPrrr1r)r*rr"s r test_removez!FakeOsModuleDirFdTest.test_removesL tz$+666 ,,TZ8899999rcfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvrC|jjj dSdS)NcTjjjdSr)rr%rrr"sr os_unlinkz4FakeOsModuleDirFdTest.test_unlink..os_unlinks% GNN4:dkN : : : : :r) rr%rrrrr1r)r*r)rrHs` r test_unlinkz!FakeOsModuleDirFdTest.test_unlinks ; ; ; ; ; 7>!8 8 8""#677                   ##DGN333 7>TW4 4 4 IKKK   TW\00<< = = = = = 5 4rcfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvra|jj}d|j d|j dSdS)NcVjjdjdS)Nr)rr)rrrrr"sros_utimez2FakeOsModuleDirFdTest.test_utime..os_utimes' GMM$*F4;M G G G G Grrr) rrrrrrr+rr-rr)rrLr4s` r test_utimez FakeOsModuleDirFdTest.test_utimes6 H H H H H 7= 7 7 7""#677                   ##DGM222 7=DG3 3 3 HJJJdj))B   Q , , ,   Q , , , , , 4 3rchfd}jjjjvr<t5|dddn #1swxYwYjjjjjjvr d|dSdS)NcfjjtjjSr)rrrrrr"sros_openz0FakeOsModuleDirFdTest.test_open..os_open!s#7<< BK <LL Lrr)rrrrrr assertLess)rrPs` r test_openzFakeOsModuleDirFdTest.test_open s M M M M M 7rrrrr'r(r)rr rrr3rrr(r9r r5r;r?rArCrErIrMrRr?r@s@rrr4s % % % % %--- ) ) ) 7 7 7X_W---/UVV / /WV / < < < < < < < < < 8 8 8 : : :/// > > > < < <X_W---/UVV > >WV > ; ; ; ; ; ;777 777 ::: > > > - - - * * * * * * *rrceZdZdZdS)RealOsModuleDirFdTestcdSr.r/r"s rr|z!RealOsModuleDirFdTest.use_real_fs-r0rNr1r/rrrTrT,r2rrTc8eZdZdZdZdZdZdZdZdZ dS) StatPropagationTestctjd|_tj|j|_t j|j|_dS)Nr8)r) rFakeFilesystemrkr FakeOsModulerrrrr"s rrzStatPropagationTest.setUp2sC)8LLL&t77*4?;; rcd}d}d}|j|||dd}|d|j|tj|d|j|j| ||d|j|tj|d|j|j| |t||j|tj|||j|jd S) z-test that file size gets updated via close().rv xyzzy/closezThis is a test.rrrrr2N) rrrr-r+rrkr}rrrrrfile_dirrcontentris r test_file_size_updated_via_closez4StatPropagationTest.test_file_size_updated_via_close7sc! #  h YYy#Y 7 7 DGLL33DLABBB T_77 BBKLLL  DGLL33DLABBB T_77 BBKLLL   Wtw||I'>'>t|'LMMM $/"<".ksBHH]++r)rrkr'rrrFakeLargeFileIoException)rrrgrhriris @@r test_large_file_size_after_writez4StatPropagationTest.test_large_file_size_after_writebs #,--  ##I}#EEE! YYy#Y 7 7   . + + + + +     rcd}d}|jj||}d}|j|||dd}|d|j|t j|d|j |j | ||d|j|t j|d|j |j | |t||j|t j|||j |j ||t||j|t j|||j |j d S) z-test that file size gets updated via flush().rvrzThis might be a test.rrrrr2N)rr)r`rrr-r+rrkr}rrrrr)rr^rrr_ris r test_file_size_updated_via_flushz4StatPropagationTest.test_file_size_updated_via_flushns GL%%h :: )  h YYy#Y 7 7 DGLL33DLABBB T_77 BBKLLL  DGLL33DLABBB T_77 BBKLLL   Wtw||I'>'>t|'LMMM $/"<"'>t|'LMMM $/"<"'>t|'LMMM $/"<"rr`rdrkrorqrsr/rrrWrW1s<<< RRR R R R        RRR(rrWc^eZdZdZdZdZfdZfdZdZdZ dZ d Z d Z d Z d Zd ZdZdZejeed ddZdZdZejejddZejej ddZdZdZdZdZ xZ!S)FakeScandirTestrrc|jjSr!)rrDr"s r used_scandirzFakeScandirTest.used_scandirs wrcPt|j p| |_||_|dd|_|dd}|j j |d|_ |j j |d|_ |j j ddddd|_|j j ddddd|_|j j |jd|_|j j |jd|_|j j |jd|_|j j |jd|_|j j |jd |_|j j |jd |_||j||jd |jz |jr||j ||j d |jz ||j|j ||j|j ||j|j||j|j|j |_|j |jt?| |_!|j!"ddS)Nrvrwrrarurh link_filer rel_link_file rel_link_dirbrrc|jSr!r)rs rrz'FakeScandirTest.setUp..s rr)#rrrr|supports_symlinksrwrDrKrNrr)r`linked_file_pathlinked_dir_pathrel_linked_dir_pathrel_linked_file_pathrrfile_link_path dir_link_pathfile_rel_link_pathdir_rel_link_pathr:r' FILE_SIZELINKED_FILE_SIZErrb pretest_cwdrLrrC do_scandir dir_entriesr{)rrrs rrzFakeScandirTest.setUps   %)_!4!ND>(G44 $ 1 1(F C C#w|005AA#'7<#4#4 $'5$ $  %)GL$5$5 $'6% % ! ))$.%@@ **4>6BB"gl// LL!W\..t~zJJ"&',"3"3DNO"T"T!%!2!24>>!R!R  &&& $2GHHH  ! T OOD0 1 1 1   %t7L0L        2D4H I I I    3T5J K K K    68P Q Q Q    79R S S S 7>>++  dn%%% 1 122 ":":;;;;;rc|j|jtdSr!)rrLrrr#rs rr#zFakeScandirTest.tearDowns6  d&''' rc6||jS)z'Hook to override how scandir is called.)rDrNr"s rrzFakeScandirTest.do_scandirs||DN+++rc|jS)z>Hook to override the expected scandir() path in DirEntry.path.)rNr"s r scandir_pathzFakeScandirTest.scandir_paths ~rcfddg}jr|gdt|tj|djDfd|D}|djDdS)Nrura)rryr{rzcg|] }|j Sr/rrrs r z.FakeScandirTest.test_paths..'Q'Q'Qu 'Q'Q'Qrctg|]4}jj|5Sr/)rr)r`r)rrrs rrz.FakeScandirTest.test_paths..sF   =ADGL  d//114 8 8   rcg|] }|j Sr/r)rs rrz.FakeScandirTest.test_paths..rr)r~extendr-rr)r sorted_names sorted_pathss` r test_pathszFakeScandirTest.test_pathssv  !    JJJ    \**C0@,A,ABBB 'Q'Q@P'Q'Q'QRRR    EQ    'Q'Q@P'Q'Q'QRRRRRrc||jd||jd|jr||jd||jdd||jd||jdd||jd||jdd||jd||jdddSdS NrrrFrr{rr)r1ris_filer(r~r"s r test_isfilezFakeScandirTest.test_isfiles )!,4466777 (+3355666  ! Q   T-a088:: ; ; ;   T-a0888OO P P P OOD,Q/7799 : : :   T-a0888OO P P P   T-a088:: ; ; ;   T-a0888OO P P P OOD,Q/7799 : : :   T-a0888OO P P P P P Q Qrc||jd||jd|jr||jd||jdd||jd||jdd||jd||jdd||jd||jdddSdSr)r(ris_dirr1r~r"s r test_isdirzFakeScandirTest.test_isdirs (+2244555 )!,3355666  ! P OOD,Q/6688 9 9 9   T-a0777NN O O O   T-a07799 : : :   T-a0777NN O O O OOD,Q/6688 9 9 9   T-a0777NN O O O   T-a07799 : : :   T-a0777NN O O O O O P Prcr|jr.||jd||jd||jd||jd||jd||jddSdS)Nrrrr{rr)r~r1r is_symlinkr(r"s r test_is_linkzFakeScandirTest.test_is_links  ! >   T-a0;;== > > >   T-a0;;== > > > OOD,Q/::<< = = = OOD,Q/::<< = = = OOD,Q/::<< = = = OOD,Q/::<< = = = = =  > >rct|ddd}|j|jj|d|dd}|j||||jj|dgd||DdS)NABCDcg|] }|j Sr/r)rrs rrz@FakeScandirTest.test_path_links_not_resolved..s 5 5 5QV 5 5 5r) rrKrror)r`rr-rDr5s rtest_path_links_not_resolvedz,FakeScandirTest.test_path_links_not_resolved s%'''>>#sC00 **8S99:::NN3,,  ),,,  W\  y# . . / 5 5T\\)44 5 5 5     rc|r8|jr|dtr|d||j|jj|j d ||j|j j|j d |j rV||j |jj|j d ||j |jj|j d ||j |jj|j d ||j |jj|j d dSdS) Nz7inode seems not to work in scandir module under Windowsz-inode seems not to work in a Docker containerrrrr{rr)r|rrr r-rr+rst_inorinoderr~rrrrrr"s r test_inodezFakeScandirTest.test_inodes      O Y WXXX O MNNN  GLL ' ' .0@0C0I0I0K0K     GLL ( ( /1A!1D1J1J1L1L     !     d0118 #))++       d1229 #))++       d455< #))++       d566= #))++       rcd|dD}d|dD}|||dS)Ncg|] }|j Sr/rrs rrz5FakeScandirTest.test_scandir_none..5s>>>%5:>>>rcg|] }|j Sr/rrs rrz5FakeScandirTest.test_scandir_none..6s===%5:===rr)rDr-)rresult1result2s rtest_scandir_nonez!FakeScandirTest.test_scandir_none4s\>>4<<+=+=>>>==4<<+<+<=== '*****rc|j|jj}|d|||j}|D]}|j|jkr|j}|jr|d|n|d||d|j|jjdS)Nrr) rr+rr~r-rDrNr)r,)r stat_nlinkdir_iteritemscandir_stat_nlinks rtest_scandir_stat_nlinkz'FakeScandirTest.test_scandir_stat_nlink9sW\\$.11:  J'''<<// K KDyDN**%)YY[[%9"%<$$Q(:;;;;$$Q(:;;;  DGLL$@$@$IJJJ K Krrqrrc|dd}||||jj|d||jj|d||jj|d|j||j|tjtj z}d|j |D}t|gdksJdS) Nrrurrr)flagscg|] }|j Sr/r)r dir_entrys rrz8FakeScandirTest.test_scandir_with_fd..QsHHHyINHHHr)rrr) rKr:r'rr)r`rLrrrqrDr|)rtemp_dirrchildrens rtest_scandir_with_fdz$FakeScandirTest.test_scandir_with_fdGs>>%// !!! **8W==>>> **8W==>>>  ))(H==>>>  h W\\("+*F\ G GHHDGOOB4G4GHHHh#?#?#???????rc^|d}|jj|d}|||jj|d}|||j|5}|D]5}|r|j|j6 dddn #1swxYwY|jj|rJ|jj|rJdS)Nwlsz1.logz2.log) rKrr)r`r'rDrrPr*)rrrritrs r test_file_removed_during_scandirz0FakeScandirTest.test_file_removed_during_scandirTsR>>%((W\&&x99  $$$W\&&x99  $$$ W__X & & /" / /==??/GNN5:... / / / / / / / / / / / / / / / /7<&&z222227<&&z2222222s9C  C$'C$cV||j|jdj|jrt jdkrt|t|j |j j t|jdj |j r||j |jdj|||jddj|t|j |jjt|jdj||j |jdj|||jddj|t|j |jjt|jd jdSdS) Nrr{ rr{Frrrr)r-rrr+rr,rrintrrrr~rrr)rabsolute_symlink_expected_sizerelative_symlink_expected_sizes r check_statzFakeScandirTest.check_statbsP )9!)<)A)A)C)C)KLLL! S%5%?%?   DGLL//899D$Q',,..788     !    T2D4DQ4G4L4L4N4N4V W W W   . #(((??G      DGLL!566?@@D$Q',,..788      T2D4DQ4G4L4L4N4N4V W W W   . #(((??G      DGLL!566?@@D$Q',,..788       rzPOSIX specific behaviorcz|t|jt|jdSr!)rrrrr"s rtest_stat_posixzFakeScandirTest.test_stat_posixs2 D122C8Q4R4RSSSSSrzWindows specific behaviorc2|dddSr)rr"s rtest_stat_windowsz!FakeScandirTest.test_stat_windowss 1rc|jrtjdkrr||j|jt jt|j dj |j r||j|j t j t|j dj||j|j t j t|j djdSdS)Nrrrr)r,rrr-rr+rST_CTIMErrrr~rST_MTIMErr"s r+test_index_access_to_stat_times_returns_intz;FakeScandirTest.test_index_access_to_stat_times_returns_ints;! S%5%?%?    T]++DM:D$Q',,..788     !     T1224=AD$Q',,..788       T1224=AD$Q',,..788        rc@|jr|j|j}||j|jdj||j|jdj||j|jdj||j|jdjdSdS)Nr{r)r~rr+rr-rrst_dev)r file_stats rtest_stat_ino_devz!FakeScandirTest.test_stat_ino_devs  ! R T%:;;I   Y-t/?/B/G/G/I/I/P Q Q Q   Y-t/?/B/G/G/I/I/P Q Q Q   Y-t/?/B/G/G/I/I/P Q Q Q   Y-t/?/B/G/G/I/I/P Q Q Q Q Q  R Rrc|t|jdtj||jj|dtj |jd||jj|dtj |jddS)Nrrurar) r( isinstancerrPathLiker-r)r`rfspathr"s rtest_path_likezFakeScandirTest.test_path_likes  4#3A#6 DDEEE  GL  d//115 9 9 Id&q) * *     GL  d//116 : : Id&q) * *     rcz||tj|jddS)Nru)rirSrTrUrDr"s rtest_non_existing_dirz%FakeScandirTest.test_non_existing_dirs7  ##EL$,@WXXXXXr)"r<r=r>rrrwrr#rrrrrrrrrrr'r(r)rrrrrrrrrrrrr?r@s@rrurusI-<-<-<-<-<^,,, S S S Q Q Q P P P>>>    <+++ K K KX_]3335VWW @ @XW @ 3 3 3>X_X(*CDDTTEDTX_,,.IJJKJ"RRR    YYYYYYYrruceZdZdZdS)RealScandirTestcdSr.r/r"s rr|zRealScandirTest.use_real_fsr0rNr1r/rrrrr2rrceZdZdZdZdS)FakeScandirRelTestcJ|jj|jSr!)rr)relpathrNr"s rrzFakeScandirRelTest.scandir_pathsw|##DN333rcp||jj|jSr!)rDrr)rrNr"s rrzFakeScandirRelTest.do_scandirs(||DGL00@@AAArN)r<r=r>rrr/rrrrs7444 BBBBBrrceZdZdZdS)RealScandirRelTestcdSr.r/r"s rr|zRealScandirRelTest.use_real_fsr0rNr1r/rrrrr2rrz.dir_fd not supported for os.scandir in Windowsc*eZdZfdZdZdZxZS)FakeScandirFdTestc|j|jtdSr!)rrrrr#rs rr#zFakeScandirFdTest.tearDowns5  dk""" rcdSr1r/r"s rrzFakeScandirFdTest.scandir_paths rrc|j|jtj|_||jSr!)rrrNrrrDr"s rrzFakeScandirFdTest.do_scandirs1gll4>2;?? ||DK(((r)r<r=r>r#rrr?r@s@rrrsV )))))))rrceZdZdZdS)RealScandirFdTestcdSr.r/r"s rr|zRealScandirFdTest.use_real_fsr0rNr1r/rrrrr2rrceZdZdZdS)FakeScandirFdRelTestc|j|jj|jtj|_||jSr!)rrr)rrNrrrDr"s rrzFakeScandirFdRelTest.do_scandirsCgll47<#7#7#G#GUU ||DK(((rN)r<r=r>rr/rrrrs#)))))rrceZdZdZdS)RealScandirFdRelTestcdSr.r/r"s rr|z RealScandirFdRelTest.use_real_fsr0rNr1r/rrrrr2rrcBeZdZfdZdZdZdZdZdZdZ xZ S)FakeExtendedAttributeTestc,t||d|_|jj|jd|_| |jdSrq) rrr:rKrrr)r`rr'rs rrzFakeExtendedAttributeTest.setUpsr   u-- **4=%@@ (((((rc|g|j|j|g|j|jdSr!)r-r listxattrrrr"s rtest_empty_xattrz*FakeExtendedAttributeTest.test_empty_xattrsX TW..t}==>>> TW..t~>>?????rc|t5|jddddddS#1swxYwYdS)N bogus_pathr)rrvrgetxattrr"s r*test_getxattr_raises_for_non_existing_filezDFakeExtendedAttributeTest.test_getxattr_raises_for_non_existing_files   0 1 1 3 3 G  \6 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3sAA Ac|t5}|j|jddddn #1swxYwY|t j|jjdS)Nrt) rrrrrr-rTENODATArrrs r/test_getxattr_raises_for_non_existing_attributezIFakeExtendedAttributeTest.test_getxattr_raises_for_non_existing_attributes   w ' ' 62 G  T^W 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6  (:;;;;;s!AA A c"|t5|j|jdddddn #1swxYwY|t 5|j|jdd|jjdddn #1swxYwY|j|jdd|d|j|jd|t5}|j|jdd|jj dddn #1swxYwY|tj |j j dS)Nrvaluevalue)rrrsetxattrrFileExistsError XATTR_REPLACEr-rr XATTR_CREATErTrrrs r test_setxattrz'FakeExtendedAttributeTest.test_setxattrs&   y ) ) > > G  T^VW = = = > > > > > > > > > > > > > > >    / / V V G  T^VXtw?T U U U V V V V V V V V V V V V V V V ::: 47#3#3DNF#K#KLLL   w ' ' U2 G  T^VXtw?S T T T U U U U U U U U U U U U U U U  (:;;;;;s5"A  A A .-B''B+.B+!-EE!Ec\|j|jd|g|j|j|j|jdd|dg|j|j|d|j|jd|j|jd|g|j|j|t5}|j|jddddn #1swxYwY|tj |j j dS)Nrrr ) r removexattrrr-rr rrrrTrrrs rtest_removeattrz)FakeExtendedAttributeTest.test_removeattrs DNF333 TW..t~>>??? (;;; &47#4#4T^#D#DEEE 47#3#3DNF#K#KLLL DNF333 TW..t~>>???   w ' ' 52 G  T^V 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5  (:;;;;;s !E77E;>E;cJ|j|j|j|jdd|dg|j|d|j|jddS)Nrr r)rrLrr r-rrr"s rtest_default_pathz+FakeExtendedAttributeTest.test_default_paths  dm$$$ ::: &47#4#4#6#6777 47#3#3DM6#J#JKKKKKr) r<r=r>rrrrrrrr?r@s@rrrs)))))@@@333<<< < < < < < <LLLLLLLrrcreZdZfdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZxZS)FakeOsUnreadableDirTestc|r|t|d|_|jj|jd|_ | |j | |jddS)Nrrr) r|rrrrKrrr)r`rr'rrs rrzFakeOsUnreadableDirTest.setUps      $  ! ! # # #  z22 **4=+FF ((( 4=%(((((rc|jr|j||ddS|j||dS)NT)force_unix_mode)r,rkrr)rr)r5s rrzFakeOsUnreadableDirTest.chmod'sL   & O ! !$d ! C C C C C GMM$ % % % % %rc|||j}t |dz||dz|j||dzt t|||jdSNr)rirrgetuidr r-r r)ruids r test_getuidz#FakeOsUnreadableDirTest.test_getuid-  gnnb r47>>#3#3444 r799---  dgnn../////rc|||j}t |dz||dz|j||dzt t|||jdSr)rirrgetgidr r-rr)rgids r test_getgidz#FakeOsUnreadableDirTest.test_getgid7r rcts2|tj|jj|jdS|dg|j|jdS)Nr)rrSrTrYrrzrr-r"s rtest_listdir_unreadable_dirz3FakeOsUnreadableDirTest.test_listdir_unreadable_dirAscyy L  ' ' dgot} U U U U U   k]DGOODM,J,J K K K K Krc||jd|dg|j|j||jddS)Nrrr)rrr-rrzr"s rtest_listdir_user_readable_dirz6FakeOsUnreadableDirTest.test_listdir_user_readable_dirGs\ 4=%((( + (F(FGGG 4=%(((((rc^||t}t|dzd}||d||jj|ttsO| t5|j |ddddS#1swxYwYdS|g|j |dS)Nr/dir1rr)rirr r r:r(rr)r*rrrrrzr-)ruser_idrs r.test_listdir_user_readable_dir_from_other_userzFFakeOsUnreadableDirTest.test_listdir_user_readable_dir_from_other_userLsM  ))!  u---  ++H55666 yy <""?33 * *))) * * * * * * * * * * * * * * * * * *   R!:!: ; ; ; ; ;s C22C69C6c||ttdzd}||d||jj|t| g|j |dS)Nrr*ir) rirr r r:r(rr)r*rr-rzr.s r/test_listdir_group_readable_dir_from_other_userzGFakeOsUnreadableDirTest.test_listdir_group_readable_dir_from_other_user[s   A  u---  ++H55666  TW__X6677777rcv|||j}t |dzd}||d||jj|t |tsO| t5|j |ddddS#1swxYwYdS| g|j |dS)Nrr*0r)rirrr"r r:r(r)r*rrrrzr-)rgroup_idrs r0test_listdir_group_readable_dir_from_other_groupzHFakeOsUnreadableDirTest.test_listdir_group_readable_dir_from_other_groupesZ  7>>##1  u---  ++H55666yy <""?33 * *))) * * * * * * * * * * * * * * * * * *   R!:!: ; ; ; ; ;sC>>DDc|||d}||dt t dzt tdz||j j || g|j |tdS)Nrcrr)rrirKr:r r r rr(rr)r*r-rzrr.s r0test_listdir_other_readable_dir_from_other_groupzHFakeOsUnreadableDirTest.test_listdir_other_readable_dir_from_other_groupts  >>&)) %((( A  A   ++H55666 TW__X66777 rc||d|j|jjdzdS)Nrr%)r-rr+rr/r"s rtest_stat_unreadable_dirz0FakeOsUnreadableDirTest.test_stat_unreadable_dirs6 DGLL77?%GHHHHHrc^||jd|d|j|jjdz||jd|d|j|jjdzdS)Nr%r)rrr-rr+r/r"s rtest_chmod_unreadable_dirz1FakeOsUnreadableDirTest.test_chmod_unreadable_dirs 4=%(((  T] ; ; Ce KLLL 4=%((( DGLL77?%GHHHHHrcts2|tj|jj|jdS|d|j|jjdSr) rrSrTrYrr+rr-rr"s r test_stat_file_in_unreadable_dirz8FakeOsUnreadableDirTest.test_stat_file_in_unreadable_dirsdyy F  ' ' dglDN S S S S S   Q T^ < < D E E E E Erc||d}||d||jj||j|||jj|dS)Nrcrr) rrKr:r(rr)r*rr1r.s rtest_remove_unreadable_dirz2FakeOsUnreadableDirTest.test_remove_unreadable_dirs >>&)) u---  ++H55666  h ,,X6677777rc||ttdzd}||d||jj|tts| t5|j |dddn #1swxYwY||jj|dS|j |||jj|dS)Nrr*rr)rrir r r:r(rr)r*rrrrrr1r.s r*test_remove_unreadable_dir_from_other_userzBFakeOsUnreadableDirTest.test_remove_unreadable_dir_from_other_usersw   A  u---  ++H55666 yy <""?33 ( ( h''' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( OODGL//99 : : : : : GMM( # # #   TW\00:: ; ; ; ; ;sC//C36C3)r<r=r>rrrr$r&r(r,r.r2r4r6r8r:r<r>r?r@s@rrrs ) ) ) ) )&&& 000000LLL ))) < < <888 < < <   IIIIII FFF 888<<<<<<rFs +* CCCCCCCCCCCC MLLLLLLLLLLLLL33333>3338U/U/U/U/U/+U/U/U/p^' F2F2F2F2F2(<F2F2F2R(I u-u-u-u-u-/u-u-u-pttttt%9tttn%C J>J>J>J>J>/J>J>J>Z/ u*u*u*u*u*0u*u*u*p1 ccccc(cccLYYYYYYYYYY*YYYYYYxo BBBBBBBB+ $&VWW ) ) ) ) ) ) )XW )) ))))),))) / 0L0L0L0L0L 40L0L0LfJ<J<J<J<J<2J<J<J