Skip to content

Commit 254905b

Browse files
committed
fix(packaging): include runnable migration recipes and documentation in source archives
The built source archive omitted files required by its migration tests. Reproduce the missing-file failure through an extracted real archive and run both migration recipes with the installed candidate, then check discovery of the shipped documentation workflows. Closes #111 Closes #112
1 parent 082656e commit 254905b

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

‎pyproject.toml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ artifacts = ["src/ml4t/**/AGENTS.md"]
1818
include = [
1919
"/src",
2020
"/tests",
21+
"/examples",
22+
"/docs",
23+
"/scripts",
24+
"/mkdocs.yml",
2125
"/README.md",
2226
"/LICENSE",
2327
"/CHANGELOG.md",

‎tests/test_release_candidate.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,40 @@ def _installed_check(python: Path, directory: Path, **environment: str):
8888
)
8989

9090

91+
def test_source_archive_migration_recipes_run_with_the_installed_candidate(
92+
candidate_dir: Path, installed_candidate: Path, tmp_path: Path
93+
) -> None:
94+
_, sdist = candidate._distribution_files(candidate_dir)
95+
with tarfile.open(sdist) as archive:
96+
archive.extractall(tmp_path, filter="data")
97+
root = next(tmp_path.iterdir())
98+
for name in ("optional_input_migration.py", "reloaded_workflows.py"):
99+
result = subprocess.run(
100+
[str(installed_candidate), str(root / "examples" / name)],
101+
cwd=root,
102+
capture_output=True,
103+
text=True,
104+
timeout=60,
105+
check=False,
106+
)
107+
assert result.returncode == 0, result.stderr
108+
documentation = subprocess.run(
109+
[
110+
str(installed_candidate),
111+
"-c",
112+
"import runpy; "
113+
"runner = runpy.run_path('tests/documentation_workflows.py'); "
114+
"assert runner['documented_workflows']()",
115+
],
116+
cwd=root,
117+
capture_output=True,
118+
text=True,
119+
timeout=60,
120+
check=False,
121+
)
122+
assert documentation.returncode == 0, documentation.stderr
123+
124+
91125
def test_installed_candidate_rejects_real_source_tree_shadowing(
92126
candidate_dir: Path, installed_candidate: Path
93127
) -> None:

0 commit comments

Comments
 (0)