Merge pull request #1388 from meejah/4115.fix-ci-typechecks

4115: work around MyPy and treq for codechecks CI
This commit is contained in:
meejah 2024-11-18 15:14:26 -07:00 committed by GitHub
commit e27a8300d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 5 deletions

0
newsfragments/4115.minor Normal file
View File

View File

@ -6,7 +6,6 @@ from __future__ import annotations
from typing import (
Union,
Optional,
Sequence,
Mapping,
@ -45,7 +44,6 @@ from zope.interface import implementer
from hyperlink import DecodedURL
import treq
from treq.client import HTTPClient
from treq.testing import StubTreq
from OpenSSL import SSL
from werkzeug.http import parse_content_range_header
@ -434,7 +432,7 @@ class StorageClient(object):
# The URL should be a HTTPS URL ("https://...")
_base_url: DecodedURL
_swissnum: bytes
_treq: Union[treq, StubTreq, HTTPClient]
_treq: HTTPClient
_pool: HTTPConnectionPool
_clock: IReactorTime
# Are we running unit tests?

View File

@ -27,7 +27,8 @@ from queue import Queue
from pycddl import ValidationError as CDDLValidationError
from hypothesis import assume, given, strategies as st, settings as hypothesis_settings
from fixtures import Fixture, TempDir, MonkeyPatch
from treq.testing import StubTreq
from treq.client import HTTPClient
from treq.testing import StubTreq, RequestTraversalAgent
from klein import Klein
from hyperlink import DecodedURL
from collections_extended import RangeMap
@ -714,7 +715,9 @@ class GenericHTTPAPITests(SyncTestCase):
If nothing is given in the ``Authorization`` header at all an
``Unauthorized`` response is returned.
"""
client = StubTreq(self.http.http_server.get_resource())
client = HTTPClient(
RequestTraversalAgent(self.http.http_server.get_resource())
)
response = self.http.result_of_with_flush(
client.request(
"GET",