� {fc @ s d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z m Z e Z e j d e j � Z d � Z d � Z d � Z d e f d � � YZ e � Z e d � Z e d � Z d e e j d � Z d e e j d � Z d S( s Loading unittests.i����N( t cmp_to_key( t fnmatchi ( t caset suites [_a-z]\w*\.py$c C s/ d | t j � f } t d | t | � | � S( Ns# Failed to import test module: %s %st ModuleImportFailure( t tracebackt format_exct _make_failed_testt ImportError( t namet suiteClasst message( ( s' /usr/lib64/python2.7/unittest/loader.pyt _make_failed_import_test s c C s t d | | | � S( Nt LoadTestsFailure( R ( R t exceptionR ( ( s' /usr/lib64/python2.7/unittest/loader.pyt _make_failed_load_tests s c sG � f d � } i | | 6} t | t j f | � } | | | � f � S( Nc s � � d S( N( ( t self( R ( s' /usr/lib64/python2.7/unittest/loader.pyt testFailure s ( t typeR t TestCase( t classnamet methodnameR R R t attrst TestClass( ( R s' /usr/lib64/python2.7/unittest/loader.pyR s t TestLoaderc B s� e Z d Z d Z e Z e j Z d Z d � Z e d � Z d d � Z d d � Z d � Z d d d � Z d � Z d � Z d � Z d � Z d � Z RS( s� This class is responsible for loading tests according to various criteria and returning them wrapped in a TestSuite t testc C sn t | t j � r! t d � � n | j | � } | rR t | d � rR d g } n | j t | | � � } | S( s; Return a suite of all test cases contained in testCaseClasssY Test cases should not be derived from TestSuite. Maybe you meant to derive from TestCase?t runTest( t issubclassR t TestSuitet TypeErrort getTestCaseNamest hasattrR t map( R t testCaseClasst testCaseNamest loaded_suite( ( s' /usr/lib64/python2.7/unittest/loader.pyt loadTestsFromTestCase0 s c C s� g } x] t | � D]O } t | | � } t | t � r t | t j � r | j | j | � � q q Wt | d d � } | j | � } | r� | d k r� y | | | d � SWq� t k r� } t | j | | j � SXn | S( s> Return a suite of all test cases contained in the given modulet load_testsN( t dirt getattrt isinstanceR R R R t appendR$ t NoneR t ExceptionR t __name__( R t modulet use_load_testst testsR t objR% t e( ( s' /usr/lib64/python2.7/unittest/loader.pyt loadTestsFromModule; s !c C s� | j d � } | d k r} | } xK | ro y t d j | � � } PWq% t k rk | d =| sl � ql q% Xq% W| d } n | } x$ | D] } | t | | � } } q� Wt | t j � r� | j | � St | t � r� t | t j � r� | j | � St | t j � rPt | t � rPt | t j � rP| d } | | � } | j | g � St | t j � rf| St | d � r�| � } t | t j � r�| St | t j � r�| j | g � St d | | f � � n t d | � � d S( sS Return a suite of all test cases given a string specifier. The name may resolve either to a module, a test case class, a test method within a test case class, or a callable object which returns a TestCase or TestSuite instance. The method optionally resolves the names relative to a given module. t .i����i t __call__s" calling %s returned %s, not a tests$ don't know how to make test from: %sN( t splitR* t __import__t joinR R' R( t typest ModuleTypeR2 R R R R R$ t UnboundMethodTypeR R R R R ( R R R- t partst parts_copyR0 t partt parentt instR ( ( s' /usr/lib64/python2.7/unittest/loader.pyt loadTestsFromNameM sH ! c C s2 g | D] } | j | | � ^ q } | j | � S( s� Return a suite of all test cases found using the given sequence of string specifiers. See 'loadTestsFromName()'. ( R@ R ( R t namesR- R t suites( ( s' /usr/lib64/python2.7/unittest/loader.pyt loadTestsFromNames~ s %c C sP | | j d � } t | t | � � } | j rL | j d t | j � � n | S( sL Return a sorted sequence of method names found within testCaseClass c S s% | j | � o$ t t | | � d � S( NR4 ( t startswithR R' ( t attrnameR! t prefix( ( s' /usr/lib64/python2.7/unittest/loader.pyt isTestMethod� s t key( t testMethodPrefixt filterR&