[tor-commits] [ooni-probe/master] Take an instance rather than class

art at torproject.org art at torproject.org
Tue Oct 29 15:52:16 UTC 2013


commit 4aad9aae0d56b57277c8dca4b1781f32899bebd0
Author: aagbsn <aagbsn at extc.org>
Date:   Wed Sep 18 16:21:11 2013 +0200

    Take an instance rather than class
    
    Measurements should be able to take an instanced class so that the
    resulting report can be shared between several Measurements.
---
 ooni/tasks.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ooni/tasks.py b/ooni/tasks.py
index baefb51..52e9164 100644
--- a/ooni/tasks.py
+++ b/ooni/tasks.py
@@ -106,9 +106,10 @@ class Measurement(TaskWithTimeout):
         net_test:
             a reference to the net_test object such measurement belongs to.
         """
-        self.testInstance = test_class()
+        self.testInstance = test_class
         self.testInstance.input = test_input
-        self.testInstance.report = {'input': test_input}
+        if not self.testInstance.report:
+            self.testInstance.report = {'input': test_input}
         self.testInstance._start_time = time.time()
         self.testInstance._setUp()
         self.testInstance.setUp()





More information about the tor-commits mailing list