Ϫf+dZddlZddlZddlmZddlmZdZejddZ dZ d Z Gd d ejZGd d eZy)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 cveZdZddddddddd d efd d efd defddefddefgZdZdZ dZ ddZ dZ ddZ dZy) PackageTest)zbadpackage/__init__.pyfrotz )zbadpackage/test_module.py)zunimportablepackage/__init__.pyr )z"unimportablepackage/test_module.pyzimport notarealmoduleok )zpackage2/__init__.pyr )zpackage2/test_module.pyz import frotz )zpackage/__init__.pyr )zpackage/frotz.pyr)zpackage/test_bad_module.pyz%raise ZeroDivisionError("fake error")zpackage/test_dos_module.py)zpackage/test_import_module.pyz import frotzzpackage/test_module.py)zgoodpackage/__init__.pyr zgoodpackage/test_sample.py)zgoodpackage/sub/__init__.pyr zgoodpackage/sub/test_sample.py)zinheritancepackage/__init__.pyr zinheritancepackage/test_x.pyctjj|d}|jd}|ddk(r|dd}dj |S)Nr/__init__.)ospathsplitextsplitjoin)selffilenamenamesegss =/usr/lib/python3/dist-packages/twisted/trial/test/packages.py _toModuleNamezPackageTest._toModuleNametsMww)!,zz# 8z !9Dxx~cj|jDcgc]\}}|j|c}}Scc}}w)zQ Return matching module names for files listed in C{self.files}. )filesr)rrcodes r getModuleszPackageTest.getModules{s.FJZZP1A(D""8,PPPs/c|j}|j|j|D]} tj|=y#t $rY#wxYwN)rsortreversesysmodulesKeyError)rr$modules rcleanUpModuleszPackageTest.cleanUpModulessU//#  F KK'   sA  AAc|jD]\\}}tjj||}|j |t |d5}|j |ddd^y#1swYixYw)Nw)rrrr_createDirectoryopenwrite)rr parentDirrcontentsfds r createFileszPackageTest.createFilessn"&** # Hhww||Ix8H  ! !( +h$ #" # # # # #s A--A6 ctjj|}tjj|stj|yyr )rrdirnameexistsmakedirs)rr directorys rr*zPackageTest._createDirectorys5GGOOH- ww~~i( KK ")rNct||j}||_|j|j|yr )invalidateImportCachesmktempparentr0r)rr-s rsetUpzPackageTest.setUps4   I  Y/rc$|jyr )r'rs rtearDownzPackageTest.tearDowns r)rr )__name__ __module__ __qualname__ dosModule testModule testSampletestInheritanceSamplerrrr'r0r*r:r=rrrr^s}-)/K$5#'O %y19 !:.' %z2+ ):6. ')>?% E*Q ## 0rrc eZdZddZdZdZy)SysPathManglingTestNcHttjdd|_tjdd|_||j }t j|||jj|j|j|jyr ) r7r#roldPathnewPathr8rr:appendr9 mangleSysPath)rr9s rr:zSysPathManglingTest.setUpsn xx{ xx{ >[[]F$' DKK( 4<<(rcdtj||j|jyr )rr=rLrIr<s rr=zSysPathManglingTest.tearDowns"T" 4<<(rc*|tjddyr )r#r)rpathVars rrLz!SysPathManglingTest.mangleSysPaths rr )r>r?r@r:r=rLrErrrGrGs))rrG)__doc__rr# importlibrr7 twisted.trialrrBreplacerArCrDSynchronousTestCaserrGrErrrUsg   B"    tV , ' R,A(..AH+r