Skip to content

Commit 7cf62f6

Browse files
committed
Improve test error messages
1 parent e156f44 commit 7cf62f6

File tree

3 files changed

+811
-757
lines changed

3 files changed

+811
-757
lines changed

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ license = { text = "MIT" }
1616
description="Mkdocs plugin that enables displaying the localized date of the last git modification of a markdown file."
1717
readme = { file = "README.md", content-type = "text/markdown" }
1818

19-
requires-python=">=3.8"
19+
requires-python=">=3.9"
2020

2121
classifiers=[
2222
"Operating System :: OS Independent",
@@ -36,6 +36,7 @@ dependencies = [
3636
"babel>=2.7.0",
3737
"gitpython>=3.1.44",
3838
"mkdocs>=1.0",
39+
"mkdocs-techdocs-core>=1.6.0",
3940
"pytz>=2025.1",
4041
]
4142

@@ -119,7 +120,7 @@ dev-dependencies = [
119120
"mkdocs-gen-files>=0.5.0",
120121
"mkdocs-git-authors-plugin>=0.9.2",
121122
"mkdocs-material>=9.6.7",
122-
"mkdocs-techdocs-core",
123+
"mkdocs-techdocs-core>=1.0.0",
123124
"mkdocs-monorepo-plugin>=1.1.0",
124125
"mkdocs-static-i18n>=1.3.0",
125126
"pytest>=8.3.5",

tests/test_builds.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def validate_mkdocs_file(temp_path: str, mkdocs_yml_file: str):
320320
testproject_path = setup_clean_mkdocs_folder(mkdocs_yml_path=mkdocs_yml_file, output_path=temp_path)
321321
setup_commit_history(testproject_path)
322322
result = build_docs_setup(testproject_path)
323-
assert result.exit_code == 0, f"'mkdocs build' command failed with output:\n{result.stdout}"
323+
assert result.exit_code == 0, f"'mkdocs build' command failed with output:\n{result.stdout}\nReplicate with 'cd {testproject_path} && uv run mkdocs build'"
324324

325325
# validate build with locale retrieved from mkdocs config file
326326
validate_build(testproject_path, plugin_config=get_plugin_config_from_mkdocs(mkdocs_yml_file))
@@ -376,7 +376,7 @@ def test_tags_are_replaced(tmp_path, mkdocs_file):
376376
testproject_path = setup_clean_mkdocs_folder(mkdocs_yml_path=f"tests/fixtures/{mkdocs_file}", output_path=tmp_path)
377377
setup_commit_history(testproject_path)
378378
result = build_docs_setup(testproject_path)
379-
assert result.exit_code == 0, "'mkdocs build' command failed"
379+
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n{result.stdout}\nReplicate with 'cd {testproject_path} && uv run mkdocs build'"
380380

381381
plugin_config = get_plugin_config_from_mkdocs(str(testproject_path / "mkdocs.yml"))
382382
tags_file = testproject_path / "site/page_with_tag/index.html"
@@ -647,7 +647,7 @@ def test_mkdocs_genfiles_plugin(tmp_path):
647647
)
648648
setup_commit_history(testproject_path)
649649
result = build_docs_setup(testproject_path)
650-
assert result.exit_code == 0, f"'mkdocs build' command failed with {result.stdout}"
650+
assert result.exit_code == 0, f"'mkdocs build' command failed with {result.stdout}\nReplicate with 'cd {testproject_path} && uv run mkdocs build'"
651651

652652
# validate the build
653653
plugin_config = get_plugin_config_from_mkdocs(str(testproject_path / "mkdocs.yml"))
@@ -691,22 +691,22 @@ def test_monorepo_compat(tmp_path):
691691
testproject_path = setup_clean_mkdocs_folder("tests/fixtures/monorepo/mkdocs.yml", tmp_path)
692692
setup_commit_history(testproject_path)
693693
result = build_docs_setup(testproject_path)
694-
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n\n{result.stdout}"
694+
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n\n{result.stdout}\nReplicate with 'cd {testproject_path} && uv run mkdocs build'"
695695

696696
@pytest.mark.skipif(sys.platform.startswith("win"), reason="monorepo plugin did not work for me on windows (even without this plugin)")
697697
def test_monorepo_compat_reverse_order(tmp_path):
698698
testproject_path = setup_clean_mkdocs_folder("tests/fixtures/monorepo/mkdocs_reverse_order.yml", tmp_path)
699699
setup_commit_history(testproject_path)
700700
result = build_docs_setup(testproject_path)
701-
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n\n{result.stdout}"
701+
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n\n{result.stdout}\nReplicate with 'cd {testproject_path} && uv run mkdocs build'"
702702

703703

704704
def test_genfiles_plugin(tmp_path):
705705
testproject_path = setup_clean_mkdocs_folder("tests/fixtures/basic_project/mkdocs_plugin_genfiles.yml", tmp_path)
706706
setup_commit_history(testproject_path)
707707

708708
result = build_docs_setup(testproject_path)
709-
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n\n{result.stdout}"
709+
assert result.exit_code == 0, f"'mkdocs build' command failed with:\n\n{result.stdout}\nReplicate with 'cd {testproject_path} && uv run mkdocs build'"
710710

711711
page_with_tag = testproject_path / "site/foo/index.html"
712712
contents = page_with_tag.read_text(encoding="utf8")

0 commit comments

Comments
 (0)