Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/test/__pycache__/test_threadedtempfile.cpython-312.pyc

�

'Μg����dZddlZddlmZddlZddlZddlZddlmZejd��dZ
dZej�Z
Gd	�d
ej�ZGd�dej �Zed
k(rej&�yy)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��2c��eZdZdZdZd�Zy)�TempFileGreedyrc�`�tj�|_tj	�tt�D]=}	tjd�}|j�|xjdz
c_
�?y#|xjdz
c_t|j��Y�pxYw)Nzw+b�)�file)
�io�StringIO�errors�
startEvent�wait�range�FILES_PER_THREAD�tempfile�
TemporaryFile�close�ok_count�error_countr)�self�i�fs   �7/usr/local/lib/python3.12/test/test_threadedtempfile.py�runzTempFileGreedy.run%s{���k�k�m��������'�(�A�
#��*�*�5�1�����	�
�
�
��"�
�)��
,�� � �A�%� ��t�{�{�+�s�%A>�>-B-N)�__name__�
__module__�__qualname__rrr��rr	r	!s���K��H�#r"r	c��eZdZd�Zy)�ThreadedTempFileTestc�<�tt�D�cgc]}t���}}tj|t
j�5	ddd�td�|D��}|D�cgc]G}|jr9t|j�t|jj��z��I}}dt|�|dj|�fz}|j|g|�|j|tt z�ycc}w#1swY��xYwcc}w)Nc3�4K�|]}|j���y�w)N)r)�.0�ts  r�	<genexpr>z1ThreadedTempFileTest.test_main.<locals>.<genexpr>8s����-�W�����W�s�zErrors: errors %d ok %d
%s�
)r�NUM_THREADSr	r�
start_threadsr�set�sumr�str�namer�getvalue�len�join�assertEqualr)rr�threads�okr(r�msgs       r�	test_mainzThreadedTempFileTest.test_main4s���-2�;�-?�@�-?��>�#�-?��@�
�
+�
+�G�Z�^�^�
D��E�
�-�W�-�
-��"�5�"�a�a�m�m��a�f�f�+��A�H�H�$5�$5�$7� 8�8�"�	�5�,�s�6�{�B��I�I�f��/��������S�)�����[�+;�;�<��A�
D�
D��5s�D�	D
�)AD�
DN)rrr r8r!r"rr$r$3s��=r"r$�__main__)�__doc__r�test.supportr�unittestr
�	threading�	tracebackr�requires_working_threadingr+r�Eventr�Threadr	�TestCaser$r�mainr!r"r�<module>rDs���
��)��	���+��+�+�4�8������Y�_�_�
�
�#�Y�%�%�#�$=�8�,�,�=��z���H�M�M�O�r"

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists