B €/g^œc@sèdZddlZddlZddlZddlmZddlmZmZddl m Z ej   e¡Zej  ej  ed¡¡Zej  edd¡Ze  e¡Ze  e¡Zejd=e jeejd Z e jeejd Zd d „Zdd d „Zdd„Zddd„Zdd„Zej Z dS)z Support code for test_*.py filesiN©Údedent)ÚpytreeÚrefactor)Údriverz..z Grammar.txtZprint)ÚconvertcCstjt|ƒddS)NT)Zdebug)rÚ parse_stringÚreformat©Zstring©r ú-/usr/lib64/python3.7/lib2to3/tests/support.pyrórcCs,|dkrt ¡ |¡}tjdd |¡dS)Ni)Z verbosity)ÚunittestZ TestLoaderZloadTestsFromModuleZTextTestRunnerZrun)Ztest_modZtestsr r r Ú run_all_testssr cCs t|ƒdS)Nz rrr r r r"r rÚlib2to3csB|dk r‡fdd„|Dƒ}nt ˆd¡}|p0i}tj||ddS)a  A convenience function for creating a RefactoringTool for tests. fixers is a list of fixers for the RefactoringTool to use. By default "lib2to3.fixes.*" is used. options is an optional dictionary of options to be passed to the RefactoringTool. Ncsg|]}ˆd|‘qS)z .fixes.fix_r )Z.0Zfix©Ú fixer_pkgr r z .sz"get_refactorer..z.fixesT)Zexplicit)rZget_fixers_from_packageZRefactoringTool)rZfixersZoptionsr rr Úget_refactorer%s rccsFx@t t¡D]2\}}}x&|D]}| d¡rtj ||¡VqWq WdS)Nz.py)ÚosZwalkÚproj_dirZendswithÚpathÚjoin)ZdirpathZdirnamesZ filenamesZfilenamer r r Úall_project_files4s  r)NN)rNN)!Z__doc__r rZos.pathZtextwraprrrrZ lib2to3.pgen2rZ pgen2_driverrZdirnameZ__file__Ztest_dirZnormpathrrZ grammar_pathZ load_grammarZgrammarZgrammar_no_print_statementZkeywordsZDriverrZdriver_no_print_statementrr rrrZTestCaser r r r Zs,