Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_threadedtempfile.cpython-311.pyc |
�
�Ke� � � � d Z ddlZddlmZ ddlZddlZddlZddlmZ ej d�� � dZ
dZ ej � � Z
G d � d
ej � � Z G d� dej � � Zed
k r ej � � dS dS )an
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.
� N)�threading_helper)� print_excT)�module� �2 c � � e Zd ZdZdZd� ZdS )�TempFileGreedyr c �` � t j � � | _ t � � � t t � � D ]g} t j d� � }|� � � | xj
dz
c_
�<# | xj dz
c_ t | j �� � Y �exY wd S )Nzw+b� )�file)
�io�StringIO�errors�
startEvent�wait�range�FILES_PER_THREAD�tempfile�
TemporaryFile�close�ok_count�error_countr )�self�i�fs �D/usr/local/apps/python3/lib/python3.11/test/test_threadedtempfile.py�runzTempFileGreedy.run% s� � ��k�m�m����������'�(�(� #� #�A�
#��*�5�1�1����� � � �
�
�
��"�
�
�
��
,�� � �A�%� � ��t�{�+�+�+�+�+�+����
#� #s � (B�'B+N)�__name__�
__module__�__qualname__r r r � � r r r ! s- � � � � � ��K��H�#� #� #� #� #r"