summaryrefslogtreecommitdiffstats
path: root/tests/test_article_scanner.py
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-03 10:07:43 +0200
committerDanilo M. <danix@danix.xyz>2026-05-03 10:07:43 +0200
commit78dea7417fed34ba96efbd8e6d4f1f87c3e998f0 (patch)
tree7958e298e3436b19034b5b262323f6245cd13142 /tests/test_article_scanner.py
parent823703d848e810ee1dbe00d5470c60302a59a422 (diff)
downloadpublisher-78dea7417fed34ba96efbd8e6d4f1f87c3e998f0.tar.gz
publisher-78dea7417fed34ba96efbd8e6d4f1f87c3e998f0.zip
fix: narrow exception clause to ValueError/OSError, add corrupt frontmatter test
Diffstat (limited to 'tests/test_article_scanner.py')
-rw-r--r--tests/test_article_scanner.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_article_scanner.py b/tests/test_article_scanner.py
index 66daf83..db8b683 100644
--- a/tests/test_article_scanner.py
+++ b/tests/test_article_scanner.py
@@ -33,6 +33,14 @@ def test_scan_detects_missing_translation(tmp_path):
assert art.has_translation is False
assert art.translation_path is None
+def test_scan_tolerates_corrupt_frontmatter(tmp_path):
+ p = tmp_path / "content" / "it" / "articles" / "broken"
+ p.mkdir(parents=True)
+ (p / "index.md").write_text("no frontmatter delimiters here\n")
+ articles = scan_articles(tmp_path)
+ art = next(a for a in articles if a.slug == "broken")
+ assert art.frontmatter == {}
+
def test_scan_parses_frontmatter(tmp_path):
_make_article(tmp_path, "it", "con-fm", 'tags = ["linux"]\n')
articles = scan_articles(tmp_path)