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:


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

    [__name__, "module_name_0", "module_name_1", "package.module_name_2"]
  • 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.