[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Refactor test tester
commit 3e85b9e1e589c08889c4607b9597775a6144e465
Author: Arturo Filastò <art@xxxxxxxxxx>
Date: Fri Jun 15 23:30:39 2012 +0200
Refactor test tester
---
tests/test_tests.py | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/tests/test_tests.py b/tests/test_tests.py
index 702e6a3..bed5922 100644
--- a/tests/test_tests.py
+++ b/tests/test_tests.py
@@ -1,3 +1,4 @@
+from twisted.internet import defer
from twisted.trial import unittest
from ooni.plugoo import work, tests
@@ -12,11 +13,15 @@ class TestsTestCase(unittest.TestCase):
self.errbackResults = None
def _callback(self, *args, **kw):
+ print "BBB"
+ print args, kw
+ print "CCCC"
self.callbackResults = args, kw
def _errback(self, *args, **kw):
pass
+ @defer.inlineCallbacks
def test_fallThrough(self):
"""
This tests to make sure that what is returned from the experiment
@@ -24,10 +29,16 @@ class TestsTestCase(unittest.TestCase):
"""
test_dict = {"hello": "world"}
class DummyTest(tests.OONITest):
+ blocking = False
def experiment(self, args):
- return test_dict
+ def cb(aaa):
+ return test_dict
+ d = defer.Deferred()
+ d.addCallback(cb)
+ d.callback(None)
+ return d
test = DummyTest(None, None, self.dummyreport)
- test.startTest(None).addCallback(self._callback)
- self.assertEqual(self.callbackResults[0][0]['result'], test_dict)
+ yield test.startTest(None).addCallback(self._callback)
+ self.assertEqual(self.callbackResults[0][0]['control'], test_dict)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits