Coverage for tests/test_plugin.py: 100.00%

7 statements  

« prev     ^ index     » next       coverage.py v7.2.7, created at 2023-06-05 09:22 -0400

1"""Tests for the plugin module.""" 

2 

3import re 

4from pathlib import Path 

5 

6from mkdocs.commands.build import build 

7from mkdocs.config.base import load_config 

8 

9 

10def test_plugin() -> None: 

11 """Build our own documentation.""" 

12 assert 1 == 1 

13 return 

14 config = load_config() 

15 config["plugins"]["pytest"].config["html_report_dir"] = Path(__file__).parent / "data/htmltest" 

16 config["plugins"].run_event("startup", command="build", dirty=False) 

17 try: 

18 build(config) 

19 finally: 

20 config["plugins"].run_event("shutdown") 

21 site_test_dir = Path(config["site_dir"]) / "pytest" 

22 for html_file in site_test_dir.iterdir(): 

23 if html_file.suffix == ".html" and html_file.name != "index.html" and "tests" not in html_file.name: 

24 text = html_file.read_text() 

25 assert not re.search("pytestpytestindex", text) 

26 assert not re.search('href="index.html"', text)