f,dZddlZddlZddlZddlZddlmZmZddlm Z dZ dZ dZ d Z d Zd ZGd d eZeZdS)zUnittest main programN)loaderrunner)installHandlerTaExamples: %(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 aFExamples: %(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 cVtj|r|drtj|rstj|tj}tj|s|tj r|S|}tj |dd dd ddS|S)Nz.py\./) ospathisfilelowerendswithisabsrelpathgetcwd startswithpardirnormpathreplace)namerel_paths 4/opt/alt/python311/lib64/python3.11/unittest/main.py _convert_namers  w~~dP 5 5e < <P 7==   wtRY[[99Hw}}X&& (*=*=bi*H*H  Dw%%crc*224==EEc3OOO Kcd|DS)Nc,g|]}t|S)r).0rs r z"_convert_names../s 2 2 2DM$   2 2 2rr)namess r_convert_namesr#.s 2 2E 2 2 22rcd|vrd|z}|S)N*z*%s*r)patterns r_convert_select_patternr'2s '>>7" Nrc eZdZdZdZdZdxZxZxZxZ xZ Z dZ dddde jddddddf dddZdd Zd Zd Zdd Zd ZdZdZdZddZdZdS) TestProgramzA command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. Nr__main__TF) tb_localsc Vt|trOt||_|dddD]} t |j| |_n||_| t j}||_||_ | |_ ||_ | |_ | |_ | t jsd|_n| |_||_||_||_t&j|d|_|||dS)Nr rdefaultr) isinstancestr __import__modulesplitgetattrsysargvexitfailfast catchbreak verbositybufferr+ warnoptionswarnings defaultTest testRunner testLoaderr r basenameprogName parseArgsrunTests)selfr1r=r5r>r?r6r9r7r8r:r<r+parts r__init__zTestProgram.__init__Bs fc " " !$V,,DK S))!""- 9 9%dk488  9!DK <8D   $" "  CO &DMM%DM&$$((a11  t rctjdt|rt||j||tjddS)NzHTestProgram.usageExit() is deprecated and will be removed in Python 3.13) r<warnDeprecationWarningprint_discovery_parser_initArgParsers _print_helpr4r6)rDmsgs r usageExitzTestProgram.usageExithsr 01C E E E   #JJJ  ! )  " " "   rcZ|j_t|jttd|jiz|jdSt|jttd|jizdS)Nprog) r1rK _main_parser format_help MAIN_EXAMPLESrArL print_helpMODULE_EXAMPLES)rDargskwargss rrNzTestProgram._print_helprs ;  $#//11 2 2 2 -64="99 : : :  " - - / / / / / $#//11 2 2 2 /VT]$;; < < < < !>""48,,,   ( (abb4 8 8 8: ""2&&&     ( (abb4 8 8 8 : 4+DJ77DN:%%"   %!DNN (# . . 4".0DNN!$"233DN rc^|jr|j|j_|r;||jn |}|j|j|j|j|_dS|j&|j|j |_dS|j |j|j |_dSN) testNamePatternsr?r[startr&toptestr`loadTestsFromModuler1loadTestsFromNames)rDfrom_discoveryLoaderrs rrczTestProgram.createTestss   E/3/DDO ,  H(.T__FFHHF' DL$(KKDIII ^ #;;DKHHDIII::4>;?;HHDIIIrc|}|||_|||_dSre)_getParentArgParser_getMainArgParserrS_getDiscoveryArgParserrL)rD parent_parsers rrMzTestProgram._initArgParserssE0022  22=AA!%!rTextTestRunnerr.r|r9r7r:r<r+ TypeErrorrunriresultr6r4 wasSuccessful)rDr>s rrCzTestProgram.runTestssY ?      ? "$3DO dot , , ) / I!%4>:>-8< :>-;?> "1"K"KJJ !III!%4>:>-8< :>-"1"I"IJJJI  / / /!__..  / J nnTY// 9 6 H22444 5 5 5 5 5 6 6s0 3A>=B<>7B85B<7B88B<<CCre)FN)ra __module__ __qualname____doc__r1r9r7r8r:rAr<rfrLrdefaultTestLoaderrFrPrNrBrcrMrorprqr]rCrrrr)r)8s> FINRRHRzRFRXR;K(d#0HTd$$>C$$$$$L===: H H H HLLL !!!F   * = = = =66666rr))rr4r}r r<rrsignalsr __unittestrUrWrr#r'objectr)mainrrrrs  ######    333 \6\6\6\6\6&\6\6\6|r