GoodTests (version 2.3.0)
index

Copyright 2011, 2015, 2016, 2017 (c) Timothy Savannah under LGPLv2.1, All Rights Reserved.
 
    If a LICENSE file was not included in this distribution, the license can be found
 
      at https://github.com/kata198/GoodTests/blob/master/LICENSE

 
Modules
       
glob
inspect
multiprocessing
os
pdb
re
shutil
signal
sys
time
traceback
types

 
Classes
       
builtins.object
GoodTests

 
class GoodTests(builtins.object)
    GoodTests - Runs tests well.
 
  Methods defined here:
__init__(self, maxRunners=2, printFailuresOnly=False, extraTimes=False, useColour=True, specificTestPattern=None, usePdb=False)
__init__ - Create a GoodTests object.
 
    @param maxRunner <int> Default DEFAULT_MAX_RUNNERS (number of cpus on system) - 
 
        Set this to the number of concurrent processes you want to run. For tests without any blocking whatsoever,
           you may find it faster to leave maxRunners=1, as there is a minor overhead to using >1.
 
           Also, required to be =1 when doPdb=True (if not, a warning will be printed and it will be forced to 1)
 
    @param printFailuresOnly <bool> Default False, if True will only print the Failures and the summary.
 
        If True, then every method which passes will print a line
 
    @param extraTimes <bool> default False. If True, the time each test method, setup, and teardown function takes will be printed.
 
    @param useColour <bool> default True. If True, will use colour output (works on POSIX/Linux/Unix/Mac terminals). False will not include colours.
 
    @param specificTestPattern <str/None> default None - If a string is provided, this pattern will be compiled and mathced against functions. Only test functions which match this pattern will be run.
 
        For example, specificTestPattern="smoke" will only run test methods which contain 'smoke' in the name.
getTestsForDirectory(self, directory)
getTestsForDirectory - Gather all tests in a given directory.
 
A test begins with test_ and ends with .py
 
@param directory <str> - A path to a directory. This should be cleaned up first ( #_cleanDirectoryNames )
 
@return list ( tuple<str, str/None>  ) - A list of all test files found, coupled potentially with a specific test
output(self, text)
output - Called to output text to stderr, optionally stripping colour if disabled
 
    @param text <str> - Text to send out
runTest(self, testFile, specificTestPattern=None, runnerIdx=None)
runTest - Run a specific test file (where testFile is an importable python name [i.e. test_Something.py]).
All classes beginning with 'Test' are going to be tested.
 
setup_(testClassName) or setup_class and teardown_(testClassName) or teardown_class are run at approperate times
 
Returns tuple (failedResults<testClassName>(testFunctionName, message), testsPassedCount, totalTestsRun)
 
Passes to parent (testFile, return value)
 
     @param testFile <str> - The filename to run
 
     @param specificTestPattern <str/None> default None - If provided, will only run methods matching
 
             this pattern.
runTestMethod(self, instantiatedTestClass, testFile, testFunction, runUnderDebugger=False)
runTestMethod - Run a specific method in a specific test.
 
setup_(methodName) will be run for paticular methodName, as well as setup_method (old school).
 
teardown_(methodName) will be run after method, or teardown_method (old school).
 
 
    @param instantiatedTestClass - module that has been initted
 
    @param testFile - string name of origin file
 
    @param testFunction <method/str> - string of test function name, or the function method itself
 
    @param runUnderDebugger <bool> default False - If True, will execute this method under the debugger
 
                 This is called when self.usePdb = True and an Exception is raised during test execution
 
 
@return tuple<str, str> - Returns a tuple of execution status
 
    first value is 'PASS' or 'FAIL'
    second value is function's traceback or empty string
runTestMethodDebugFailure(self, instantiatedTestClass, testFile, testFunction, excInfo)
runTestMethodDebugFailure - Resume a test method at a failure point.
 
    @see runTestMethod
 
    Additional:
 
        @param excInfo - The sys.exc_info() tuple at time of exception
runTests(self, directories, files)
runTests - Run all tests in directories
 
 @param directories list<str> - A list of directories to process
 
 @param files<str> - A list of filenames to process
terminate(self)
terminate - Kill all running processes

Static methods defined here:
removePycacheDir(directory)
removePycacheDir - Removes the pycache dir from a directory.
 
@param directory <str> - A cleaned-up directory name (no trailing sep)

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
main(args)
main - Begin execution of GoodTests.py with given list of arguments.
 
    This is called when you run "GoodTests.py [someDir]"
 
  @param args list<str> - A list of arguments ( sys.argv[1:] ) 
 
  @return <int> - The exitcode for this execution (for use with sys.exit)
 
    # TODO: We currently exit with code "0" if tests fail. Should this be changed to "1"?
printUsage()
printUsage - Print  a "--help" listing of all supported arguments

 
Data
        __all__ = ('GoodTests', 'printUsage', 'main')
__version_tuple__ = (2, 3, 0)