You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding state.get_state and then calling it at the top of each module that needs access to the state is a really bad idea I think? Even though it reduces a lot of state = get_state() calls inside functions, this sort of top-level instantiation of global objects just irks me, and it has proven to be a very painful when testing due to the tests mutating the State object.
I'm having a hard time wrapping my head around the problem completely, but it seems like even when using State as a singleton, the modules that have already instantiated State via get_state() could conceivably have a different version of the State object due to the shenanigans we do when resetting the state in tests. Maybe we should just do state = get_state() where it is required?
This is a really poorly explained issue for now... 4 hours of fixing broken tests due to mutation of global objects has fried my brain.
The text was updated successfully, but these errors were encountered:
Adding
state.get_state
and then calling it at the top of each module that needs access to the state is a really bad idea I think? Even though it reduces a lot ofstate = get_state()
calls inside functions, this sort of top-level instantiation of global objects just irks me, and it has proven to be a very painful when testing due to the tests mutating theState
object.I'm having a hard time wrapping my head around the problem completely, but it seems like even when using
State
as a singleton, the modules that have already instantiatedState
viaget_state()
could conceivably have a different version of theState
object due to the shenanigans we do when resetting the state in tests. Maybe we should just dostate = get_state()
where it is required?This is a really poorly explained issue for now... 4 hours of fixing broken tests due to mutation of global objects has fried my brain.
The text was updated successfully, but these errors were encountered: