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

#11710 more disttrial amp errors #11711

Merged
merged 5 commits into from
Oct 11, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
formatting
  • Loading branch information
exarkun committed Oct 9, 2022
commit 2a0b4b19fb63b3748fb32fe2c71d507eb401a459
6 changes: 4 additions & 2 deletions src/twisted/trial/_dist/test/test_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
raises,
)
from hypothesis import given
from hypothesis.strategies import integers, just, lists, randoms, text, binary
from hypothesis.strategies import binary, integers, just, lists, randoms, text

from twisted.internet.defer import Deferred, fail
from twisted.internet.interfaces import IProtocol
Expand Down Expand Up @@ -202,5 +202,7 @@ def test_stream(self, chunks: List[bytes]) -> None:
"""
sender = AMP()
streams = StreamReceiver()
streamId = interact(AMPStreamReceiver(streams), sender, stream(sender, iter(chunks)))
streamId = interact(
AMPStreamReceiver(streams), sender, stream(sender, iter(chunks))
)
assert_that(streams.finish(streamId), is_(equal_to(chunks)))
8 changes: 6 additions & 2 deletions src/twisted/trial/_dist/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ def addError(
@param error: A message describing the error.
"""
error = b"".join(self._streams.finish(errorStreamId)).decode("utf-8")
frames = [frame.decode("utf-8") for frame in self._streams.finish(framesStreamId)]
frames = [
frame.decode("utf-8") for frame in self._streams.finish(framesStreamId)
]
# Wrap the error message in ``WorkerException`` because it is not
# possible to transfer arbitrary exception values over the AMP
# connection to the main process but we must give *some* Exception
Expand Down Expand Up @@ -238,7 +240,9 @@ def addFailure(
peer.
"""
fail = b"".join(self._streams.finish(failStreamId)).decode("utf-8")
frames = [frame.decode("utf-8") for frame in self._streams.finish(framesStreamId)]
frames = [
frame.decode("utf-8") for frame in self._streams.finish(framesStreamId)
]
# See addError for info about use of WorkerException here.
failure = self._buildFailure(WorkerException(fail), failClass, frames)
self._result.addFailure(self._testCase, failure)
Expand Down