mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-02 18:51:31 +08:00
fix: resolve ruff lint warnings in HTTP/2 code
- Remove unused imports in test files - Rename loop variable to avoid shadowing sock import - Remove unused ssock variable in conftest
This commit is contained in:
parent
17b3786186
commit
df5d7ad6d2
@ -216,12 +216,12 @@ class ThreadWorker(base.Worker):
|
|||||||
if enabled == self._accepting:
|
if enabled == self._accepting:
|
||||||
return
|
return
|
||||||
|
|
||||||
for sock in self.sockets:
|
for listener in self.sockets:
|
||||||
if enabled:
|
if enabled:
|
||||||
sock.setblocking(False)
|
listener.setblocking(False)
|
||||||
self.poller.register(sock, selectors.EVENT_READ, self.accept)
|
self.poller.register(listener, selectors.EVENT_READ, self.accept)
|
||||||
else:
|
else:
|
||||||
self.poller.unregister(sock)
|
self.poller.unregister(listener)
|
||||||
|
|
||||||
self._accepting = enabled
|
self._accepting = enabled
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
"""Pytest fixtures for HTTP/2 Docker integration tests."""
|
"""Pytest fixtures for HTTP/2 Docker integration tests."""
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -62,7 +60,7 @@ def wait_for_service(url: str, timeout: int = 60) -> bool:
|
|||||||
ctx.verify_mode = ssl.CERT_NONE
|
ctx.verify_mode = ssl.CERT_NONE
|
||||||
|
|
||||||
with socket.create_connection((host, port), timeout=5) as sock:
|
with socket.create_connection((host, port), timeout=5) as sock:
|
||||||
with ctx.wrap_socket(sock, server_hostname=host) as ssock:
|
with ctx.wrap_socket(sock, server_hostname=host):
|
||||||
return True
|
return True
|
||||||
except (socket.error, ssl.SSLError, OSError):
|
except (socket.error, ssl.SSLError, OSError):
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import pytest
|
|||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from gunicorn import sock
|
from gunicorn import sock
|
||||||
from gunicorn.config import Config
|
|
||||||
|
|
||||||
|
|
||||||
def create_mock_ssl_socket(alpn_protocol=None):
|
def create_mock_ssl_socket(alpn_protocol=None):
|
||||||
|
|||||||
@ -20,7 +20,7 @@ except ImportError:
|
|||||||
H2_AVAILABLE = False
|
H2_AVAILABLE = False
|
||||||
|
|
||||||
from gunicorn.http2.errors import (
|
from gunicorn.http2.errors import (
|
||||||
HTTP2Error, HTTP2ProtocolError, HTTP2ConnectionError
|
HTTP2Error, HTTP2ConnectionError
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ except ImportError:
|
|||||||
H2_AVAILABLE = False
|
H2_AVAILABLE = False
|
||||||
|
|
||||||
from gunicorn.http2.errors import (
|
from gunicorn.http2.errors import (
|
||||||
HTTP2Error, HTTP2ProtocolError, HTTP2ConnectionError, HTTP2NotAvailable
|
HTTP2Error, HTTP2ConnectionError
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
"""Tests for HTTP/2 request and body classes."""
|
"""Tests for HTTP/2 request and body classes."""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
from gunicorn.http2.request import HTTP2Request, HTTP2Body
|
from gunicorn.http2.request import HTTP2Request, HTTP2Body
|
||||||
from gunicorn.http2.stream import HTTP2Stream
|
from gunicorn.http2.stream import HTTP2Stream
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
"""Tests for HTTP/2 stream state management."""
|
"""Tests for HTTP/2 stream state management."""
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
from gunicorn.http2.stream import HTTP2Stream, StreamState
|
from gunicorn.http2.stream import HTTP2Stream, StreamState
|
||||||
from gunicorn.http2.errors import HTTP2StreamError
|
from gunicorn.http2.errors import HTTP2StreamError
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user