45
45
]
46
46
47
47
48
-
49
-
50
48
def build_docs_setup (mkdocs_path , output_path ) -> Result :
51
49
runner = CliRunner ()
52
50
return runner .invoke (
@@ -144,6 +142,25 @@ def test_ignore_authors_working(tmp_path) -> None:
144
142
assert not re .search ("Julien" , contents )
145
143
146
144
145
+ def test_co_authors_working (tmp_path ) -> None :
146
+ result = build_docs_setup ("tests/basic_setup/mkdocs_ignore_authors.yml" , tmp_path )
147
+ assert (
148
+ result .exit_code == 0
149
+ ), f"'mkdocs build' command failed. Error: { result .stdout } "
150
+
151
+ page_file = tmp_path / "page_with_co_authors/index.html"
152
+ assert page_file .exists (), f"{ page_file } does not exist"
153
+
154
+ contents = page_file .read_text ()
155
+ assert re .search ("<span class='git-page-authors" , contents )
156
+ assert re .search (
157
+ "<a href='mailto:12074690\[email protected] '>Fabien Pozzobon</a>" ,
158
+ contents ,
159
+ )
160
+ assert re .
search (
"<a href='mailto:[email protected] '>John Doe</a>" ,
contents )
161
+ assert not re .search ("Julien" , contents )
162
+
163
+
147
164
def test_exclude_working_with_genfiles (tmp_path ) -> None :
148
165
"""
149
166
A warning for uncommited files should not show up
@@ -331,11 +348,12 @@ def test_mkapi_v20x(tmp_path) -> None:
331
348
assert True
332
349
333
350
334
- @pytest .mark .skipif (sys .version_info < (3 , 7 ) or sys .version_info > (3 , 9 ), reason = "Requires Python 3.7 or higher" )
335
351
@pytest .mark .skipif (
336
- not (
337
- Version (mkdocs .__version__ ) < Version ("1.6" )
338
- ),
352
+ sys .version_info < (3 , 7 ) or sys .version_info > (3 , 9 ),
353
+ reason = "Requires Python 3.7 or higher" ,
354
+ )
355
+ @pytest .mark .skipif (
356
+ not (Version (mkdocs .__version__ ) < Version ("1.6" )),
339
357
reason = "Requires mkdocs >= 1.6" ,
340
358
)
341
359
def test_mkapi_v1 (tmp_path ) -> None :
@@ -354,12 +372,12 @@ def test_mkapi_v1(tmp_path) -> None:
354
372
contents ,
355
373
)
356
374
375
+
357
376
def test_custom_docs_dir (tmp_path ):
358
377
359
378
testproject_path = tmp_path / "testproject"
360
379
shutil .copytree ("tests/custom_docs_dir" , testproject_path )
361
380
362
-
363
381
# init git inside the docs directory
364
382
with working_directory (str (testproject_path / "documentation" )):
365
383
# setup git history
@@ -380,4 +398,3 @@ def test_custom_docs_dir(tmp_path):
380
398
381
399
contents = index_file .read_text ()
382
400
assert re .search ("<span class='git-page-authors" , contents )
383
-
0 commit comments