42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
"""Shared fixtures and repo paths for font tap tests."""
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
# Repo root: directory containing font_files/ and Formula/
|
|
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
FONT_FILES_DIR = REPO_ROOT / "font_files"
|
|
FORMULA_DIR = REPO_ROOT / "Formula"
|
|
|
|
REQUIRED_SUBDIRS = ("ttf", "otf", "web", "other_files")
|
|
WEB_EXTENSIONS = (".woff", ".woff2", ".eot", ".svg")
|
|
|
|
|
|
def get_font_dir_names():
|
|
"""Return sorted list of font-* directory names in font_files/ (single source of truth)."""
|
|
if not FONT_FILES_DIR.exists():
|
|
return []
|
|
return sorted(
|
|
d.name for d in FONT_FILES_DIR.iterdir() if d.is_dir() and d.name.startswith("font-")
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def repo_root():
|
|
return REPO_ROOT
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def font_dir_names():
|
|
"""All font folder names (font-<name>) from font_files/."""
|
|
names = get_font_dir_names()
|
|
assert names, "No font-* directories found in font_files/"
|
|
return names
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def formula_paths():
|
|
"""All Formula/font-*.rb paths that exist."""
|
|
if not FORMULA_DIR.exists():
|
|
return []
|
|
return sorted(FORMULA_DIR.glob("font-*.rb"))
|