array_split.unittest.main

array_split.unittest.main(module_name, log_level=10, init_logger_names=None)[source]

Small wrapper for unittest.main() which initialises logging.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 discoverable unittest.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) – If module_name == "__main__" then unit-tests are discovered and run.
  • log_level (int) – The default logging level for all array_split.logging.Logger objects.
  • init_logger_names (sequence of str) – List of logger names to initialise (using array_split.logging.initialise_loggers()). If None, then the list defaults to [module_name, "array_split"]. If list is empty no loggers are initialised.