HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/twisted/trial/__pycache__/_asyncrunner.cpython-38.pyc
U


W[��@s(dZddlmZmZddlZddlZddlmZddlm	Z	m
Z
ddlmZe
d�ZddlmZGd	d
�d
ej�Zee	j�Gdd�de�e	jd
���Zdd�Zdd�ZGdd�de�ZGdd�de�ZGdd�de�Ze�eeje	j�e�eeje	j�eedd�Ze�re�eee	j�dd�ZdS)z-
Infrastructure for test running and suites.
�)�division�absolute_importN)�
components)�itrial�reporter)�_logObserverZunittest)�implementerc@seZdZdZdd�ZdS)�	TestSuitezh
    Extend the standard library's C{TestSuite} with a consistently overrideable
    C{run} method.
    cCs"|jD]}|jrq||�q|S)z;
        Call C{run} on every member of the suite.
        )�_testsZ
shouldStop)�self�result�test�r�</usr/lib/python3/dist-packages/twisted/trial/_asyncrunner.py�runs


z
TestSuite.runN��__name__�
__module__�__qualname__�__doc__rrrrrr	sr	c@s eZdZdZdd�Zdd�ZdS)�
TestDecoratorz�
    Decorator for test cases.

    @param _originalTest: The wrapped instance of test.
    @type _originalTest: A provider of L{itrial.ITestCase}
    cCs
|�|�S�zQ
        Run the unit test.

        @param result: A TestResult object.
        )r�rrrrr�__call__5szTestDecorator.__call__cCs|j�t�||j��Sr)�
_originalTestrrZ_AdaptedReporter�	__class__rrrrr>s�zTestDecorator.runN)rrrrrrrrrrr+s	rrcCs
g|_dS)z�
    Clear all tests from C{suite}.

    This messes with the internals of C{suite}. In particular, it assumes that
    the suite keeps all of its tests in a list in an instance variable called
    C{_tests}.
    N)r
)�suiterrr�_clearSuiteIsrcCsPzt|�}Wntk
r(||�YSXt|�|D]}|�t||��q6|S)a2
    Decorate all test cases in C{test} with C{decorator}.

    C{test} can be a test case or a test suite. If it is a test suite, then the
    structure of the suite is preserved.

    L{decorate} tries to preserve the class of the test suites it finds, but
    assumes the presence of the C{_tests} attribute on the suite.

    @param test: The C{TestCase} or C{TestSuite} to decorate.

    @param decorator: A unary callable used to decorate C{TestCase}s.

    @return: A decorated C{TestCase} or a C{TestSuite} containing decorated
        C{TestCase}s.
    )�iter�	TypeErrorrZaddTest�decorate)r
Z	decoratorZtestsZcaserrrr Usr c@seZdZdZdS)�_PyUnitTestCaseAdapterz2
    Adapt from pyunit.TestCase to ITestCase.
    N)rrrrrrrrr!usr!c@seZdZdZdd�ZdS)�_BrokenIDTestCaseAdapterz�
    Adapter for pyunit-style C{TestCase} subclasses that have undesirable id()
    methods. That is C{unittest.FunctionTestCase} and C{unittest.DocTestCase}.
    cCs |j��}|dk	r|S|j��S)zH
        Return the fully-qualified Python name of the doctest.
        N)rZshortDescription�id)rZtestIDrrrr#�s
z_BrokenIDTestCaseAdapter.idN)rrrrr#rrrrr"|sr"c@seZdZdZdd�ZdS)� _ForceGarbageCollectionDecoratorz�
    Forces garbage collection to be run before and after the test. Any errors
    logged during the post-test collection are added to the test result as
    errors.
    cCsRt��t�||�t��t��t��D]}|�||�q,t��t�	�dS)N)
�gcZcollectrrrZ_addZ	getErrorsZaddErrorZflushErrors�_remove)rr�errorrrrr�sz$_ForceGarbageCollectionDecorator.runNrrrrrr$�sr$ZDocTestCaseccsJzt|�}Wntk
r&|VYn X|D]}t|�D]
}|Vq8q,dS)zF
    Iterate through all of the test cases in C{testSuiteOrCase}.
    N)rr�
_iterateTests)ZtestSuiteOrCaserr
Zsubtestrrrr(�sr() rZ
__future__rrZdoctestr%Ztwisted.pythonrZ
twisted.trialrrZtwisted.trial._synctestr�
__import__ZpyunitZzope.interfacerr	Z	ITestCaseZproxyForInterfacerrr r!r"r$ZregisterAdapterZTestCaseZFunctionTestCase�getattrZ_docTestCaser(rrrr�<module>sH� ���