Skip to content

Commit 25801bb

Browse files
committed
fix tests
1 parent 55ba1f8 commit 25801bb

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/isolate/server/server.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from functools import partial
1313
from queue import Empty as QueueEmpty
1414
from queue import Queue
15-
from typing import Any, Callable, Dict, Iterator, List, Tuple, cast
15+
from typing import Any, Callable, Iterator, cast
1616
from urllib.request import Request, urlopen
1717

1818
import grpc
@@ -385,8 +385,7 @@ def Run(
385385
context: ServicerContext,
386386
) -> Iterator[definitions.PartialRunResult]:
387387
try:
388-
for message in self.run_function(request):
389-
yield message
388+
yield from self.run_function(request)
390389
except GRPCException as exc:
391390
return self.abort_with_msg(
392391
f"{exc}",

tests/test_server.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -684,8 +684,8 @@ def test_server_proper_error_delegation(
684684

685685
assert exc_info.value.code() == grpc.StatusCode.INVALID_ARGUMENT
686686
assert (
687-
exc_info.value.details()
688-
== "Error while serializing the execution result (object of type <class 'frame'>)."
687+
"Error while serializing the execution result (object of type <class 'frame'>)."
688+
in exc_info.value.details()
689689
)
690690
assert not user_logs
691691

@@ -695,8 +695,8 @@ def test_server_proper_error_delegation(
695695

696696
assert exc_info.value.code() == grpc.StatusCode.INVALID_ARGUMENT
697697
assert (
698-
exc_info.value.details()
699-
== "Error while serializing the execution result (object of type <class 'Exception'>)."
698+
"Error while serializing the execution result (object of type <class 'Exception'>)."
699+
in exc_info.value.details()
700700
)
701701
assert "relevant information" in "\n".join(log.message for log in user_logs)
702702

@@ -712,12 +712,12 @@ def test_server_submit(
712712
function=prepare_request(imitate_server),
713713
callback=http_server.host,
714714
)
715-
response = stub.Submit(request)
715+
stub.Submit(request)
716716

717-
partial_results: list[definitions.PartialRunResult] = []
717+
partial_results: List[definitions.PartialRunResult] = []
718718
while not any(pr.is_complete for pr in partial_results):
719719
try:
720-
message = http_server.messages.get(timeout=10)
720+
message = http_server.messages.get(timeout=120)
721721
except queue.Empty:
722722
raise ValueError("No message received from the server within 5 seconds")
723723

0 commit comments

Comments
 (0)