%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/trial/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/trial/__pycache__/runner.cpython-312.pyc

�

Ϫ�f߄��f�UdZgd�ZddlZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlmZddl
mZddlmZmZmZmZmZmZmZddlmZddlmZdd	lmZmZmZmZdd
lm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&ddl'mZm(Z(dd
l)m*Z*m+Z+ddl,m-Z-ddl.m/Z/ddl0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ed�Z7Gd�de�Z8d�Z9d�Z:d�Z;d�Z<d�Z=d�Z>d�Z?Gd�de4�Z@d ZAGd!�d"e4�ZBGd#�d$e4�ZCee%j�e%j�e	j�ee	j�fZGeeHd%<d&eGd'eIfd(�ZJd)eKd'eee	j�fd*�ZLee/�Gd+�d,��ZMGd-�d.eM�ZNeGd/�d0��ZOd1�ZPed2eId'ed3fd4��ZQed5eId'ed3fd6��ZRGd7�d8e�ZSeGd9�d:��ZTy);zK
A miscellany of code used to run Trial tests.

Maintainer: Jonathan Lange
)�	TestSuite�DestructiveTestSuite�ErrorHolder�LoggedSuite�
TestHolder�
TestLoader�TrialRunner�
TrialSuite�filenameToModule�	isPackage�isPackageDirectory�
isTestCase�name�samefile�NOT_IN_TEST�N)�contextmanager)�SourceFileLoader)�Callable�	Generator�List�Optional�TextIO�Type�Union)�implementer)�define)�	ParamSpec�Protocol�	TypeAlias�	TypeGuard)�defer)�failure�filepath�log�modules�reflect)�unittest�util)� _ForceGarbageCollectionDecorator�
_iterateTests)�_logObserver)�	ITestCase)�UncleanWarningsReporterWrapper�_ExitWrapper)r�)�itrial�_Pc�V�eZdZdeeefdejdejdefd�Zy)�	_Debugger�f�args�kwargs�returnc��y�N�)�selfr4r5r6s    �6/usr/lib/python3/dist-packages/twisted/trial/runner.py�runcallz_Debugger.runcall?���	�N)	�__name__�
__module__�__qualname__rr1�objectr5r6r=r:r?r<r3r3>s8����"�f�*�%��.0�g�g��AC����	�r?r3c���t|tj�sytjjtjj
|j��d}|dk(S)z>Given an object return True if the object looks like a packageFr�__init__)�
isinstance�types�
ModuleType�os�path�splitext�basename�__file__)�modulerLs  r<rrEsL���f�e�.�.�/���w�w������ 0� 0���� A�B�1�E�H��z�!�!r?c��d�}|�D]H}d|z}tjjtjj||��s�F|cSy)z�
    Is the directory at path 'dirname' a Python package directory?
    Returns the name of the __init__ file (it may have a weird extension)
    if dirname is a package directory.  Otherwise, returns False
    c�>�tjj�Sr9)�	importlib�	machinery�all_suffixesr:r?r<�_getSuffixesz(isPackageDirectory.<locals>._getSuffixesTs���"�"�/�/�1�1r?rEF)rIrJ�exists�join)�dirnamerT�ext�initFiles    r<rrMsM��2��~�����#��
�7�7�>�>�"�'�'�,�,�w��9�:��O��r?c��tjj|�tjj|�k(S)z�
    A hacky implementation of C{os.path.samefile}. Used by L{filenameToModule}
    when the platform doesn't provide C{os.path.samefile}. Do not use this.
    )rIrJ�abspath)�	filename1�	filename2s  r<rr^s)��
�7�7�?�?�9�%�������)C�C�Cr?c�H�|}dtjcxkrdkrTnnQtjj	|�s2tjjtj�|�}tjj|�st|�d���tj|�}	tj|�}t|dd��
t||��Stjj|j �ddz}ttjd	t"�}tjj%|�r1|||�s(tj&|j(=t||��}|S#ttf$rt||��cYSwxYw)
aV
    Given a filename, do whatever possible to return a module object matching
    that file.

    If the file in question is a module in Python path, properly import and
    return that module. Otherwise, load the source manually.

    @param fn: A filename.
    @return: A module object.
    @raise ValueError: If C{fn} does not exist.
    )��)r_�
z doesn't exist)�
moduleNamerMNrz.pyr)�sys�version_inforIrJ�isabsrV�getcwdrU�
ValueErrorr&�filenameToModuleName�namedAny�AttributeError�_importFromFile�getattrrKrMr�isfiler%r@)�fn�oldFnrb�ret�retFile�sames      r<r
r
fs?��
�E�
��!�!�+�G�+�B�G�G�M�M�"�4E��W�W�\�\�"�)�)�+�r�
*��
�7�7�>�>�"���E�9�N�3�4�4��-�-�b�1�J�:����z�*���s�J��%�-��r�j�9�9��g�g���s�|�|�,�Q�/�%�7�G��2�7�7�J��1�D�	�w�w�~�~�b��$�r�7�"3��K�K����%��b�Z�8���J��!
��'�:��r�j�9�9�:�s�3F�F!� F!c���t|�}|sBtjjtjj	|�d�d}|t
jvrt
j|Stjj||�}|st|��tjj|�}|jj|�|t
j|<|S)N���r)�_resolveDirectoryrIrJrK�splitrcr%rQr(�spec_from_file_location�SyntaxError�module_from_spec�loader�exec_module)rnrb�specrNs    r<rkrk�s���	�2�	�B���W�W�%�%�b�g�g�m�m�B�&7��&;�<�Q�?�
��S�[�[� ��{�{�:�&�&��>�>�1�1�*�b�A�D���"�o��
�^�^�
,�
,�T�
2�F��K�K���F�#�$�C�K�K�
���Mr?c��tjj|�r=t|�}|r"tjj	||�}|St|�d���|S)Nz is not a package directory)rIrJ�isdirrrVrg)rnrYs  r<ruru�sT��	�w�w�}�}�R��%�b�)��������b�(�+�B��I���v�%@�A�B�B�
�Ir?c���t|j|jt��|k7r@t	|j�D](}t|j|t��|k(s�&|cS|jS)z�
    Find the attribute name on the method's class which refers to the method.

    For some methods, notably decorators which have not had __name__ set correctly:

    getattr(method.im_class, method.__name__) != method
    )rl�im_classr@rC�dir)�method�aliass  r<�_getMethodNameInClassr��s_���v��������:�f�D�����)�	�E��v����v�x�8�F�B���	��?�?�r?c��eZdZdZd�Zy)rzQ
    A test suite which remove the tests once run, to minimize memory usage.
    c��|jr?|jr	|S|jjd�}||�|jr�?|S)zn
        Almost the same as L{TestSuite.run}, but with C{self._tests} being
        empty at the end.
        r)�_tests�
shouldStop�pop)r;�result�tests   r<�runzDestructiveTestSuite.run�sI��
�k�k�� � ���
��;�;�?�?�1�%�D���L�	�k�k�
�
r?N)r@rArB�__doc__r�r:r?r<rr�s���
r?rz
<not in test>c�"��eZdZdZ�fd�Z�xZS)rz[
    Any errors logged in this suite will be reported to the L{TestResult}
    object.
    c���t}|j�t�|�
|�|j	�|j�D]!}|j
tt�|��#|j�y)z�
        Run the suite, storing all errors in C{result}. If an error is logged
        while no tests are running, then it will be added as an error to
        C{result}.

        @param result: A L{TestResult} object.
        N)
r+�_add�superr��_remove�	getErrors�addErrorrr�flushErrors)r;r��observer�error�	__class__s    �r<r�zLoggedSuite.run�sb��� ���
�
��
���F�������'�'�)�	<�E��O�O�J�{�3�U�;�	<����r?)r@rArBr�r��
__classcell__�r�s@r<rr�s����
�r?rc�0��eZdZdZd�fd�	Zd�Zd�Z�xZS)r	z�
    Suite to wrap around every single test in a C{trial} run. Used internally
    by Trial to set up things necessary for Trial tests to work, regardless of
    what context they are run in.
    c���|r6g}|D]-}tj|t�}|j|��/|}t	|�}t
�|�|g�yr9)r'�decorater)�appendrr�rE)r;�tests�forceGarbageCollection�newTestsr��suiter�s      �r<rEzTrialSuite.__init__�sY���!��H��
&���(�(��/O�P������%�
&��E��E�"��
���%��!r?c����ddlm}tj��|j	dd�fd��|jd�t
jd�j��y)Nr)�reactor�after�shutdownc�&���jd�Sr9)�callback)�ds�r<�<lambda>z"TrialSuite._bail.<locals>.<lambda>s���1�:�:�d�CS�r?�mktemp)	�twisted.internetr�r!�Deferred�addSystemEventTrigger�fireSystemEventr'�TestCase�_wait)r;r�r�s  @r<�_bailzTrialSuite._bail�sN���,��N�N����%�%�g�z�;S�T����
�+�
	���(�#�)�)�!�,r?c�|�	tj||�|j�y#|j�wxYwr9)rr�r��r;r�s  r<r�zTrialSuite.runs(��	��M�M�$��'��J�J�L��D�J�J�L�s�)�;)r:F)r@rArBr�rEr�r�r�r�s@r<r	r	�s����"�
-�r?r	�	_Loadable�thingr7c��t|tj�r|j�St|tj
tjf�r|jSt|�rtj|�Std|����)z�
    @param thing: an object from modules (instance of PythonModule,
        PythonAttribute), a TestCase subclass, or an instance of a TestCase.
    zCannot name )rF�pyunitr��idr%�PythonAttribute�PythonModulerr
r&�qual�	TypeError)r�s r<rrsn��
�%����)��x�x�z���%�'�1�1�7�3G�3G�H�I��z�z���%���|�|�E�"�"��l�5�)�,�
-�-r?�objc�V�	t|tj�S#t$rYywxYw)z�
    @return: C{True} if C{obj} is a class that contains test cases, C{False}
        otherwise. Used to find all the tests in a module.
    F)�
issubclassr�r�r�)r�s r<r
r
0s*��
��#�v���/�/������s��	(�(c�8�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
y)	rz�
    Placeholder for a L{TestCase} inside a reporter. As far as a L{TestResult}
    is concerned, this looks exactly like a unit test.
    Nc��||_y)zM
        @param description: A string to be displayed L{TestResult}.
        N��description)r;r�s  r<rEzTestHolder.__init__Ds��'��r?c�$�|j|�Sr9�r�r�s  r<�__call__zTestHolder.__call__Js���x�x���r?c��|jSr9r��r;s r<r�z
TestHolder.idM������r?c��y)Nrr:r�s r<�countTestCaseszTestHolder.countTestCasesPs��r?c�j�|j|�|j|�|j|�y)z�
        This test is just a placeholder. Run the test successfully.

        @param result: The C{TestResult} to store the results in.
        @type result: L{twisted.trial.itrial.IReporter}.
        N)�	startTest�
addSuccess�stopTestr�s  r<r�zTestHolder.runSs,��	��������$������r?c��|jSr9r�r�s r<�shortDescriptionzTestHolder.shortDescription^r�r?)r@rArBr��failureExceptionrEr�r�r�r�r�r:r?r<rr;s-���
��'� � ��	� r?rc�4��eZdZdZ�fd�Zdefd�Zd�Z�xZS)ra
    Used to insert arbitrary errors into a test suite run. Provides enough
    methods to look like a C{TestCase}, however, when it is run, it simply adds
    an error to the C{TestResult}. The most common use-case is for when a
    module fails to import.
    c�X��t�|�|�tj|�|_y)a+
        @param description: A string used by C{TestResult}s to identify this
        error. Generally, this is the name of a module that failed to import.

        @param error: The error to be added to the result. Can be an `exc_info`
        tuple or a L{twisted.python.failure.Failure}.
        N)r�rEr(�excInfoOrFailureToExcInfor�)r;r�r�r�s   �r<rEzErrorHolder.__init__js$���	����%��3�3�E�:��
r?r7c�T�dj|j|jd�S)Nz)<ErrorHolder description={!r} error={!r}>r/)�formatr�r�r�s r<�__repr__zErrorHolder.__repr__us)��:�A�A�����J�J�q�M�
�	
r?c��|j|�|j||j�|j|�y)z�
        Run the test, reporting the error.

        @param result: The C{TestResult} to store the results in.
        @type result: L{twisted.trial.itrial.IReporter}.
        N)r�r�r�r�r�s  r<r�zErrorHolder.run{s0��	���������d�j�j�)�����r?)	r@rArBr�rE�strr�r�r�r�s@r<rrbs����	;�
