Changeset 6b3722d3 in trunk


Ignore:
Timestamp:
2022-02-03T17:50:29Z (3 years ago)
Author:
Itamar Turner-Trauring <itamar@…>
Branches:
master
Children:
c2c3411
Parents:
23c8bde
Message:

Avoid using possibly-private API.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/test/test_istorageserver.py

    r23c8bde r6b3722d3  
    3131from twisted.internet.endpoints import serverFromString
    3232from twisted.web.server import Site
    33 from twisted.web.client import HTTPConnectionPool
     33from twisted.web.client import Agent, HTTPConnectionPool
    3434from hyperlink import DecodedURL
    35 from treq.api import set_global_pool as set_treq_pool
     35from treq.client import HTTPClient
    3636
    3737from foolscap.api import Referenceable, RemoteException
     
    11021102    @inlineCallbacks
    11031103    def _get_istorage_server(self):
    1104         set_treq_pool(HTTPConnectionPool(reactor, persistent=False))
    11051104        swissnum = b"1234"
    1106         self._http_storage_server = HTTPServer(self.server, swissnum)
     1105        http_storage_server = HTTPServer(self.server, swissnum)
    11071106
    11081107        # Listen on randomly assigned port:
     
    11111110        port = int(port)
    11121111        endpoint = serverFromString(reactor, endpoint_string)
    1113         self._listening_port = yield endpoint.listen(
    1114             Site(self._http_storage_server.get_resource())
    1115         )
    1116         self.addCleanup(self._listening_port.stopListening)
     1112        listening_port = yield endpoint.listen(Site(http_storage_server.get_resource()))
     1113        self.addCleanup(listening_port.stopListening)
     1114
     1115        # Create HTTP client with non-persistent connections, so we don't leak
     1116        # state across tests:
     1117        treq_client = HTTPClient(
     1118            Agent(reactor, HTTPConnectionPool(reactor, persistent=False))
     1119        )
     1120
    11171121        returnValue(
    11181122            _HTTPStorageServer.from_http_client(
     
    11201124                    DecodedURL().replace(scheme="http", host=host, port=port),
    11211125                    swissnum,
     1126                    treq=treq_client,
    11221127                )
    11231128            )
Note: See TracChangeset for help on using the changeset viewer.