Closed hxingpax closed 6 years ago
@hxingpax The lazy_static!
can get poisoned if it panics during initialization. Since test cases are all executed in a single runtime all test cases will observe the same lazy_static!
.
Thanks, I removed that one. Now I go with lazy_static very carefully.
@hxingpax Yeh, there are definitely some pitfalls like this to be careful of with global state like lazy_static
.
If you are hitting a panic somewhere in initialization though one of your tests should have a more descriptive error message that first caused the failure.
Every test case involved with the
lazy_static!
variable are poisioned and failed.How to avoid such a situation.