�#�
�	r?rc���eZdZUdZdZdZeZeee	d<e
Zee
gefe	d<d�Zd�Zdd�Zd	�ZeZd
�ZeZd�Zd�Zdd
�Zd�Zdd�Zdd�ZeZddeededefd�Z d�Z!dd�Z"y)ra4
    I find tests inside function, modules, files -- whatever -- then return
    them wrapped inside a Test (either a L{TestSuite} or a L{TestCase}).

    @ivar methodPrefix: A string prefix. C{TestLoader} will assume that all the
    methods in a class that begin with C{methodPrefix} are test cases.

    @ivar modulePrefix: A string prefix. Every module in a package that begins
    with C{modulePrefix} is considered a module full of tests.

    @ivar forceGarbageCollection: A flag applied to each C{TestCase} loaded.
    See L{unittest.TestCase} for more information.

    @ivar sorter: A key function used to sort C{TestCase}s, test classes,
    modules and packages.

    @ivar suiteFactory: A callable which is passed a list of tests (which
    themselves may be suites of tests). Must return a test suite.
    r��test_�suiteFactory�sorterc�0�t||j��S)zt
        Sort the given things using L{sorter}.

        @param xs: A list of test cases, class or modules.
        )�key)�sortedr�)r;�xss  r<�sortzTestLoader.sort�s���b�d�k�k�*�*r?c��g}tj|�D]"\}}t|�s�|j|��$|j	|�S)z-Given a module, return all Trial test classes)�inspect�
getmembersr
r�r�)r;rN�classesr�vals     r<�findTestClasseszTestLoader.findTestClasses�sI���� �+�+�F�3�	$�I�D�#��#�����s�#�	$��y�y��!�!r?c��tj|vr"tj|�}	t	|�n|}dx}x}}t|�D]\}}	tj|�}|}n|�Ntj"|�}|j%d�t'dj%|j(��dzd}	|D]}|t+||�}}�	|j/||||�	�S#t
$r|j
||��cYSwxYw#t
$r�tj�d}	|	j�|	j}	|	j��|	jjj}
|
tjk7r�|dk(rtj d|�d���Y��YwxYw#t,$rt-|�d���wxYw)
a�
        Find and load tests, given C{name}.

        @param _name: The qualified name of the thing to load.
        @param recurse: A boolean. If True, inspect modules within packages
            within the given package (and so on), otherwise, only inspect
            modules in the package itself.

        @return: If C{name} is a filename, return the module. If C{name} is a
        fully-qualified Python name, return the object it refers to.
        ��recurseN��zThe module z does not exist.�.r/)�parent�qualNamer�)rI�sepr&rh�
__import__�ImportError�loadFile�_qualNameWalker�namedModulerc�exc_info�tb_next�tb_frame�f_code�co_filenamerM�ModuleNotFoundrirv�lenr@rlrj�loadAnything)r;�_namer�rr�r��	remaining�
searchName�
remainingName�tb�filenameWhereHappened�parts            r<�
findByNamezTestLoader.findByName�s����6�6�U�?��/�/��6�D�	
=��4� ��D�#'�'��'�f�y�)8��)>�!	W�%�J�
�
W��)�)�*�5��*�	��!	W�F�;��"�"�4�(�C��
�
�3���C�I�I�c�l�l�,C�(D�q�(H�(J�K�I�	<�!�
6��"�7�3��#5���	
6�� � ����G�!�
�	
��w�
=��}�}�U�G�}�<�<�
=��.�
W��\�\�^�A�&���j�j�,����B��j�j�,�)+���(:�(:�(F�(F�%�
)�G�,<�,<�<����?�!�0�0�;�t�f�DT�1U�V�V�#�%
W��B�	<� �D�6�)9�!:�;�;�	<�s7�C%�D�:F%�%D�D�AF"�AF"�!F"�%F=c��t|tj�st|�d���t	|d�r|j�St	|d�r|j
�S|j�}|j|�D]"}|j|j|���$t	|d�s|S|j�}|jD]"}|j|j|���$|j||g�S)a�
        Return a test suite with all the tests from a module.

        Included are TestCase subclasses and doctests listed in the module's
        __doctests__ module. If that's not good for you, put a function named
        either C{testSuite} or C{test_suite} in your module that returns a
        TestSuite, and I'll use the results of that instead.

        If C{testSuite} and C{test_suite} are both present, then I'll use
        C{testSuite}.
        z is not a module�	testSuite�
test_suite�__doctests__)
rFrGrHr��hasattrr
rr�r��addTest�	loadClassr�loadDoctests)r;rNr��	testClass�docSuite�docTests      r<�
loadModulezTestLoader.loadModule	s����&�%�"2�"2�3��v�j�(8�9�:�:��6�;�'��#�#�%�%�
�V�\�
*��$�$�&�&��!�!�#���-�-�f�5�	5�I��M�M�$�.�.��3�4�	5��v�~�.��L��$�$�&���*�*�	9�G����T�.�.�w�7�8�	9�� � �%��!2�3�3r?c
�6�t|t�st|�d���t|�st	|�d���|j|�}|j
|D�cgc]!}|j||j|z���#c}�}|j|�Scc}w)z�
        Given a class which contains test cases, return a list of L{TestCase}s.

        @param klass: The class to load tests from.
        z is not a classz is not a test case)
rF�typer�r
rg�getTestCaseNamesr��	_makeCase�methodPrefixr�)r;�klass�namesrr�s     r<rzTestLoader.loadClass*s����%��&��u�i��7�8�8��%� ���y�(;�<�=�=��%�%�e�,���	�	�IN�O��T�^�^�E�4�#4�#4�t�#;�
<�O�
��� � ��'�'��
Ps�&Bc�B�tj||j�S)z�
        Given a class that contains C{TestCase}s, return a list of names of
        methods that probably contain tests.
        )r&�prefixedMethodNamesr)r;rs  r<rzTestLoader.getTestCaseNames<s��
�*�*�5�$�2C�2C�D�Dr?c��||�Sr9r:)r;r�
methodNames   r<rzTestLoader._makeCaseCs
���Z� � r?c��t|�st|�d���tj|j�}|r|j�}n|j
�}g}|D]K}|jjd�dj|j�s�;|j|��M|j�}|j|�D]5}	|j�}	|j|	�}
|j)|
��7|S#t $r+t#|jt%j&��}
Y�HwxYw)a�
        Load tests from a module object representing a package, and return a
        TestSuite containing those tests.

        Tests are only loaded from modules whose name begins with 'test_'
        (or whatever C{modulePrefix} is set to).

        @param package: a types.ModuleType object (or reasonable facsimile
        obtained by importing) which may contain tests.

        @param recurse: A boolean.  If True, inspect modules within packages
        within the given package (and so on), otherwise, only inspect modules
        in the package itself.

        @raise TypeError: If C{package} is not a package.

        @return: a TestSuite created with my suiteFactory, containing all the
        tests.
        z is not a packager�rt)rr�r%�	getModuler@�walkModules�iterModulesrrv�
startswith�modulePrefixr�r�r��loadr�
BaseExceptionrr"�Failurer)r;�packager��pkgobj�	discovery�
discovered�discor��modinforN�
thingToAdds           r<�loadPackagezTestLoader.loadPackageFs#��(��!��w�k�):�;�<�<��"�"�7�#3�#3�4����*�*�,�I��*�*�,�I��
��	)�E��z�z����$�R�(�3�3�D�4E�4E�F��!�!�%�(�	)��!�!�#���y�y��,�	&�G�
5� �����"�_�_�V�4�
��M�M�*�%�	&����!�
J�(����w���7H�I�
�
J�s�D	�	1D=�<D=c�>�t|t�r	tj|�}tj|�stjd�yi}d�}||d<tj|fi|��S#t$r!t|t
j��cYSwxYw)z�
        Return a suite of tests for all the doctests defined in C{module}.

        @param module: A module object or a module name.
        z&trial only supports doctesting modulesNc�z�t|d|j�|_|jj�|_y)z�
            Save C{test.globs} and replace it with a copy so that if
            necessary, the original will be available for the next test
            run.
            �
