-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
Cache env config #3268
Cache env config #3268
Conversation
This commit adds a new cache to the main config object, specifically for env config. When env config is retrieved via Config.get_env(), it is not in general possible to determine whether the env is a packaging environment or not. Because retrieving standard section config needs to know which "base" section to inherit from, and this is different for test envs and packaging envs, we require a separate way to retrieve previously created env config. At creation time we do reliably know whether this is a packaging or run env, and we want that to persist (if it changes, we call clear_env() and recreate it with the new type).
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.
Looks alright, you'd want to create your example in a config and check that tox -c expands correctly.
Ok, interestingly, This means that we will have to make a proper run to test this (AFAICT). I am continuing to work on this (in limited spare time) but it has become more complicated than it first appeared (why are the tests always harder than the fix itself), and may take a bit longer to get to a solution. |
That's expected 😊 writing code is fairly easy compared to maintaining it. |
Seems stalled, we can reopen when you pick it up. |
FTR, I was also observing that |
This commit adds a new cache to the main config object, specifically for env config. When env config is retrieved via Config.get_env(), it is not in general possible to determine whether the env is a packaging environment or not. Because retrieving standard section config needs to know which "base" section to inherit from, and this is different for test envs and packaging envs, we require a separate way to retrieve previously created env config. At creation time we do reliably know whether this is a packaging or run env, and we want that to persist (if it changes, we call clear_env() and recreate it with the new type).
At the moment, there are no tests for this change, I would appreciate a) approval of this approach to fixing the problem and b) some guidance about where to put a test (or possibly just add some additional checks to an existing test, to demonstrate e.g. that
{envtmpdir}
is being expanded). I have verified that my project that got me interested in this issue now builds correctly with this fix.I don't think any change to the documentation is required for this. I will add a changelog entry along with the tests.
Fixes #3238.
tox -e fix
)docs/changelog
folder