Last active
February 2, 2016 15:34
-
-
Save jml/114faf900f33abaf973a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from twisted.trial.unittest import SynchronousTestCase | |
from twisted.internet.defer import gatherResults, maybeDeferred | |
class MyTests(SynchronousTestCase): | |
def test_catches_failure(self): | |
d = maybeDeferred(lambda: 1/0) | |
self.failureResultOf(d) | |
def test_gather_results_transparent(self): | |
# Fails with ZeroDivisionError | |
d = gatherResults([maybeDeferred(lambda: 1/0)]) | |
self.failureResultOf(d) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For what it's worth, I'm not surprised at this. In doing my first project that I did with twisted (my submission to the ClusterHQ puzzle) I ran into 3 or 4 little hiccups like this when I tried to use twisted. I think this was actually one of them. I basically had to write my unit tests as if I didn't trust any of the twisted utilities 😢