o
    b+                     @   sj   d Z ddlZddlZddlmZ ddlmZ dZe	ddZ
dZd	ZG d
d dejZG dd deZdS )zf
Classes and functions used by L{twisted.trial.test.test_util}
and L{twisted.trial.test.test_loader}.
    N)invalidate_caches)unittestzv
from twisted.trial import unittest

class FooTest(unittest.SynchronousTestCase):
    def testFoo(self):
        pass

z
a  
'''This module is used by test_loader to test the Trial test loading
functionality. Do NOT change the number of tests in this module.
Do NOT change the names the tests in this module.
'''

import unittest as pyunit
from twisted.trial import unittest

class FooTest(unittest.SynchronousTestCase):
    def test_foo(self):
        pass

    def test_bar(self):
        pass


class PyunitTest(pyunit.TestCase):
    def test_foo(self):
        pass

    def test_bar(self):
        pass


class NotATest:
    def test_foo(self):
        pass


class AlphabetTest(unittest.SynchronousTestCase):
    def test_a(self):
        pass

    def test_b(self):
        pass

    def test_c(self):
        pass
az  
'''This module is used by test_loader to test the Trial test loading
functionality. Do NOT change the number of tests in this module.
Do NOT change the names the tests in this module.
'''

from twisted.trial import unittest

class X:

    def test_foo(self):
        pass

class A(unittest.SynchronousTestCase, X):
    pass

class B(unittest.SynchronousTestCase, X):
    pass

c                   @   s   e Zd Zddddddddd	d
efddefddefddefddefgZdd Zdd Z	dd Z
d#ddZdd Zd$dd Zd!d" ZdS )%PackageTest)zbadpackage/__init__.pyfrotz
)zbadpackage/test_module.py )zunimportablepackage/__init__.pyr   )z"unimportablepackage/test_module.pyzimport notarealmoduleok
)zpackage2/__init__.pyr   )zpackage2/test_module.pyzimport frotz
)zpackage/__init__.pyr   )zpackage/frotz.pyr   )zpackage/test_bad_module.pyz%raise ZeroDivisionError("fake error")zpackage/test_dos_module.py)zpackage/test_import_module.pyzimport frotzzpackage/test_module.py)zgoodpackage/__init__.pyr   zgoodpackage/test_sample.py)zgoodpackage/sub/__init__.pyr   zgoodpackage/sub/test_sample.py)zinheritancepackage/__init__.pyr   zinheritancepackage/test_x.pyc                 C   s<   t j|d }|d}|d dkr|d d }d|S )Nr   /__init__.)ospathsplitextsplitjoin)selffilenamenamesegs r   =/usr/lib/python3/dist-packages/twisted/trial/test/packages.py_toModuleNamet   s
   

zPackageTest._toModuleNamec                    s    fdd j D S )zQ
        Return matching module names for files listed in C{self.files}.
        c                    s   g | ]	\}}  |qS r   )r   ).0r   coder   r   r   
<listcomp>   s    z*PackageTest.getModules.<locals>.<listcomp>)filesr   r   r   r   
getModules{   s   zPackageTest.getModulesc              	   C   sD   |   }|  |  |D ]}ztj|= W q ty   Y qw d S N)r   sortreversesysmodulesKeyError)r   r"   moduler   r   r   cleanUpModules   s   zPackageTest.cleanUpModulesr   c              	   C   s`   | j D ]*\}}tj||}| | t|d}|| W d    n1 s(w   Y  qd S )Nw)r   r   r   r   _createDirectoryopenwrite)r   r   	parentDirr   contentsfdr   r   r   createFiles   s   
zPackageTest.createFilesc                 C   s*   t j|}t j|st | d S d S r   )r   r   dirnameexistsmakedirs)r   r   	directoryr   r   r   r'      s   zPackageTest._createDirectoryNc                 C   s.   t   |d u r|  }|| _| | j| d S r   )invalidateImportCachesmktempparentr-   r   )r   r*   r   r   r   setUp   s
   zPackageTest.setUpc                 C   s   |    d S r   )r%   r   r   r   r   tearDown   s   zPackageTest.tearDown)r   r   )__name__
__module____qualname__	dosModule
testModule
testSampletestInheritanceSampler   r   r   r%   r-   r'   r5   r6   r   r   r   r   r   ^   s6    


r   c                   @   s&   e Zd ZdddZdd Zdd ZdS )	SysPathManglingTestNc                 C   s`   t   tjd d  | _tjd d  | _|d u r|  }t| | | j| j	 | 
| j d S r   )r2   r!   r   oldPathnewPathr3   r   r5   appendr4   mangleSysPath)r   r4   r   r   r   r5      s   zSysPathManglingTest.setUpc                 C   s   t |  | | j d S r   )r   r6   rB   r?   r   r   r   r   r6      s   
zSysPathManglingTest.tearDownc                 C   s   |t jd d < d S r   )r!   r   )r   pathVarr   r   r   rB      s   z!SysPathManglingTest.mangleSysPathr   )r7   r8   r9   r5   r6   rB   r   r   r   r   r>      s    

r>   )__doc__r   r!   	importlibr   r2   twisted.trialr   r;   replacer:   r<   r=   SynchronousTestCaser   r>   r   r   r   r   <module>   s   )D