Support for Python 3.12 (#1444)
* Support for Python 3.12 * Use `assert_called_once_with` and not `called_once_with` * lint fix * Fix `test_pac_file_served_from_disk` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
201d02ce72
commit
1e4e87d515
|
@ -446,8 +446,9 @@ jobs:
|
|||
# NOTE: The latest and the lowest supported Pythons are prioritized
|
||||
# NOTE: to improve the responsiveness. It's nice to see the most
|
||||
# NOTE: important results first.
|
||||
- '3.11'
|
||||
- '3.12'
|
||||
- 3.6
|
||||
- '3.11'
|
||||
- '3.10'
|
||||
- 3.9
|
||||
- 3.8
|
||||
|
|
|
@ -292,9 +292,7 @@ class HttpProtocolHandler(BaseTcpServerHandler[HttpClientConnection]):
|
|||
return True
|
||||
# Discover which HTTP handler plugin is capable of
|
||||
# handling the current incoming request
|
||||
klass = self._discover_plugin_klass(
|
||||
self.request.http_handler_protocol,
|
||||
)
|
||||
klass = self._discover_plugin_klass(self.request.http_handler_protocol)
|
||||
if klass is None:
|
||||
# No matching protocol class found.
|
||||
# Return bad request response and
|
||||
|
|
|
@ -59,19 +59,6 @@ def test_on_client_connection_called_on_teardown(mocker: MockerFixture) -> None:
|
|||
assert _conn.closed
|
||||
|
||||
|
||||
def mock_selector_for_client_read(self: Any) -> None:
|
||||
self.mock_selector.return_value.select.return_value = [
|
||||
(
|
||||
selectors.SelectorKey(
|
||||
fileobj=self._conn.fileno(),
|
||||
fd=self._conn.fileno(),
|
||||
events=selectors.EVENT_READ,
|
||||
data=None,
|
||||
),
|
||||
selectors.EVENT_READ,
|
||||
),
|
||||
]
|
||||
|
||||
# @mock.patch('socket.fromfd')
|
||||
# def test_on_client_connection_called_on_teardown(
|
||||
# self, mock_fromfd: mock.Mock,
|
||||
|
@ -171,16 +158,40 @@ class TestWebServerPluginWithPacFilePlugin(Assertions):
|
|||
b'GET / HTTP/1.1',
|
||||
CRLF,
|
||||
])
|
||||
mock_selector_for_client_read(self)
|
||||
self.mock_selector.return_value.select.side_effect = [
|
||||
[
|
||||
(
|
||||
selectors.SelectorKey(
|
||||
fileobj=self._conn.fileno(),
|
||||
fd=self._conn.fileno(),
|
||||
events=selectors.EVENT_READ,
|
||||
data=None,
|
||||
),
|
||||
selectors.EVENT_READ,
|
||||
),
|
||||
],
|
||||
[
|
||||
(
|
||||
selectors.SelectorKey(
|
||||
fileobj=self._conn.fileno(),
|
||||
fd=self._conn.fileno(),
|
||||
events=selectors.EVENT_WRITE,
|
||||
data=None,
|
||||
),
|
||||
selectors.EVENT_WRITE,
|
||||
),
|
||||
],
|
||||
]
|
||||
|
||||
@pytest.mark.asyncio # type: ignore[misc]
|
||||
async def test_pac_file_served_from_disk(self) -> None:
|
||||
await self.protocol_handler._run_once()
|
||||
await self.protocol_handler._run_once()
|
||||
self.assertEqual(
|
||||
self.protocol_handler.request.state,
|
||||
httpParserStates.COMPLETE,
|
||||
)
|
||||
self._conn.send.called_once_with(
|
||||
self._conn.send.assert_called_once_with(
|
||||
build_http_response(
|
||||
200,
|
||||
reason=b'OK',
|
||||
|
|
Loading…
Reference in New Issue