[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Change how we pass arguments to the nettest loader
commit a5f13f439d893c2b200d74549babe0ccf4077c63
Author: Arturo Filastò <art@xxxxxxxxx>
Date: Wed Feb 27 18:11:30 2013 +0100
Change how we pass arguments to the nettest loader
* Explicit the passing of the nettest file argument
---
ooni/errors.py | 2 ++
ooni/nettest.py | 12 ++++++------
ooni/oonicli.py | 6 ++++--
3 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/ooni/errors.py b/ooni/errors.py
index 69af726..f36abb9 100644
--- a/ooni/errors.py
+++ b/ooni/errors.py
@@ -141,3 +141,5 @@ class InsufficientPrivileges(Exception):
class ProbeIPUnknown(Exception):
pass
+class GeoIPDataFilesNotFound(Exception):
+ pass
diff --git a/ooni/nettest.py b/ooni/nettest.py
index b264797..7108cd1 100644
--- a/ooni/nettest.py
+++ b/ooni/nettest.py
@@ -11,7 +11,7 @@ from ooni.utils import log, checkForRoot
from ooni import config
from ooni import otime
-from ooni.errors import AllReportersFailed
+from ooni import errors as e
from inspect import getmembers
from StringIO import StringIO
@@ -22,12 +22,12 @@ class NoTestCasesFound(Exception):
class NetTestLoader(object):
method_prefix = 'test'
- def __init__(self, options):
+ def __init__(self, options, test_file=None, test_string=None):
self.options = options
- if 'test_file' in options:
- self.loadNetTestFile(options['test_file'])
- elif 'test_string' in options:
- self.loadNetTestString(options['test_string'])
+ if test_file:
+ self.loadNetTestFile(test_file)
+ elif test_string:
+ self.loadNetTestString(test_string)
@property
def testDetails(self):
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index 243b90c..73d7709 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -107,10 +107,12 @@ def runWithDirector():
if global_options['testdeck']:
test_deck = yaml.safe_load(open(global_options['testdeck']))
for test in test_deck:
- test_list.append(NetTestLoader(test['options']))
+ test_list.append(NetTestLoader(test['options'],
+ test_file=global_options['test_file']))
else:
log.debug("No test deck detected")
- test_list.append(NetTestLoader(global_options))
+ test_list.append(NetTestLoader(global_options['subargs'],
+ test_file=global_options['test_file']))
# 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