Your IP : 216.73.216.213


Current Path : /opt/alt/python33/lib64/python3.3/test/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/test/__pycache__/test_threadedtempfile.cpython-33.pyc

�
��f�c@s�dZdZdZddlZddlmZmZmZmZed�Z	ddl
Z
ddlZddlm
Z
e	j�ZGdd	�d	e	j�ZGd
d�de
j�Zdd
�Zedkr�e�ndS(un
Create and delete FILES_PER_THREAD temp files (via tempfile.TemporaryFile)
in each of NUM_THREADS threads, recording the number of successes and
failures.  A failure is a bug in tempfile, and may be due to:

+ Trying to create more than one tempfile with the same name.
+ Trying to delete a tempfile that doesn't still exist.
+ Something we've never seen before.

By default, NUM_THREADS == 20 and FILES_PER_THREAD == 50.  This is enough to
create about 150 failures per run under Win98SE in 2.0, and runs pretty
quickly. Guido reports needing to boost FILES_PER_THREAD to 500 before
provoking a 2.0 failure under Linux.
ii2iN(uthreading_setuputhreading_cleanupurun_unittestu
import_moduleu	threading(u	print_exccBs,|EeZdZdZdZdd�ZdS(uTempFileGreedyic
Cs�tj�|_tj�xjtt�D]\}ytjd�}|j	�Wn'|j
d7_
td|j�Yq&X|jd7_q&WdS(Nuw+biufile(
uiouStringIOuerrorsu
startEventuwaiturangeuFILES_PER_THREADutempfileu
TemporaryFileucloseuerror_countu	print_excuok_count(uselfuiuf((u?/opt/alt/python33/lib64/python3.3/test/test_threadedtempfile.pyurun!s
uTempFileGreedy.runN(u__name__u
__module__u__qualname__uerror_countuok_counturun(u
__locals__((u?/opt/alt/python33/lib64/python3.3/test/test_threadedtempfile.pyuTempFileGreedysuTempFileGreedycBs |EeZdZdd�ZdS(uThreadedTempFileTestcCsg}t�}x4tt�D]&}t�}|j|�|j�qWtj�d}g}xZ|D]R}|j�||j	7}|j
rc|jt|j�t|j
j���qcqcWt|�dt|�|dj|�f}|j|g|�|j|tt�dS(NiuErrors: errors %d ok %d
%su
(uthreading_setupurangeuNUM_THREADSuTempFileGreedyuappendustartu
startEventusetujoinuok_countuerror_countustrunameuerrorsugetvalueuthreading_cleanupulenuassertEqualuFILES_PER_THREAD(uselfuthreadsuthread_infouiutuokuerrorsumsg((u?/opt/alt/python33/lib64/python3.3/test/test_threadedtempfile.pyu	test_main0s&		




	0
uThreadedTempFileTest.test_mainN(u__name__u
__module__u__qualname__u	test_main(u
__locals__((u?/opt/alt/python33/lib64/python3.3/test/test_threadedtempfile.pyuThreadedTempFileTest/suThreadedTempFileTestcCstt�dS(N(urun_unittestuThreadedTempFileTest(((u?/opt/alt/python33/lib64/python3.3/test/test_threadedtempfile.pyu	test_mainJsu	test_mainu__main__(u__doc__uNUM_THREADSuFILES_PER_THREADutempfileutest.supportuthreading_setuputhreading_cleanupurun_unittestu
import_moduleu	threadinguunittestuiou	tracebacku	print_excuEventu
startEventuThreaduTempFileGreedyuTestCaseuThreadedTempFileTestu	test_mainu__name__(((u?/opt/alt/python33/lib64/python3.3/test/test_threadedtempfile.pyu<module>s"