-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: Improve file limit test to catch SystemExit or RuntimeError #2936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
* Enhance the file limit test to accommodate different exception types. A RedHat user reported a RuntimeError in pypa#2935 * The test now catches `SystemExit` or `RuntimeError` which can be raised by the CLI. Fixes pypa#2935 Signed-off-by: Emre Şafak <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm holding this until upstream confirms why we're getting RuntimeError and not SystemExit.
I've tried this patch with an update from
|
no worries, I'll use a tuple. Let's worry about the exception types. I was able to trigger a
|
We don't need to skip if the soft limit is high; we're going to reduce it anyway. Signed-off-by: Emre Şafak <[email protected]>
for more information, see https://pre-commit.ci
Signed-off-by: Emre Şafak <[email protected]>
* Add exception handling for `resource.setrlimit` to skip tests on implementations that don't support it (e.g., PyPy, GraalPy). * Adjust the number of opened file descriptors to account for JIT implementations which may consume more initially. * Add specific checks for `OSError` with `errno.EMFILE` and the "Too many open files" message for JIT environments. Signed-off-by: Emre Şafak <[email protected]>
for more information, see https://pre-commit.ci
* Add checks for `IS_GRAALPY` and `IS_PYPY` to conditionally adjust file descriptor limits. * Refactor the test to use `pytest.raises` for more robust assertion of `OSError` during file descriptor exhaustion. * Ensure that the `EMFILE` error code and specific error message are checked for JIT environments. Signed-off-by: Emre Şafak <[email protected]>
Otherwise we'll have to repeat the logic since the error does not happen outside of JIT. Signed-off-by: Emre Şafak <[email protected]>
SystemExit
orRuntimeError
.Fixes #2935
tox -e fix
)docs/changelog
folder