-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add regression test for generated package data #432
Conversation
712325c
to
ccfed73
Compare
a285ab3
to
db634fb
Compare
pyproject.toml
Outdated
"tests", | ||
[tool.mypy] | ||
exclude = [ | ||
'tests\/data\/test_package_generation\/src\/cookiecutter_test\/__init__\.py', |
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.
Can someone work out how I can get this to work? mypy doesn't seem to be ignoring the file 😢
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.
So I encountered this problem yesterday (along with @alessandrofelder) python/mypy#17977. It's not ideal, but maybe we just exclude from pre-commit
?
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.
Are we sure we want this? Every time there's a new change, this test will have to be updated.
See #329 for context and motivation. Definitely appreciate that this adds a bit more work when changing anything in the template, but I think it's worth it to catch potential errors such as in #309 which slipped through the PR author and reviewer. I've tried to make the loop here as simple as possible:
|
70617fa
to
6279aff
Compare
Sigh, putting this back as draft until I can fix the test |
698df36
to
882c939
Compare
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.
Fix test data [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Fix toml sorting
c23a657
to
b2ecc8e
Compare
The tests are failing again @dstansby. |
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.
I've fixed this @dstansby. Will approve and merge now so it doesn't need fixing again.
This adds a regression test for generated pacakge data. The test folder now has a data folder inside it which contains a reference copy of the generated package. This is then compared at test time to a newly generated package. Any differences are shown after the failing test with a diff that looks like:
To update the test files with an intentional change, when the test fails the test data is updated with the changes that can then be easily comitted (if desired).
Fixes #329