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.
A test inside test_globals.py was found to be flaky, i.e. test that both pass and fail despite no changes to the code or the tests itself.
Using the pytest-flakefinder plugin, when the tests were re-run more than once, the test
test_debug_default_value
was failing. Upon looking at the code, the reason was because the value of debug was not being reset back to False on a subsequent run. To fix this, I just added and extra call which initially sets the value of debug to False.In general, flaky tests are a pain to fix with regards to locating the root of the actual problem, so it's a good idea to fix them when you detect them. I'm aware that the tests might not be re-run at all, but this change makes the entire module more robust and future-proof so it's just a small fix for you to consider.
To reproduce:
Install pytest-flakefinder by following the instructions here.
At root directory, run
python3 -m pytest --flake-finder
After implementing the fix, all tests pass successfully, both with and without the pytest-flakefinder plugin being used.