Back to index

python3.2  3.2.2
Classes | Functions | Variables
unittest.main Namespace Reference

Classes

class  TestProgram

Functions

def _convert_name
def _convert_names

Variables

 __unittest = True
string FAILFAST = " -f, --failfast Stop on first failure\n"
string CATCHBREAK = " -c, --catch Catch control-C and display results\n"
string BUFFEROUTPUT = " -b, --buffer Buffer stdout and stderr during test runs\n"
string USAGE_AS_MAIN
string USAGE_FROM_MODULE
 main = TestProgram

Detailed Description

Unittest main program

Function Documentation

def unittest.main._convert_name (   name) [private]

Definition at line 61 of file main.py.

00061 
00062 def _convert_name(name):
00063     # on Linux / Mac OS X 'foo.PY' is not importable, but on
00064     # Windows it is. Simpler to do a case insensitive match
00065     # a better check would be to check that the name is a
00066     # valid Python module name.
00067     if os.path.isfile(name) and name.lower().endswith('.py'):
00068         if os.path.isabs(name):
00069             rel_path = os.path.relpath(name, os.getcwd())
00070             if os.path.isabs(rel_path) or rel_path.startswith(os.pardir):
00071                 return name
00072             name = rel_path
00073         # on Windows both '\' and '/' are used as path
00074         # separators. Better to replace both than rely on os.path.sep
00075         return name[:-3].replace('\\', '.').replace('/', '.')
00076     return name

Here is the call graph for this function:

Here is the caller graph for this function:

def unittest.main._convert_names (   names) [private]

Definition at line 77 of file main.py.

00077 
00078 def _convert_names(names):
00079     return [_convert_name(name) for name in names]

Here is the call graph for this function:


Variable Documentation

Definition at line 10 of file main.py.

string unittest.main.BUFFEROUTPUT = " -b, --buffer Buffer stdout and stderr during test runs\n"

Definition at line 14 of file main.py.

string unittest.main.CATCHBREAK = " -c, --catch Catch control-C and display results\n"

Definition at line 13 of file main.py.

string unittest.main.FAILFAST = " -f, --failfast Stop on first failure\n"

Definition at line 12 of file main.py.

Definition at line 274 of file main.py.

Initial value:
00001 """\
00002 Usage: %(progName)s [options] [tests]
00003 
00004 Options:
00005   -h, --help       Show this message
00006   -v, --verbose    Verbose output
00007   -q, --quiet      Minimal output
00008 %(failfast)s%(catchbreak)s%(buffer)s
00009 Examples:
00010   %(progName)s test_module               - run tests from test_module
00011   %(progName)s module.TestClass          - run tests from module.TestClass
00012   %(progName)s module.Class.test_method  - run specified test method
00013 
00014 [tests] can be a list of any number of test modules, classes and test
00015 methods.
00016 
00017 Alternative Usage: %(progName)s discover [options]
00018 
00019 Options:
00020   -v, --verbose    Verbose output
00021 %(failfast)s%(catchbreak)s%(buffer)s  -s directory     Directory to start discovery ('.' default)
00022   -p pattern       Pattern to match test files ('test*.py' default)
00023   -t directory     Top level directory of project (default to
00024                    start directory)
00025 
00026 For test discovery all test modules must be importable from the top
00027 level directory of the project.
00028 """

Definition at line 16 of file main.py.

Initial value:
00001 """\
00002 Usage: %(progName)s [options] [test] [...]
00003 
00004 Options:
00005   -h, --help       Show this message
00006   -v, --verbose    Verbose output
00007   -q, --quiet      Minimal output
00008 %(failfast)s%(catchbreak)s%(buffer)s
00009 Examples:
00010   %(progName)s                               - run default set of tests
00011   %(progName)s MyTestSuite                   - run suite 'MyTestSuite'
00012   %(progName)s MyTestCase.testSomething      - run MyTestCase.testSomething
00013   %(progName)s MyTestCase                    - run all 'test*' test methods
00014                                                in MyTestCase
00015 """

Definition at line 45 of file main.py.