Modify test to fix brittle flakiness #242
Closed
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.
One of the tests
test_check_data_file
inside thetest_download.py
module was found to be flaky (specifically, something called brittle flakiness), when using the pytest-flakefinder plugin. A flaky test is a test that both passes and fails despite no changes to the code or the test itself. Brittle flakiness (defined as per iFixFlakies) is when a test runs fine when run in conjunction with the other tests in the same module but fails when run on its own.To reproduce:
pytest fooof/tests/utils/test_download.py::test_check_data_file
All other tests inside
test_download.py
ran fine when run on their own. To fix, I just added a single call tocheck_data_folder
inside thecheck_data_file
function which is called in thetest_check_data_file
test. This downloads the required folder before checking for the file.I'm aware that the tests might not be run on their own, but this makes the entire module more robust so it's just a small fix for you to consider.