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

[tor-commits] [ooni-probe/master] Fix a bug where test options were not included in the report



commit 2f5a4c1bb17f881ebfca63e003f116a22eaf0a03
Author: aagbsn <aagbsn@xxxxxxxx>
Date:   Tue Feb 26 22:24:49 2013 +0100

    Fix a bug where test options were not included in the report
---
 ooni/nettest.py |   11 ++++++-----
 ooni/oonicli.py |    8 ++------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/ooni/nettest.py b/ooni/nettest.py
index a29b2f0..6273d34 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -21,9 +21,9 @@ class NoTestCasesFound(Exception):
 class NetTestLoader(object):
     method_prefix = 'test'
 
-    def __init__(self, net_test_file, net_test_args):
-        self.netTestArgs = net_test_args
-        self.testCases = self.loadNetTest(net_test_file)
+    def __init__(self, options):
+        self.options = options
+        self.testCases = self.loadNetTest(options['test'])
 
     @property
     def testDetails(self):
@@ -69,7 +69,8 @@ class NetTestLoader(object):
             'test_name': self.testName,
             'test_version': self.testVersion,
             'software_name': 'ooniprobe',
-            'software_version': software_version
+            'software_version': software_version,
+            'options': self.options
         }
         return test_details
 
@@ -159,7 +160,7 @@ class NetTestLoader(object):
 
         for klass in test_classes:
             options = self.usageOptions()
-            options.parseOptions(self.netTestArgs)
+            options.parseOptions(self.options['subargs'])
             if options:
                 klass.localOptions = options
 
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index 1ca70c4..2fd4688 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -100,7 +100,6 @@ def runWithDirector():
     """
     global_options = parseOptions()
     log.start(global_options['logfile'])
-    net_test_args = global_options.get('subargs')
 
     # contains (test_cases, options, cmd_line_options)
     test_list = []
@@ -108,13 +107,10 @@ def runWithDirector():
     if global_options['testdeck']:
         test_deck = yaml.safe_load(open(global_options['testdeck']))
         for test in test_deck:
-            test_options = test['options']
-            test_file = test_options['test']
-            test_subargs = test_options['subargs']
-            test_list.append(NetTestLoader(test_file, test_subargs))
+            test_list.append(NetTestLoader(test['options']))
     else:
         log.debug("No test deck detected")
-        test_list.append(NetTestLoader(global_options['test'], net_test_args))
+        test_list.append(NetTestLoader(global_options))
 
     # check each test's usageOptions
     for net_test_loader in test_list:



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