29
29
from click .testing import CliRunner
30
30
from mkdocs .__main__ import build_command
31
31
32
+
32
33
# Adapted from https://github.com/timvink/mkdocs-table-reader-plugin/blame/master/tests/test_build.py
33
34
def setup_clean_mkdocs_folder (mkdocs_yml_path , output_path ):
34
35
"""
@@ -72,6 +73,7 @@ def setup_clean_mkdocs_folder(mkdocs_yml_path, output_path):
72
73
73
74
return testproject_path
74
75
76
+
75
77
def build_docs_setup (testproject_path ):
76
78
"""
77
79
Runs the `mkdocs build` command
@@ -98,25 +100,28 @@ def build_docs_setup(testproject_path):
98
100
99
101
100
102
def test_given_tags_in_config_then_changes_image_styling (tmp_path ):
101
- tmp_proj = setup_clean_mkdocs_folder (
102
- "./resources/e2e_test_files/test_project/mkdocs.yml" , tmp_path
103
- )
103
+ tmp_proj = setup_clean_mkdocs_folder ("./resources/e2e_test_files/test_project/mkdocs.yml" , tmp_path )
104
104
105
105
build_docs_setup (tmp_proj )
106
106
107
- page_path = tmp_proj / ' site/index.html'
107
+ page_path = tmp_proj / " site/index.html"
108
108
contents = page_path .read_text ()
109
109
assert re .search (r'<img alt="Persian Cat" src="img/Persialainen.jpg" style="height:100px;width:100px" />' , contents )
110
- assert re .search (r'<img alt="Siamese Cat" src="img/Siam_lilacpoint.jpg" style="height:200px;width:200px" />' , contents )
110
+ assert re .search (
111
+ r'<img alt="Siamese Cat" src="img/Siam_lilacpoint.jpg" style="height:200px;width:200px" />' , contents
112
+ )
111
113
assert re .search (r'<img alt="Maine Coon" src="img/Maine_coon.jpg" style="height:100px;width:100px" />' , contents )
112
114
115
+
113
116
def test_given_unknown_tags_in_config_then_no_styling_applied (tmp_path ):
114
117
tmp_proj = setup_clean_mkdocs_folder ("./resources/e2e_test_files/test_project_unknown_tags/mkdocs.yml" , tmp_path )
115
118
116
119
build_docs_setup (tmp_proj )
117
120
118
- page_path = tmp_proj / ' site/index.html'
121
+ page_path = tmp_proj / " site/index.html"
119
122
contents = page_path .read_text ()
120
123
assert re .search (r'<img alt="Persian Cat" src="img/Persialainen.jpg" />' , contents )
121
- assert re .search (r'<img alt="Siamese Cat" src="img/Siam_lilacpoint.jpg" style="height:200px;width:200px" />' , contents )
124
+ assert re .search (
125
+ r'<img alt="Siamese Cat" src="img/Siam_lilacpoint.jpg" style="height:200px;width:200px" />' , contents
126
+ )
122
127
assert re .search (r'<img alt="Maine Coon" src="img/Maine_coon.jpg" />' , contents )
0 commit comments