Your IP : 216.73.216.213


Current Path : /opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/
Upload File :
Current File : //opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyo

�
��\c@s�dZddlZddlZddlZddlZddlZddlmZdejfd��YZ	e
dkr�ej�ndS(sTests that ensure that the `tempfile` module works with `fake_filesystem`
if using `Patcher` (via `fake_filesystem_unittest`).
i����N(tfake_filesystem_unittesttFakeTempfileModuleTestcBsheZdZd�Zd�Zd�Zd�Zd�Zd�Ze	j
ejdkd	�d
��Z
RS(s5Test the 'tempfile' module with the fake file system.cCs|j�dS(N(t
setUpPyfakefs(tself((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pytsetUpscCsRtj�}|j|jj|j��|j�|jt|jj|j�dS(N(	ttempfiletNamedTemporaryFilet
assertTruetfst
get_objecttnametclosetassertRaisestIOError(Rtobj((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyttest_named_temporary_file"s
cCs�tjdt�}|jd�|j�|jj|j�}|j}|j	d|�tjdddt�}|jd�|j�|jj|j�}|j	d|j�dS(Ntdeletetfootmodetw(
RRtFalsetwriteRRR	R
tcontentstassertEqual(RRtfile_objR((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyt#test_named_temporary_file_no_delete(s

	

cCs
t|jj�}tj�}|jdt|��|j|djtj	j
tj�d���|j||d�|j|jj|d��|jj
r�dnd}|j|jj|d�jtj|B�tj|dd�}|j|d|j��dS(Niittmpii�i�sw+b(tlenRt
open_filesRtmkstempRRt
startswithtostpathtjoint
gettempdirtexistst
is_windows_fsR	tst_modetstattS_IFREGtfdopentfileno(Rtnext_fdt	temporaryRtfh((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyttest_mkstemp5s
cCs	|jttjdd�|jjd�t|jj�}tjdd�}|jdt|��|j||d�|j	|dj
tjj
tjdd���|j	|jj|d��|jjr�dnd}|j|jj|d�jtj|B�d	S(
stest tempfile.mkstemp(dir=).tdirs/diriiiRi�i�N(RtOSErrorRRRt
create_dirRRRRRRR R!tsepR#R$R	R%R&R'(RR*R+R((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyttest_mkstemp_dirDscCs\tj�}|j|�|j|jj|��|j|jj|�jtj	dB�dS(Ni�(
RtmkdtempRRR#RR	R%R&tS_IFDIR(Rtdirname((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyttest_mkdtempUs

iis!TemporaryDirectory showed up in 3cCsetj��S}|j|�|j|jj|��|j|jj|�jtj	dB�WdQXdS(Ni�(
RtTemporaryDirectoryRRR#RR	R%R&R4(Rttmpdir((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyttest_temporary_directory\s

(ii(t__name__t
__module__t__doc__RRRR-R2R6tunittesttskipIftsystversion_infoR9(((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyRs			
			t__main__(R<RR&R?RR=tpyfakefsRtTestCaseRR:tmain(((sR/opt/alt/python27/lib/python2.7/site-packages/pyfakefs/tests/fake_tempfile_test.pyt<module>sJ