_savedGlobalsN)rl�globsr3�copy)r�s r<�saveGlobalsz,TestLoader.loadDoctests.<locals>.saveGlobals�s/��")����
�
�!K�D���+�+�0�0�2�D�Jr?�setUp)rFr�r&rir'rr"r(r��ismodule�warnings�warn�doctest�DocTestSuite)r;rN�	extraArgsr6s    r<rzTestLoader.loadDoctestsps����f�c�"�
>� �)�)�&�1������'��M�M�B�C���	�	3�)�	�'���#�#�F�8�i�8�8��%!�
>�"�6�7�?�?�+<�=�=�
>�s�A2�2'B�BNc�:�t|tj�r/t|�r|j	||��S|j|�St|t�r+t|tj�r|j|�St|tj�r^t|t�rNt|tj�r4|d}||�}t||j�j|k(sJ�|St|t�r|St!d|����)a�
        Load absolutely anything (as long as that anything is a module,
        package, class, or method (with associated parent class and qualname).

        @param obj: The object to load.
        @param recurse: A boolean. If True, inspect modules within packages
            within the given package (and so on), otherwise, only inspect
            modules in the package itself.
        @param parent: If C{obj} is a method, this is the parent class of the
            method. C{qualName} is also required.
        @param qualName: If C{obj} is a method, this a list containing is the
            qualified name of the method. C{parent} is also required.

        @return: A C{TestCase} or C{TestSuite}.
        r�rtz"don't know how to make test from: )rFrGrHrr0�loadTestsFromModulerr�r�r��loadTestsFromTestCase�FunctionTyperl�_testMethodName�__func__rr�)r;r�r�r�r�r�insts       r<rzTestLoader.loadAnything�s��� �c�5�+�+�,���~��'�'��W�'�=�=��+�+�C�0�0�
��T�
"�z�#�v���'G��-�-�c�2�2��s�E�.�.�/��6�4�(��6�6�?�?�3��B�<�D��$�<�D�
�4��!5�!5�6�?�?�3�F�F�F��K�
��Y�
'��J��@���F�G�Gr?c���	|j|j||��g�S#t$r1|jt|t	j
��g�cYSwxYw)a*
        Load some tests by name.

        @param name: The qualified name for the test to load.
        @param recurse: A boolean. If True, inspect modules within packages
            within the given package (and so on), otherwise, only inspect
            modules in the package itself.
        r�)r�rr'rr"r()r;rr�s   r<�
loadByNamezTestLoader.loadByName�s\��	M��$�$�d�o�o�d�G�o�&L�%M�N�N���	M��$�$�k�$����8I�&J�%K�L�L�	M�s�"%�7A�Arr�r7c	�8�g}g}|D]%}	|j|j||����'|j
|�|j|j|��S#t$r0|jt|t	j
���Y��wxYw)a+
        Load some tests by a list of names.

        @param names: A L{list} of qualified names.
        @param recurse: A boolean. If True, inspect modules within packages
            within the given package (and so on), otherwise, only inspect
            modules in the package itself.
        r�)	r�rFr'rr"r(�extendr��_uniqueTests)r;rr��things�errorsrs      r<�loadByNameszTestLoader.loadByNames�s��������	D�D�
D��
�
�d�o�o�d�G�o�D�E�	D�
	�
�
�f��� � ��!2�!2�6�!:�;�;��!�
D��
�
�k�$����0A�B�C�
D�s�"A � 6B�Bc#�K�t�}|D]A}|j}|D].}t|�|vs�|��|jt|���0�Cy�w)a

        Gather unique suite objects from loaded things. This will guarantee
        uniqueness of inherited methods on TestCases which would otherwise hash
        to same value and collapse to one test unexpectedly if using simpler
        means: e.g. set().
        N)�setr�r��add)r;rJ�seen�	testthing�
testthingsr�s      r<rIzTestLoader._uniqueTests�sY�����u���	)�I�"�)�)�J�#�
)���u�:�T�)��K��H�H�S��Z�(�	
)�	)�s
�.A�#Ac��tj|�}	t||�j�}|j	||��S#t
$rt
|�d���wxYw)a1
        Load a file, and then the tests in that file.

        @param fileName: The file name to load.
        @param recurse: A boolean. If True, inspect modules within packages
            within the given package (and so on), otherwise, only inspect
            modules in the package itself.
        r�z is not a Python file.)r&rhr�load_moduler�OSErrorrg)r;�fileNamer�rrNs     r<r�zTestLoader.loadFile�si���+�+�H�5��	B�%�d�H�5�A�A�C�F��$�$�V�W�$�=�=���	B���z�)?�@�A�A�	B�s�,A�A�F)FNN)#r@rArBr�rr%rr�r�__annotations__rr�rr�rCr�r�rrr?rr@rrr0rrrF�loadTestsFromNamerr��boolrLrIr�r:r?r<rr�s����(�L��L�$-�L�$�y�/�-�,0�F�H�i�[�&�(�)�0�+�"�T
�l4�>%��(� &��E�!�(�T9�:.H�`M�#��<��c��<�T�<�i�<�&)� Br?rc#�K�|gf��|jd�}tdt|��D]}dj|d|�||df���!y�w)a3
    Given a Python qualified name, this function yields a 2-tuple of the most
    specific qualified name first, followed by the next-most-specific qualified
    name, and so on, paired with the remainder of the qualified name.

    @param qualName: A Python qualified name.
    @type qualName: L{str}
    r�r/N)rv�ranger�rV)r��	qualParts�indexs   r<r�r�sf�����R�.�����s�#�I��q�#�i�.�)�A���x�x�	�'�E�6�*�+�Y��v�w�-?�@�@�	A�s�AA�workingDirectory)NNNc#�K�tj�}tj|�}t	j
|�\}}tj|j�d��tj|�|j�y�w)z�
    A context manager which obtains a lock on a trial working directory
    and enters (L{os.chdir}) it and then reverses these things.

    @param workingDirectory: A pattern for the basename of the working
        directory to acquire.
    N)	rIrfr#�FilePathr(�_unusedTestDirectory�chdirrJ�unlock)r_�
currentDir�base�testdir�testDirLocks     r<�_testDirectoryrisd��������J����-�.�D��4�4�T�:��G�[��H�H�W�\�\��	��H�H�Z������s�BB
�logfilec#�HK�|dk(rtj}n(tjt	j
|��}t
j|�}|j}t
j|d�d��t
j|�|j�y�w)z�
    A context manager which adds a log observer and then removes it.

    @param logfile: C{"-"} f or stdout logging, otherwise the path to a log
        file to which to write.
    �-rN)rc�stdoutr(�openTestLogr#rar$�FileLogObserver�emit�startLoggingWithObserver�removeObserver�close)rj�logFile�logFileObserver�observerFunctions    r<�_logFilerw+s{�����#�~��*�*���"�"�8�#4�#4�W�#=�>���)�)�'�2�O�&�+�+��� � �!1�1�5�	����'�(��M�M�O�s�B B"c���eZdZUeed<deejejfde	jfd�Zdeejejfde	jfd�Zy)�_Runner�streamr�r7c��yr9r:�r;r�s  r<r�z_Runner.runEs��r?c��yr9r:r|s  r<�runUntilFailurez_Runner.runUntilFailureHr>r?N)
r@rArBrrXrr�r�rr0�	IReporterr�r~r:r?r<ryryBsc���N���f�o�o�v�/?�/?�?�@��V�EU�EU����&�/�/�6�+;�+;�;�<��	�	�	�r?ryc��eZdZUdZdZdZeeee	e
jgejfed<dZeeed<dZeed<ej&Zeed	<d
Ze	ed<dZeed
<d
Ze	ed<d
Ze	ed<dZeed<d
Ze	ed<dZeeed<d
Ze	ed<e
Ze
jed<dejfd�Ze defd��Z!e de	fd��Z"de#e$jJe$jLfdejfd�Z'	dde#e$jJe$jLfde	dejfd�Z(de#e$jJe$jLfdejfd�Z)y) ra�
    A specialised runner that the trial front end uses.

    @ivar reporterFactory: A callable to create a reporter to use.

    @ivar mode: Either C{None} for a normal test run, L{TrialRunner.DEBUG} for
        a run in the debugger, or L{TrialRunner.DRY_RUN} to collect and report
        the tests but not call any of them.

    @ivar logfile: The path to the file to write the test run log.

    @ivar stream: The file to report results to.

    @ivar profile: C{True} to run the tests with a profiler enabled.

    @ivar _tracebackFormat: A format name to use with L{Failure} for reporting
        failures.

    @ivar _realTimeErrors: C{True} if errors should be reported as they
        happen.  C{False} if they should only be reported at the end of the
        test run in the summary.

    @ivar uncleanWarnings: C{True} to report dirty reactor errors as warnings,
        C{False} to report them as test-failing errors.

    @ivar workingDirectory: A path template to a directory which will be the
        process's working directory while the tests are running.

    @ivar _forceGarbageCollection: C{True} to perform a full garbage
        collection at least after each test.  C{False} to let garbage
        collection run only when it normally would.

    @ivar debugger: In debug mode, an object to use to launch the debugger.

    @ivar _exitFirst: C{True} to stop after the first failed test.  C{False}
        to run the whole suite.

    @ivar log: An object to give to the reporter to use as a log publisher.
    �debugzdry-run�reporterFactoryN�modeztest.logrjrzF�profile�default�_tracebackFormat�_realTimeErrors�uncleanWarnings�_trial_tempr_�_forceGarbageCollection�debugger�
_exitFirst�_logr7c���|j|j|j|j|j�}|j
rt
|�}|jrt|�}|Sr9)	r�rz�tbformat�rterrorsr�r�r.r�r-)r;�reporters  r<�_makeResultzTrialRunner._makeResult�sV���'�'��K�K�����
�
�t�y�y�
���?�?�#�H�-�H����5�h�?�H��r?c��|jSr9)r�r�s r<r�zTrialRunner.tbformat�s���$�$�$r?c��|jSr9)r�r�s r<r�zTrialRunner.rterrors�s���#�#�#r?r�c���tj|t�}|jr!t	j
|jd�}n|j}|||j�S)zC
        Run the test or suite and return a result object.
        zprofile.data)r'r�r,r�r(�profiled�_runWithoutDecorationr�)r;r�r�s   r<r�zTrialRunner.run�sQ��� � ��y�1���<�<��-�-�� :� :�N�K�C��,�,�C��4��5�5�6�6r?r�c�@�����j��t|g|���j�jk(rDt	��D]5}�j|��j
|��j|��7nx�j�jk(r�j�J����fd�}n��fd�}t�j�5t�j�5|�ddd�ddd��j��S#1swY�#xYw#1swY�'xYw)zR
        Private helper that runs the given test but doesn't decorate it.
        Nc�P���jj�j��Sr9)r�r=r�)r�r;r�s���r<r�z3TrialRunner._runWithoutDecoration.<locals>.<lambda>�s���d�m�m�3�3�E�I�I�v�F�r?c�&���j��Sr9r�)r�r�s��r<r�z3TrialRunner._runWithoutDecoration.<locals>.<lambda>�s���e�i�i��/�r?)r�r	r��DRY_RUNr*r�r�r��DEBUGr�rir_rwrj�done)r;r�r��singler�r�r�s`    @@r<r�z!TrialRunner._runWithoutDecoration�s�����!�!�#���D�6�#9�:���9�9����$�'��.�
(��� � ��(��!�!�&�)�����'�
(�
�y�y�D�J�J�&��}�}�0�0�0�F��/���� 5� 5�6�
�����8N�
���
�
�	���
��
�	
�
��
�
�s$�D�D�&D�D	�
D�Dc���d}	|dz
}|jjd|fz�|dk(r|j|�}n|j|�}|jdk(r	|S|j�s	|S�r)z8
        Repeatedly run C{test} until it fails.
        rr/z
