-
Notifications
You must be signed in to change notification settings - Fork 393
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 custom env struct to store env at init #1025
Conversation
This allow to no longer ignore some tests (marked previously as FIXME) by storing the env at the start of the program (Or creating a custom env for test purpose) This centralize almost alls calls to std::env inside one wrapper Add a test profile to increase speed for testing (5min -> 20sec on my machine) clean a few code style like this: ``` if Some(value) = ... if value ``` to ``` if Some(true) = ... ```
You may consider this as a big edit without a lot of added value. And you will not be wrong! 😂 |
😂 haha! Wow, the test speed up is incredible, e.g. the slowest test
And the test suite just finished while I was writing this comment! Normally there are 2 or 3 linux tests on a different architecture that straggle on for ages... Are there any reasons we shouldn't be testing with that optimization level? I hope not :) I can't think of any. I guess Rust defaults to the unoptimized to give people faster edit-compile-test cycles when the compilation is a larger proportion of the time. |
The book doesn't say much more than "this settings exist". I don't see any reason ! |
Also the test you mention is slow mainly because of But I don't know how to replace this call. 😅 |
And in addition to the test speed-up, I think your refactoring is absolutely right i.e. that the usage of env vars should be managed in that fashion. Thanks for this work. |
Interesting. If we did want to speed that up even more then it should be possible to cache it across tests I think. |
This allow to no longer ignore some tests (marked previously as FIXME)
by either storing the env at the start of the program or creating a custom env
for test purpose.
This centralize almost all calls to
std::env
inside one wrapperAdd a test profile to increase speed for testing (5min -> 20sec on my
machine)
clean a few nit in code style like this:
to