Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing imports from httpcore #5891

Merged
merged 3 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions cirq-rigetti/cirq_rigetti/service_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# pylint: disable=wrong-or-nonexistent-copyright-notice
from typing import Iterator
from typing import Optional, Iterator
import pytest
import httpx
import httpcore
from httpcore._types import URL, Headers
from cirq_rigetti import get_rigetti_qcs_service, RigettiQCSService


Expand All @@ -20,20 +18,13 @@ def test_rigetti_qcs_service_api_call():
"""test that `RigettiQCSService` will use a custom defined client when the
user specifies one to make an API call."""

class Response(httpcore.SyncByteStream):
def __iter__(self) -> Iterator[bytes]:
class Response(httpx.Response):
def iter_bytes(self, chunk_size: Optional[int] = None) -> Iterator[bytes]:
yield b"{\"quantumProcessors\": [{\"id\": \"Aspen-8\"}]}" # pragma: nocover

class Transport(httpcore.SyncHTTPTransport):
def request(
self,
method: bytes,
url: URL,
headers: Headers = None,
stream: httpcore.SyncByteStream = None,
ext: dict = None,
):
return 200, [('Content-Type', 'application/json')], Response(), {}
class Transport(httpx.BaseTransport):
def handle_request(self, request: httpx.Request) -> httpx.Response:
return Response(200)

client = httpx.Client(base_url="https://mock.api.qcs.rigetti.com", transport=Transport())

Expand Down
2 changes: 1 addition & 1 deletion cirq-rigetti/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyquil>=3.0.0
pyquil>=3.2.0