Configuration Reference#
ModuleTester is configured through an INI file named moduletester.ini
placed at the root of the target Python package. When ModuleTester loads a
package, it looks for this file automatically.
If the file is absent, default values are used for every option.
Complete example#
[general]
docstring_fmt = rst
category = visible
[export]
template_dir = default_templates
test_results_template_name = test_results_template.j2
test_list_template_name = test_list_template.j2
docx_reference = custom-reference.docx
odt_reference = custom-reference.odt
css_style = default_style.css
export_fmts = html, docx
reload_templates_on_export = 0
docstrings_header_shift = 3
toc_depth = 2
[gui]
test_list_visible = 1
test_list_pos = left
test_props_visible = 1
test_props_pos = right
result_tab_visible = 1
result_tab_pos = bottom
result_props_visible = 1
result_props_pos = right
cli_visible = 0
cli_pos = bottom
toolbox_visible = 0
toolbox_pos = bottom
[general] section#
Option |
Type |
Default |
Description |
|---|---|---|---|
|
str |
|
Format used to interpret test docstrings. Supported values: |
|
str |
|
Which test category to load. |
[export] section#
Option |
Type |
Default |
Description |
|---|---|---|---|
|
str |
|
Path to the directory containing Jinja2 templates, CSS, and reference documents. Relative paths are resolved from the package directory. |
|
str |
|
Filename of the Jinja2 template used for test result reports. |
|
str |
|
Filename of the Jinja2 template used for test list documents. |
|
str |
|
Filename of the DOCX reference document used by Pandoc for styling Word exports. |
|
str |
|
Filename of the ODT reference document used by Pandoc for styling LibreOffice exports. |
|
str |
|
Filename of the CSS stylesheet embedded in HTML exports. |
|
list |
|
Comma-separated list of export formats enabled in the GUI export
dialog. Supported values: |
|
bool |
|
When set to |
|
int |
|
Number of heading levels to shift when rendering docstrings inside the exported document (avoids clashing with report headings). |
|
int |
|
Maximum depth of the table of contents generated in HTML exports. |
[gui] section#
Each dockable panel has two options: *_visible (boolean, 0 or 1)
controls whether the panel is shown on startup, and *_pos (string)
controls its initial dock position (left, right, top, or
bottom).
Option |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Show the test list tree view on startup. |
|
str |
|
Dock position of the test list panel. |
|
bool |
|
Show the test properties panel on startup. |
|
str |
|
Dock position of the test properties panel. |
|
bool |
|
Show the execution results panel (Comment/Output/Error tabs) on startup. |
|
str |
|
Dock position of the execution results panel. |
|
bool |
|
Show the result properties panel on startup. |
|
str |
|
Dock position of the result properties panel. |
|
bool |
|
Show the CLI command panel on startup. |
|
str |
|
Dock position of the CLI command panel. |
|
bool |
|
Show the toolbox panel on startup. |
|
str |
|
Dock position of the toolbox panel. |
Error handling#
When loading moduletester.ini, the following errors may occur:
ConfigConflictError: raised when the INI file contains extra keys not recognised by ModuleTester, or is missing expected keys. If you pass
resolve=Trueto the loader, ModuleTester will automatically add missing keys with default values and remove unknown keys.InvalidPathError: raised when a path option (
template_dir,docx_reference,odt_reference,css_style, or template names) points to a file or directory that does not exist.
See FAQ & Troubleshooting for troubleshooting tips.