MCPcopy
hub / github.com/mkdocs/mkdocs / load_config

Function load_config

mkdocs/tests/base.py:26–41  ·  view source on GitHub ↗

Helper to build a simple config for testing.

(config_file_path: str | None = None, **cfg)

Source from the content-addressed store, hash-verified

24
25
26def 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
44def tempdir(files=None, **kw):

Calls 3

load_dictMethod · 0.95
MkDocsConfigClass · 0.90
validateMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…