Repository navigation
fix(template): stop shipping a stray example test and a broken newline - #183
Merged
Merged
Conversation
Two defects in the example-notebook test, both surfaced by the v0.27.0 fleet fan-out and both living in the two near-duplicate .jinja sources that rendered to tests/test_examples.py. The filename-gated source and an ungated twin both rendered the file; with include_examples=false the ungated one left a stray 1-byte tests/test_examples.py that broke nothing and so hid for releases. Delete it and keep only the filename-gated source, which correctly produces no file when examples are off. The assert-failure f-string used a doubled backslash, so the diagnostic printed a literal \n instead of breaking lines. Use a single backslash. Tests now assert no test_examples.py exists when examples are disabled, and that the failure message keeps a real newline escape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two defects in the example-notebook test, both surfaced by the v0.27.0 fleet fan-out and both fixes bundled here for a v0.27.1 patch. They live in the two near-duplicate
.jinjasources that render totests/test_examples.py.Type of Change
Motivation and Context
Stray 1-byte test file.
template/tests/shipped two near-duplicate sources for the example test — one filename-gated ({% if include_examples %}test_examples.py{% endif %}.jinja) and one ungated (test_examples.py.jinja). Both render totests/test_examples.pywhen examples are on (one silently overwrites the other), and withinclude_examples=falsethe ungated twin renders a stray 1-bytetests/test_examples.py. It broke nothing — an empty file collects no tests — which is exactly why it hid for releases. Fix: delete the ungated source; the filename-gated one correctly produces no file when examples are off (verified).Literal
\nin the failure message. The assert-failure f-string used a doubled backslash (failed with:\\nSTDOUT:), so a notebook-failure diagnostic printed a literal\nas text instead of breaking lines. Fix: single backslash. Proven: the rendered message now spans 5 lines (4 real newlines) instead of 1.Both were found during the fan-out — the second by sklearn-wrap's update agent, which had carried the correct
\nsince its initial commit and would otherwise have silently re-rejected the template's regression on every future update.How Has This Been Tested?
uv run pytest— 324 passedcopier copy . /tmp/test-project— bothinclude_examplesvaluesVerified, not assumed:
include_examples=false→ notests/test_examples.pyat all (was: stray 1-byte file).include_examples=true→ the test renders with a real newline escape; evaluating the f-string yields a 5-line message.Falseon the old doubled-backslash content andTrueon the fixed content, so it genuinely bites.Checklist
Additional Notes
Fleet impact is benign. No generated repo receives a regression from this: repos that already carry the doubled-backslash form are unchanged, and sklearn-wrap already carries the correct
\n(its fan-out agent preserved it). After this ships, sklearn-wrap's local delta disappears on its next update. The stray-file fix only affects the twoinclude_examples=falserepos (kedro-dagster, kedro-azureml-pipeline), neither of which currently carries the stray file.Out of scope, flagged for later: sklearn-wrap's fan-out also noted that
nox -s lintand thejustfile lint:recipe runty check srcwithout--extra <name>, so a project needing an optional extra fortymust add it in more than one place. That's a template-consistency question, not a clear bug, and is left for a separate change.🤖 Generated with Claude Code