stouputils.all_doctests module

This module is used to run all the doctests for all the modules in a given directory.

launch_tests(root_dir: str, importing_errors: LogLevels = LogLevels.WARNING_TRACEBACK, strict: bool = True) None[source]

Main function to launch tests for all modules in the given directory.

Parameters:
  • root_dir (str) – Root directory to search for modules

  • importing_errors (LogLevels) – Log level for the errors when importing modules

  • strict (bool) – Modify the force_raise_exception variable to True in the decorators module

Examples

>>> launch_tests("unknown_dir")
Traceback (most recent call last):
        ...
ValueError: No modules found in 'unknown_dir'
> launch_tests("/path/to/source")
[PROGRESS HH:MM:SS] Importing module 'module1'  took 0.001s
[PROGRESS HH:MM:SS] Importing module 'module2'  took 0.002s
[PROGRESS HH:MM:SS] Importing module 'module3'  took 0.003s
[PROGRESS HH:MM:SS] Importing module 'module4'  took 0.004s
[INFO HH:MM:SS] Testing 4 modules...
[PROGRESS HH:MM:SS] Testing module 'module1'    took 0.005s
[PROGRESS HH:MM:SS] Testing module 'module2'    took 0.006s
[PROGRESS HH:MM:SS] Testing module 'module3'    took 0.007s
[PROGRESS HH:MM:SS] Testing module 'module4'    took 0.008s