-
Notifications
You must be signed in to change notification settings - Fork 6
DRY up the test code a bit. #566
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
Conversation
Remove tmp_path fixture from every test, but then need to write a nested function for the fixture. Also add a DEFAULT_CONFIG for the cookiecutter generation.
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.
This looks great to me - even if it doesn't reduce line count significantly, I think the avoidance of having the same setup code across multiple tests makes the tests much more readable. I've added a couple of small suggestions and a question about how we're managing imports from helpers.py
module, but these are all minor and from my perpsective this looks good to merge irrespective!
Co-authored-by: Matt Graham <matthew.m.graham@gmail.com>
for more information, see https://pre-commit.ci
Also add a default_config_with fixture for default plus one change (the main use case in our parametrised tests).
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.
Lines of code is a silly metric. This looks like a good change. Some comments though.
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
for more information, see https://pre-commit.ci
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 like this a lot, it's nice to remove some duplication. One suggestion around using indirect parameterisation
…to be used at once. Co-authored-by: Matt Graham <matthew.m.graham@gmail.com>
Contravenes PT003 but "Explicit is better than implicit." Co-authored-by: Paddy Roddy <patrickjamesroddy@gmail.com>
4816a6f
to
571679c
Compare
In the end, I think I prefer Matt's way. Though the implicit parameterisation does look very useful. |
tmp_path
fixture from every test...default_config
anddefault_config_with
fixtures to help the cookiecutter generation.In the end it doesn't actually reduce the linecount (because I had to add to the docstrings).