Back to index

python3.2  3.2.2
Functions | Variables
lib2to3.tests.support Namespace Reference

Functions

def parse_string
def run_all_tests
def reformat
def get_refactorer
def all_project_files

Variables

tuple test_dir = os.path.dirname(__file__)
tuple proj_dir = os.path.normpath(os.path.join(test_dir, ".."))
tuple grammar_path = os.path.join(test_dir, "..", "Grammar.txt")
tuple grammar = driver.load_grammar(grammar_path)
tuple driver = driver.Driver(grammar, convert=pytree.convert)
 TestCase = unittest.TestCase

Detailed Description

Support code for test_*.py files

Function Documentation

Definition at line 48 of file support.py.

00048 
00049 def all_project_files():
00050     for dirpath, dirnames, filenames in os.walk(proj_dir):
00051         for filename in filenames:
00052             if filename.endswith(".py"):
00053                 yield os.path.join(dirpath, filename)

Here is the call graph for this function:

def lib2to3.tests.support.get_refactorer (   fixer_pkg = "lib2to3",
  fixers = None,
  options = None 
)
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.

Definition at line 33 of file support.py.

00033 
00034 def get_refactorer(fixer_pkg="lib2to3", fixers=None, options=None):
00035     """
00036     A convenience function for creating a RefactoringTool for tests.
00037 
00038     fixers is a list of fixers for the RefactoringTool to use. By default
00039     "lib2to3.fixes.*" is used. options is an optional dictionary of options to
00040     be passed to the RefactoringTool.
00041     """
00042     if fixers is not None:
00043         fixers = [fixer_pkg + ".fixes.fix_" + fix for fix in fixers]
00044     else:
00045         fixers = refactor.get_fixers_from_package(fixer_pkg + ".fixes")
00046     options = options or {}
00047     return refactor.RefactoringTool(fixers, options, explicit=True)

Definition at line 22 of file support.py.

00022 
00023 def parse_string(string):
00024     return driver.parse_string(reformat(string), debug=True)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 30 of file support.py.

00030 
00031 def reformat(string):
00032     return dedent(string) + "\n\n"

Here is the call graph for this function:

Here is the caller graph for this function:

def lib2to3.tests.support.run_all_tests (   test_mod = None,
  tests = None 
)

Definition at line 25 of file support.py.

00025 
00026 def run_all_tests(test_mod=None, tests=None):
00027     if tests is None:
00028         tests = unittest.TestLoader().loadTestsFromModule(test_mod)
00029     unittest.TextTestRunner(verbosity=2).run(tests)

Here is the call graph for this function:


Variable Documentation

Definition at line 20 of file support.py.

tuple lib2to3.tests.support.grammar = driver.load_grammar(grammar_path)

Definition at line 19 of file support.py.

Definition at line 18 of file support.py.

Definition at line 17 of file support.py.

tuple lib2to3.tests.support.test_dir = os.path.dirname(__file__)

Definition at line 16 of file support.py.

lib2to3.tests.support.TestCase = unittest.TestCase

Definition at line 54 of file support.py.