@@ -328,6 +328,7 @@ def test_fallback(tmp_path) -> None:
328328 reason = "Requires mkdocs 1.6 or higher" ,
329329)
330330def test_mkapi_v3 (tmp_path ) -> None :
331+ """Test mkapi v2.1.0 and higher, basically only v3"""
331332 result = build_docs_setup ("tests/basic_setup/mkdocs_mkapi.yml" , tmp_path )
332333 assert (
333334 result .exit_code == 0
@@ -342,3 +343,34 @@ def test_mkapi_v3(tmp_path) -> None:
342343 '<a href="#" class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false">API</a>' ,
343344 contents ,
344345 )
346+
347+
348+ @pytest .mark .skipif (sys .version_info < (3 , 12 ), reason = "Requires Python 3.12 or higher" )
349+ @pytest .mark .skip ("mkapi v2.0.X requires a currently unsupported Python version" )
350+ def test_mkapi_v20x (tmp_path ) -> None :
351+ assert True
352+
353+
354+ @pytest .mark .skipif (sys .version_info < (3 , 7 ), reason = "Requires Python 3.7 or higher" )
355+ @pytest .mark .skipif (
356+ not (
357+ LooseVersion (mkdocs .__version__ ) < LooseVersion ("2" )
358+ and LooseVersion (mkdocs .__version__ ) >= LooseVersion ("1.1.2" )
359+ ),
360+ reason = "Requires mkdocs >= 1.1.2, < 2" ,
361+ )
362+ def test_mkapi_v1 (tmp_path ) -> None :
363+ result = build_docs_setup ("tests/basic_setup/mkdocs_mkapi.yml" , tmp_path )
364+ assert (
365+ result .exit_code == 0
366+ ), f"'mkdocs build' command failed. Error: { result .stdout } "
367+
368+ index_file = tmp_path / "index.html"
369+ assert index_file .exists (), f"{ index_file } does not exist"
370+
371+ contents = index_file .read_text ()
372+ assert re .search ("<span class='git-page-authors" , contents )
373+ assert re .search (
374+ r'<a href="\$api:src/mkdocs_git_authors_plugin.*" class="nav-link">API</a>' ,
375+ contents ,
376+ )
0 commit comments