관리-도구
편집 파일: main.cpython-35.opt-1.pyc
��Yf8) � @ s� d Z d d l Z d d l Z d d l Z d d l m Z m Z d d l m Z d Z d Z d Z d d � Z d d � Z Gd d � d e � Z e Z d S)zUnittest main program� N� )�loader�runner)�installHandlerTa Examples: %(prog)s test_module - run tests from test_module %(prog)s module.TestClass - run tests from module.TestClass %(prog)s module.Class.test_method - run specified test method %(prog)s path/to/test_file.py - run tests from test_file.py aF Examples: %(prog)s - run default set of tests %(prog)s MyTestSuite - run suite 'MyTestSuite' %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething %(prog)s MyTestCase - run all 'test*' test methods in MyTestCase c C s� t j j | � r� | j � j d � r� t j j | � r� t j j | t j � � } t j j | � sx | j t j � r| | S| } | d d � j d d � j d d � S| S)Nz.py� �\�.�/���)�os�path�isfile�lower�endswith�isabs�relpath�getcwd� startswith�pardir�replace)�nameZrel_path� r �2/opt/alt/python35/lib64/python3.5/unittest/main.py� _convert_name s '$&r c C s d d � | D� S)Nc S s g | ] } t | � � q Sr )r )�.0r r r r � <listcomp>. s z"_convert_names.<locals>.<listcomp>r )�namesr r r �_convert_names- s r c @ s� e Z d Z d Z d Z d Z d Z Z Z Z Z d Z d d d d e j d d d d d d d d d d �Z d d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d d d � Z d d � Z d S)�TestProgramzA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr �__main__T� tb_localsFc C s( t | t � rZ t | � | _ xB | j d � d d � D] } t | j | � | _ q8 Wn | | _ | d k rx t j } | | _ | | _ | | _ | | _ | | _ | | _ | d k r� t j r� d | _ n | | _ | | _ | | _ | | _ t j j | d � | _ | j | � | j � d S)Nr r �defaultr )� isinstance�str� __import__�module�split�getattr�sys�argv�exit�failfast� catchbreak� verbosity�bufferr �warnoptions�warnings�defaultTest� testRunner� testLoaderr r �basename�progName� parseArgs�runTests)�selfr% r1 r) r2 r3 r* r- r+ r, r. r0 r �partr r r �__init__; s, zTestProgram.__init__c C sD | r t | � | j d k r) | j � | j � t j d � d S)N� )�print�_discovery_parser�_initArgParsers�_print_helpr( r* )r8 �msgr r r � usageExita s zTestProgram.usageExitc O sw | j d k rI t | j j � � t t d | j i � | j j � n* t | j j � � t t d | j i � d S)N�prog) r% r<