Fix heisentest by ignoring the basepath #11993
Merged
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.
Problem:
The issue #10988 suspects that there's a dependency on side-effects from other tests.
However, the test itself seems pretty hermetic, creating a new randomly-named temp directory every time.
My guess is that there is a case where the randomly-generated name contains one of the ignored tokens.
For example, probability of a random 8-character name containing
"not"
is roughly6 / 37^3
~ 0.01%.In this case, all files will be wrongfully ignored because we use the absolute path to perform the pattern matching.
Solution:
Use the relative path to perform the pattern matching. Also, look for the first match only (no need for
re.findall()
).Validation:
The modified test intentionally includes ignored token
"not"
in the name of the base path. With this modification, the test fails 100% of the time, unless the suggested fix infind_path_from_directory()
is applied.Closes: #10988