4545]
4646
4747
48-
49-
5048def build_docs_setup (mkdocs_path , output_path ) -> Result :
5149 runner = CliRunner ()
5250 return runner .invoke (
@@ -144,6 +142,25 @@ def test_ignore_authors_working(tmp_path) -> None:
144142 assert not re .search ("Julien" , contents )
145143
146144
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+
147164def test_exclude_working_with_genfiles (tmp_path ) -> None :
148165 """
149166 A warning for uncommited files should not show up
@@ -331,11 +348,12 @@ def test_mkapi_v20x(tmp_path) -> None:
331348 assert True
332349
333350
334- @pytest .mark .skipif (sys .version_info < (3 , 7 ) or sys .version_info > (3 , 9 ), reason = "Requires Python 3.7 or higher" )
335351@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" )),
339357 reason = "Requires mkdocs >= 1.6" ,
340358)
341359def test_mkapi_v1 (tmp_path ) -> None :
@@ -354,12 +372,12 @@ def test_mkapi_v1(tmp_path) -> None:
354372 contents ,
355373 )
356374
375+
357376def test_custom_docs_dir (tmp_path ):
358377
359378 testproject_path = tmp_path / "testproject"
360379 shutil .copytree ("tests/custom_docs_dir" , testproject_path )
361380
362-
363381 # init git inside the docs directory
364382 with working_directory (str (testproject_path / "documentation" )):
365383 # setup git history
@@ -380,4 +398,3 @@ def test_custom_docs_dir(tmp_path):
380398
381399 contents = index_file .read_text ()
382400 assert re .search ("<span class='git-page-authors" , contents )
383-
0 commit comments