File: test_hooks.py

package info (click to toggle)
mkdocs-static-i18n 1.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,412 kB
  • sloc: python: 3,131; xml: 45; makefile: 21; sh: 17
file content (41 lines) | stat: -rw-r--r-- 1,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from mkdocs.commands.build import build
from mkdocs.config.base import load_config


def test_hooks_working():
    mkdocs_config = load_config(
        "tests/mkdocs.yml",
        theme={"name": "mkdocs"},
        use_directory_urls=True,
        docs_dir="docs_suffix_structure_two_languages/",
        plugins={
            "i18n": {
                "languages": [
                    {"locale": "en", "name": "english", "default": True},
                    {"locale": "fr", "name": "français"},
                ],
            },
        },
        hooks=["hooks.py"],
    )
    build(mkdocs_config)


def test_hooks_env_modified():
    mkdocs_config = load_config(
        "tests/mkdocs.yml",
        theme={"name": "mkdocs", "custom_dir": "theme_overrides"},
        use_directory_urls=True,
        docs_dir="docs_suffix_structure_two_languages/",
        plugins={
            "i18n": {
                "languages": [
                    {"locale": "en", "name": "english", "default": True},
                    {"locale": "fr", "name": "français"},
                ],
            },
        },
        hooks=["hooks_jinja_on_env.py"],
        site_dir="/tmp/xoxo/",
    )
    build(mkdocs_config)