haas.plugins package¶
Submodules¶
haas.plugins.base_hook_plugin module¶
-
class
haas.plugins.base_hook_plugin.
BaseHookPlugin
(name, enabled, enabling_option)[source]¶ Bases:
haas.plugins.i_hook_plugin.IHookPlugin
The base implementation of hook plugins.
haas.plugins.coverage module¶
haas.plugins.discoverer module¶
-
class
haas.plugins.discoverer.
Discoverer
(loader, **kwargs)[source]¶ Bases:
haas.plugins.i_discoverer_plugin.IDiscovererPlugin
The
Discoverer
is responsible for finding tests that can be loaded by aLoader
.-
classmethod
add_parser_arguments
(parser, option_prefix, dest_prefix)[source]¶ Add options for the plugin to the main argument parser.
Parameters: - parser (argparse.ArgumentParser) – The parser to extend
- option_prefix (str) – The prefix that option strings added by this plugin should use.
- dest_prefix (str) – The prefix that
dest
strings for options added by this plugin should use.
-
discover
(start, top_level_directory=None, pattern=u'test*.py')[source]¶ Do test case discovery.
This is the top-level entry-point for test discovery.
If the
start
argument is a drectory, thenhaas
will discover all tests in the package contained in that directory.If the
start
argument is not a directory, it is assumed to be a package or module name and tests in the package or module are loaded.FIXME: This needs a better description.
Parameters: - start (str) – The directory, package, module, class or test to load.
- top_level_directory (str) – The path to the top-level directoy of the project. This is the parent directory of the project’stop-level Python package.
- pattern (str) – The glob pattern to match the filenames of modules to search for tests.
-
discover_by_directory
(start_directory, top_level_directory=None, pattern=u'test*.py')[source]¶ Run test discovery in a directory.
Parameters: - start_directory (str) – The package directory in which to start test discovery.
- top_level_directory (str) – The path to the top-level directoy of the project. This is the parent directory of the project’stop-level Python package.
- pattern (str) – The glob pattern to match the filenames of modules to search for tests.
-
discover_by_file
(start_filepath, top_level_directory=None)[source]¶ Run test discovery on a single file.
Parameters: - start_filepath (str) – The module file in which to start test discovery.
- top_level_directory (str) – The path to the top-level directoy of the project. This is the parent directory of the project’stop-level Python package.
-
discover_by_module
(module_name, top_level_directory=None, pattern=u'test*.py')[source]¶ Find all tests in a package or module, or load a single test case if a class or test inside a module was specified.
Parameters: - module_name (str) – The dotted package name, module name or TestCase class and test method.
- top_level_directory (str) – The path to the top-level directoy of the project. This is the parent directory of the project’stop-level Python package.
- pattern (str) – The glob pattern to match the filenames of modules to search for tests.
-
discover_filtered_tests
(filter_name, top_level_directory=None, pattern=u'test*.py')[source]¶ Find all tests whose package, module, class or method names match the
filter_name
string.Parameters: - filter_name (str) – A subsection of the full dotted test name. This can be
simply a test method name (e.g.
test_some_method
), the TestCase class name (e.g.TestMyClass
), a module name (e.g.test_module
), a subpackage (e.g.tests
). It may also be a dotted combination of the above (e.g.TestMyClass.test_some_method
). - top_level_directory (str) – The path to the top-level directoy of the project. This is the parent directory of the project’stop-level Python package.
- pattern (str) – The glob pattern to match the filenames of modules to search for tests.
- filter_name (str) – A subsection of the full dotted test name. This can be
simply a test method name (e.g.
-
discover_single_case
(module, case_attributes)[source]¶ Find and load a single TestCase or TestCase method from a module.
Parameters: - module (module) – The imported Python module containing the TestCase to be loaded.
- case_attributes (list) – A list (length 1 or 2) of str. The first component must be the name of a TestCase subclass. The second component must be the name of a method in the TestCase.
-
classmethod
from_args
(args, arg_prefix, loader)[source]¶ Construct the discoverer from parsed command line arguments.
Parameters: - args (argparse.Namespace) – The
argparse.Namespace
containing parsed arguments. - arg_prefix (str) – The prefix used for arguments beloning solely to this plugin.
- loader (haas.loader.Loader) – The test loader used to construct TestCase and TestSuite instances.
- args (argparse.Namespace) – The
-
classmethod
-
haas.plugins.discoverer.
filter_test_suite
(suite, filter_name)[source]¶ Filter test cases in a test suite by a substring in the full dotted test name.
Parameters: - suite (haas.suite.TestSuite) – The test suite containing tests to be filtered.
- filter_name (str) – The substring of the full dotted name on which to filter. This should not contain a leading or trailing dot.
haas.plugins.i_hook_plugin module¶
haas.plugins.i_result_handler_plugin module¶
-
class
haas.plugins.i_result_handler_plugin.
IResultHandlerPlugin
[source]¶ Bases:
object
-
classmethod
add_parser_arguments
(parser, name, option_prefix, dest_prefix)[source]¶ Add options for the plugin to the main argument parser.
Parameters: - parser (argparse.ArgumentParser) – The parser to extend
- name (str) – The name of the plugin.
- option_prefix (str) – The prefix that option strings added by this plugin should use.
- dest_prefix (str) – The prefix that
dest
strings for options added by this plugin should use.
-
classmethod
from_args
(args, name, dest_prefix, test_count)[source]¶ Construct the result handler from parsed command line arguments.
Parameters: - args (argparse.Namespace) – The
argparse.Namespace
containing parsed arguments. - name (str) – The name of the plugin.
- dest_prefix (str) – The prefix that
dest
strings for options added by this plugin should use. - test_count (int) – The totel number of tests discovered.
- args (argparse.Namespace) – The
-
classmethod
haas.plugins.i_runner_plugin module¶
-
class
haas.plugins.i_runner_plugin.
IRunnerPlugin
[source]¶ Bases:
object
-
classmethod
add_parser_arguments
(parser, option_prefix, dest_prefix)[source]¶ Add options for the plugin to the main argument parser.
Parameters: - parser (argparse.ArgumentParser) – The parser to extend
- option_prefix (str) – The prefix that option strings added by this plugin should use.
- dest_prefix (str) – The prefix that
dest
strings for options added by this plugin should use.
-
classmethod
haas.plugins.result_handler module¶
-
class
haas.plugins.result_handler.
QuietTestResultHandler
(test_count)[source]¶ Bases:
haas.plugins.i_result_handler_plugin.IResultHandlerPlugin
-
print_error_list
(error_kind, errors)[source]¶ Print the list of errors or failures.
Parameters: - error_kind (str) –
'ERROR'
or'FAIL'
- errors (list) – List of
TestResult
- error_kind (str) –
-
separator1
= u'======================================================================'¶
-
separator2
= u'----------------------------------------------------------------------'¶
-
-
class
haas.plugins.result_handler.
TimingResultHandler
(number_to_summarize)[source]¶ Bases:
haas.plugins.i_result_handler_plugin.IResultHandlerPlugin
-
OPTION_DEFAULT
= <object object>¶
-
separator1
= u'======================================================================'¶
-
separator2
= u'----------------------------------------------------------------------'¶
-
-
class
haas.plugins.result_handler.
VerboseTestResultHandler
(test_count)[source]¶ Bases:
haas.plugins.result_handler.StandardTestResultHandler
haas.plugins.runner module¶
-
class
haas.plugins.runner.
BaseTestRunner
(warnings=None)[source]¶ Bases:
haas.plugins.i_runner_plugin.IRunnerPlugin
A test runner class that does not print any output itself.