[tor-commits] [ooni-probe/master] Move input checking out of checkOptions

art at torproject.org art at torproject.org
Tue Aug 27 09:21:51 UTC 2013


commit 0debe3d2ee452db4f86bd4b2f252cb90feeaa3bd
Author: aagbsn <aagbsn at extc.org>
Date:   Fri Jun 28 00:57:21 2013 +0200

    Move input checking out of checkOptions
    
    Relocates input checking as late as possible so that inputs
    to NetTest can be downloaded after instancing a NetTestLoader.
---
 ooni/nettest.py |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index 10eacd3..92c9864 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -360,11 +360,6 @@ class NetTestLoader(object):
             test_instance._checkRequiredOptions()
             test_instance._checkValidOptions()
 
-            inputs = test_instance.getInputProcessor()
-            if not inputs:
-                inputs = [None]
-            klass.inputs = inputs
-
     def _get_test_methods(self, item):
         """
         Look for test_ methods in subclasses of NetTestCase
@@ -501,7 +496,14 @@ class NetTest(object):
         This is a generator that yields measurements and registers the
         callbacks for when a measurement is successful or has failed.
         """
+
         for test_class, test_methods in self.testCases:
+            # load the input processor as late as possible
+            inputs = test_class().getInputProcessor()
+            if not inputs:
+                inputs = [None]
+            test_class.inputs = inputs
+
             for input in test_class.inputs:
                 for method in test_methods:
                     log.debug("Running %s %s" % (test_class, method))





More information about the tor-commits mailing list