array_split.unittest.main¶
-
array_split.unittest.
main
(module_name, log_level=10, init_logger_names=None)[source]¶ Small wrapper for
unittest.main()
which initialiseslogging.Logger
objects. Loads a set of tests from module and runs them; this is primarily for making test modules conveniently executable. The simplest use for this function is to include the following line at the end of a test module:array_split.unittest.main(__name__)
If
__name__ == "__main__"
, then discoverableunittest.TestCase
test cases are executed. Logging level can be explicitly set for a group of modules using:import logging array_split.unittest.main( __name__, logging.DEBUG, [__name__, "module_name_0", "module_name_1", "package.module_name_2"] )
Parameters: - module_name (
str
) – Ifmodule_name == "__main__"
then unit-tests are discovered and run. - log_level (
int
) – The default logging level for allarray_split.logging.Logger
objects. - init_logger_names (sequence of
str
) – List of logger names to initialise (usingarray_split.logging.initialise_loggers()
). IfNone
, then the list defaults to[module_name, "array_split"]
. If list is empty no loggers are initialised.
- module_name (