From c4646e33c6cf06aa15aa65a0861a23f0ecb71c60 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sun, 24 Mar 2024 03:19:32 +0900 Subject: [PATCH] refactor: replace IOError with OSError --- gunicorn/http/errors.py | 6 +++--- tests/test_pidfile.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gunicorn/http/errors.py b/gunicorn/http/errors.py index bcb970072..d13a5b3a5 100644 --- a/gunicorn/http/errors.py +++ b/gunicorn/http/errors.py @@ -13,7 +13,7 @@ class ParseException(Exception): pass -class NoMoreData(IOError): +class NoMoreData(OSError): def __init__(self, buf=None): self.buf = buf @@ -89,7 +89,7 @@ def __str__(self): return "Unsupported transfer coding: %r" % self.hdr -class InvalidChunkSize(IOError): +class InvalidChunkSize(OSError): def __init__(self, data): self.data = data @@ -97,7 +97,7 @@ def __str__(self): return "Invalid chunk size: %r" % self.data -class ChunkMissingTerminator(IOError): +class ChunkMissingTerminator(OSError): def __init__(self, term): self.term = term diff --git a/tests/test_pidfile.py b/tests/test_pidfile.py index 81bb9d206..62a527e32 100644 --- a/tests/test_pidfile.py +++ b/tests/test_pidfile.py @@ -15,7 +15,7 @@ def builtin(name): @mock.patch(builtin('open'), new_callable=mock.mock_open) def test_validate_no_file(_open): pidfile = gunicorn.pidfile.Pidfile('test.pid') - _open.side_effect = IOError(errno.ENOENT) + _open.side_effect = OSError(errno.ENOENT) assert pidfile.validate() is None