Update per-test config to be unique per-test in spec_configured_state_test#2765
Merged
hwwhww merged 4 commits intoethereum:ex-ante-testsfrom Dec 7, 2021
ralexstokes:fix-spec-config-concurrency-issue
Merged
Update per-test config to be unique per-test in spec_configured_state_test#2765hwwhww merged 4 commits intoethereum:ex-ante-testsfrom ralexstokes:fix-spec-config-concurrency-issue
spec_configured_state_test#2765hwwhww merged 4 commits intoethereum:ex-ante-testsfrom
ralexstokes:fix-spec-config-concurrency-issue
Conversation
Member
Author
|
update: the |
Member
Author
Member
Author
|
there is some strange failure w/ a test ( but ignoring that for now, i'd suggest we do something like this PR instead of #2755 to fix #2752 (and anything else that uses that decorator) as it provides a distinct, scoped instance of the |
hwwhww
approved these changes
Dec 7, 2021
Contributor
There was a problem hiding this comment.
Big thanks to @ralexstokes ✨
Compared to #2755, it gets rid of the needless imports largely. Well done!
This was referenced Dec 7, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alternative fix for the issue addressed in #2755.
As I understand it, the issue there was that using the
spec_configured_state_testdecorator was not "thread-safe" so that any unsynchronized access could cause issues. These issues were seen in #2752 when executing the tests withpytest-xdistwhich parallelizes tests across multiple cores.@hwwhww found the issue and suggested a fix w/ lazy loading of the modules in the pyspec.
Rather than go around making multiple copies of various modules, this PR takes a different approach to tests using the
spec_configured_state_testdecorator: simply make a separate copy of theSpecobject.As long as instances of
Specdon't get too big or resource-intensive then we should be able to easily specialize a givenSpecfor each test that uses this decorator by simply making a copy and making the necessary edits.As far as I can tell, there is no reason to "restore" the spec after mutation as it is discarded after the result from the decorated test is obtained.