File: test_site.py

package info (click to toggle)
mkdocs-macros-plugin 1.3.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: python: 1,216; makefile: 4
file content (49 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
"""
Testing the project

(C) Laurent Franceschetti 2024
"""
import pytest

from mkdocs_test.common import h1
from test.fixture import MacrosDocProject






def test_opt_in():
    project = MacrosDocProject('.')
    project.build()
    # did not fail
    assert not project.build_result.returncode
    


    # ---------------------------
    # which pages are rendered?
    # ---------------------------
    # test the config (this is the default anyway)
    macros = project.macros_plugin
    assert macros.render_by_default == True

    h1("Pages")
    print("Pages:", len(project.pages))
    for page in project.pages.values():
        print(page.file.src_uri, page.title)
    print("---")
    # opt-out:
    page = project.get_page('index')
    assert page.meta.render_macros == False
    assert not page.is_markdown_rendered()
    assert "macros_info" in page.markdown


    # Normal:
    page = project.get_page('rendered')
    assert page
    assert "render_macros" not in page.meta
    assert page.is_markdown_rendered()
    assert page.meta.signal in page.markdown