-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include a materialized copy of built-in templates #2146
base: main
Are you sure you want to change the base?
Conversation
@denik I tried using |
acceptance/bundle/init/default-python/output/my_default_python/.gitignore
Outdated
Show resolved
Hide resolved
We could easily fix that with by using |
I think it would be useful (could be a follow up) to also run "bundle validate" and "bundle deploy" and other commands on these, so bundle/init is not a great name, because it's not just init. bundle/templates ? |
## Changes Replacement was split between the type `ReplacementContext` and the `ReplaceOutput` function. The latter also ran a couple of regular expressions. This change consolidates them such that it is up to the caller to compose the set of replacements to use. This change is required to accommodate UUID replacement in #2146.
3884a71
to
f45b156
Compare
#2166 makes sure that initialized templates are formatted per ruff. |
t.Logf("Overwriting: %s", pathExpected) | ||
testutil.WriteFile(t, pathExpected, valueNew) | ||
} else { | ||
t.Logf("Removing: %s", pathExpected) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this? It's helpful to update golden test files when files are deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-removal functionality is quite helpful actually. I'd prefer that we keep it.
We can do so by changing readIfExists to return (contents string, exists bool) to distinguish between empty and missing.
t.Errorf("Unexpected output: %s", f) | ||
if strings.HasPrefix(name, "out") { | ||
t.Errorf("Unexpected output: %s", relPath) | ||
if strings.HasPrefix(relPath, "out") { | ||
// We have a new file starting with "out" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe unrelated to this PR: This comment string seems inaccurate. Not sure what this refers to.
continue | ||
} | ||
t.Errorf("Unexpected output: %s", f) | ||
if strings.HasPrefix(name, "out") { | ||
t.Errorf("Unexpected output: %s", relPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the output file/directory is unexpected why are we doing assertions on it? Why have two places in the code where we figure out the expected paths and assert on their content?
Changes
Include a materialized copy of built-in templates as reference output.
This updates the output comparison logic to work against an output directory.