Test Pass %d
)rz�writer�r��testsRun�
wasSuccessful)r;r��countr�s    r<r~zTrialRunner.runUntilFailure�s�������Q�J�E��K�K���.�%��9�:���z����$����3�3�D�9�����!�#���
��'�'�)���
�r?rW)*r@rArBr�r�r�rrr�rZr$�LogPublisherr0rrXr�rrjrcrmrzr�r�r�r�r_r�r�r3r�r�r��propertyr�r�rr�r�rr�r�r~r:r?r<rrNs���&�P
�E��G��v�s�D�#�2B�2B�C�V�EU�EU�U�V�V��D�(�3�-���G�S���Z�Z�F�F���G�T��%��c�%�!�O�T�!�!�O�T�!�)��c�)�$)��T�)�$(�H�h�y�!�(��J��� �D�#�
�
� ��V�-�-���%�#�%��%��$�$�$��$�	7��f�o�o�v�/?�/?�?�@�	7�V�EU�EU�	7�(-���F�O�O�V�%5�%5�5�6��!%��
�	�	�	�>��&�/�/�6�+;�+;�;�<��	�	�	�r?r)Ur��__all__r;rQr�rIrcrGr'r�r9�
contextlibr�importlib.machineryr�typingrrrrrrr�zope.interfacer�attrsrrrrr r�r!�twisted.pythonr"r#r$r%r&�
twisted.trialr(�twisted.trial._asyncrunnerr)r*�twisted.trial._synctestr+�twisted.trial.itrialr,�twisted.trial.reporterr-r.�twisted.trial.unittestrr�r0r1r3rrrr
rkrur�rrrr	r�r�r�r�rXr�rrr
rrrr�rirwryrr:r?r<�<module>r�s��
���$���	�
����%�0�K�K�K�&��<�<�"�C�C�(�V�0�*�O�-���t�_�����"��"D�.�b
� ���9��(���)��.!��!�H�������
�O�O��������	�9��.�	�.�c�.�,�D��Y�t�F�O�O�'<�=��
�Y��# �# ��# �L"�*�"�J�vB�vB��vB�rA�,��S��Y�7G�-H����&��c��i�(8�9����,	�h�	��L�L��Lr?

Zerion Mini Shell 1.0