Helper to build a simple config for testing.
(config_file_path: str | None = None, **cfg)
| 24 | |
| 25 | |
| 26 | def load_config(config_file_path: str | None = None, **cfg) -> MkDocsConfig: |
| 27 | """Helper to build a simple config for testing.""" |
| 28 | path_base = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'integration', 'minimal') |
| 29 | if 'site_name' not in cfg: |
| 30 | cfg['site_name'] = 'Example' |
| 31 | if 'docs_dir' not in cfg: |
| 32 | # Point to an actual dir to avoid a 'does not exist' error on validation. |
| 33 | cfg['docs_dir'] = os.path.join(path_base, 'docs') |
| 34 | if 'plugins' not in cfg: |
| 35 | cfg['plugins'] = [] |
| 36 | conf = MkDocsConfig(config_file_path=config_file_path or os.path.join(path_base, 'mkdocs.yml')) |
| 37 | conf.load_dict(cfg) |
| 38 | |
| 39 | errors_warnings = conf.validate() |
| 40 | assert errors_warnings == ([], []), errors_warnings |
| 41 | return conf |
| 42 | |
| 43 | |
| 44 | def tempdir(files=None, **kw): |
searching dependent graphs…