Skip to content

Commit a9ea640

Browse files
committed
test(docs[sphinx_fonts]): add tests for sphinx_fonts extension
why: codecov drops because docs/_ext/sphinx_fonts.py is measured for coverage but has zero tests across all repos. what: - Add test_sphinx_fonts.py with 21 tests covering all functions - Add test infrastructure (conftest, __init__) for docs/_ext tests - Test pure functions, I/O with monkeypatch, Sphinx events with SimpleNamespace - Cover all branches: cached/success/URLError/OSError, html/non-html, empty/with fonts
1 parent e4ec3b5 commit a9ea640

5 files changed

Lines changed: 537 additions & 0 deletions

File tree

docs/_ext/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Pytest configuration for docs/_ext doctests."""
2+
3+
from __future__ import annotations
4+
5+
import pathlib
6+
import sys
7+
8+
_ext_dir = pathlib.Path(__file__).parent
9+
if str(_ext_dir) not in sys.path:
10+
sys.path.insert(0, str(_ext_dir))

tests/docs/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Tests for documentation extensions."""
2+
3+
from __future__ import annotations

tests/docs/_ext/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Tests for docs/_ext Sphinx extensions."""
2+
3+
from __future__ import annotations

tests/docs/_ext/conftest.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
"""Fixtures and configuration for docs extension tests."""
2+
3+
from __future__ import annotations
4+
5+
import pathlib
6+
import sys
7+
8+
docs_ext_path = pathlib.Path(__file__).parent.parent.parent.parent / "docs" / "_ext"
9+
if str(docs_ext_path) not in sys.path:
10+
sys.path.insert(0, str(docs_ext_path))

0 commit comments

Comments
 (0)