Skip to content
Merged

fix bug #1173

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change

## [Unreleased]

### Fixed

- Fix bug with packaging core pretext resources that prevented most recent commit from running.

## [2.41.1] - 2026-06-07

Includes updates to core through commit: [fc8221d](https://github.com/PreTeXtBook/pretext/commit/fc8221d5b8e7027f686729102e169c482fbd1fe5)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ authors = [
"Steven Clontz <steven.clontz@gmail.com>",
]
license = "GPL-3.0-or-later"
include = ["pretext/core/pretext.py", "pretext/core/braille_format.py", "pretext/resources/*.zip", "pretext/resources/*.json"]
include = ["pretext/core/*.py", "pretext/resources/*.zip", "pretext/resources/*.json"]

# Dependencies
# ------------
Expand Down
35 changes: 35 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import fnmatch
import os
import sys
import pytest
from pathlib import Path
from pretext import utils
Expand Down Expand Up @@ -117,6 +119,39 @@ def test_is_earlier_version() -> None:
assert not utils.is_earlier_version("2.11.5.dev0", "2.11.5")


def test_core_modules_included_in_package() -> None:
if sys.version_info >= (3, 11):
import tomllib

opener = lambda p: open(p, "rb") # noqa: E731
loader = tomllib.load
else:
import toml

opener = lambda p: open(p, "r") # noqa: E731
loader = toml.load

root = Path(__file__).parent.parent
with opener(root / "pyproject.toml") as f:
config = loader(f)

includes: list[str] = config["tool"]["poetry"]["include"]

core_dir = root / "pretext" / "core"
core_files = [
str(p.relative_to(root))
for p in sorted(core_dir.glob("*.py"))
if p.name != "__init__.py"
]

for rel_path in core_files:
covered = any(fnmatch.fnmatch(rel_path, pat) for pat in includes)
assert covered, (
f"{rel_path} is not covered by any entry in pyproject.toml [tool.poetry] include.\n"
f"Add it explicitly or use a glob like 'pretext/core/*.py'."
)


def test_hash_path(tmp_path: Path) -> None:
# hash_path should return a 10-character hex string.
result = utils.hash_path(tmp_path)
Expand Down
Loading