[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Fix DirtyReactorAggregateError in test_proxy_downloadTorExits().



commit 9c33a595c131d439bd943567df794da48e116dab
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Wed Feb 11 00:34:36 2015 +0000

    Fix DirtyReactorAggregateError in test_proxy_downloadTorExits().
    
    See https://travis-ci.org/isislovecruft/bridgedb/jobs/50275771#L2156
---
 lib/bridgedb/test/test_proxy.py |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/lib/bridgedb/test/test_proxy.py b/lib/bridgedb/test/test_proxy.py
index 78e24ff..144cf70 100644
--- a/lib/bridgedb/test/test_proxy.py
+++ b/lib/bridgedb/test/test_proxy.py
@@ -14,6 +14,7 @@
 import sure
 
 from twisted.internet import defer
+from twisted.internet import reactor
 from twisted.trial import unittest
 
 from bridgedb import proxy
@@ -210,12 +211,22 @@ class LoadProxiesFromFileIntegrationTests(unittest.TestCase):
 class DownloadTorExitsTests(unittest.TestCase):
     """Tests for `~bridgedb.proxy.downloadTorExits()`."""
 
+    def setUp(self):
+        self.protocol = MockExitListProtocol
+        self.proxyList = proxy.ProxySet()
+
+    def tearDown(self):
+        """Cleanup method after each ``test_*`` method runs; removes all
+        selectable readers and writers from the reactor.
+        """
+        reactor.removeAll()
+
     def test_proxy_downloadTorExits(self):
-        proxyList = proxy.ProxySet()
-        d = proxy.downloadTorExits(proxyList,
-                                   'OurIPWouldGoHere',
-                                   protocol=MockExitListProtocol)
-        self.assertIsInstance(d, defer.Deferred)
+        def do_test():
+            return proxy.downloadTorExits(self.proxyList,
+                                          'OurIPWouldGoHere',
+                                          protocol=self.protocol)
+        d = do_test()
 
 
 class ProxySetUnittests(unittest.TestCase):



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits