Formulae can't install to ~/Library/Fonts/ due to Homebrew sandboxing. Casks have a built-in `font` artifact that handles this automatically. - Replace Formula/ with Casks/ directory - Rewrite generator to produce cask files instead of formulae - Add .ttc (TrueType Collection) support - Update all tests for cask format - Update CLI and documentation - Fonts with no installable files (TTF/OTF/TTC) are skipped Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
954 B
Python
26 lines
954 B
Python
"""Tests that a Cask file exists for every font with installable files."""
|
|
import pytest
|
|
|
|
from tests.conftest import CASKS_DIR, FONT_FILES_DIR, get_font_dir_names
|
|
|
|
INSTALLABLE_EXTS = (".ttf", ".otf", ".ttc")
|
|
|
|
|
|
def _has_installable_fonts(font_name: str) -> bool:
|
|
font_dir = FONT_FILES_DIR / font_name
|
|
for ext in INSTALLABLE_EXTS:
|
|
pattern = f"*{ext}"
|
|
if any((font_dir / "ttf").glob(pattern)) or any((font_dir / "otf").glob(pattern)):
|
|
return True
|
|
return False
|
|
|
|
|
|
@pytest.mark.parametrize("font_name", get_font_dir_names())
|
|
def test_cask_file_exists(font_name):
|
|
"""Casks/font-<name>.rb exists for each font folder with installable fonts."""
|
|
if not _has_installable_fonts(font_name):
|
|
pytest.skip(f"{font_name} has no installable font files (TTF/OTF/TTC)")
|
|
cask_path = CASKS_DIR / f"{font_name}.rb"
|
|
assert cask_path.is_file(), (
|
|
f"Missing cask for {font_name}: expected {cask_path}"
|
|
)
|