fix(pytest): Adding workaround to avoid systemic CI errors #85996
+25
−2
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.
We’ve observed systemic failures in CI, causing the entire test suite to fail due to access being denied. This issue arises from our test fixture, which ensures no file descriptors are leaked between tests. The problem occurs when a file descriptor is found that we are unable to access, triggering a
PermissionError
.The underlying cause stems from the logic used by
psutil
, which performs more checks than necessary. Specifically, it attempts to verify whether the path is a valid file usingos.stat()
, leading to the access issues, as shown in the error below:To mitigate this issue, we’ve simplified the implementation for Linux by using a more direct approach to retrieve open file descriptors via the
/proc
file system, which avoids triggeringos.stat()
and the associated permission error. Since the issue appears to be isolated to CI (which runs on Linux), we’ve limited this fix to Linux.