Skip to content

Commit f0aa573

Browse files
twsltimvink
authored andcommitted
Update tests
1 parent 4862732 commit f0aa573

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

tests/test_basic.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ def test_fallback(tmp_path) -> None:
328328
reason="Requires mkdocs 1.6 or higher",
329329
)
330330
def 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+
)

tests/test_requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ mkdocs-git-revision-date-localized-plugin
1616
mkdocs-material
1717

1818
# mkapi
19-
mkapi>=3
19+
mkapi!=2.0.*

0 commit comments

Comments
 (0)