[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [ooni-probe/master] Disable checking for incoherences in config file when unittesting oonicli.
commit 093fbbc719aa06438015eeb2e8782bab04e81156
Author: Arturo Filastò <art@xxxxxxxxx>
Date: Fri Aug 8 18:39:38 2014 +0200
Disable checking for incoherences in config file when unittesting oonicli.
---
ooni/director.py | 5 +++--
ooni/oonicli.py | 7 ++++---
ooni/tests/test_oonicli.py | 6 ++++--
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/ooni/director.py b/ooni/director.py
index 2245cad..d4b8c6c 100644
--- a/ooni/director.py
+++ b/ooni/director.py
@@ -120,11 +120,12 @@ class Director(object):
return nettests
@defer.inlineCallbacks
- def start(self, start_tor=False):
+ def start(self, start_tor=False, check_incoherences=True):
self.netTests = self.getNetTests()
if start_tor:
- yield config.check_tor()
+ if check_incoherences:
+ yield config.check_tor()
if config.advanced.start_tor:
yield self.startTor()
elif config.tor.control_port:
diff --git a/ooni/oonicli.py b/ooni/oonicli.py
index d66cf5c..2320dec 100644
--- a/ooni/oonicli.py
+++ b/ooni/oonicli.py
@@ -102,7 +102,7 @@ def parseOptions():
return dict(cmd_line_options)
-def runWithDirector(logging=True, start_tor=True):
+def runWithDirector(logging=True, start_tor=True, check_incoherences=True):
"""
Instance the director, parse command line options and start an ooniprobe
test!
@@ -112,7 +112,7 @@ def runWithDirector(logging=True, start_tor=True):
config.set_paths()
config.initialize_ooni_home()
try:
- config.read_config_file(check_incoherences=True)
+ config.read_config_file(check_incoherences=check_incoherences)
except errors.ConfigFileIncoherent:
sys.exit(6)
@@ -207,7 +207,8 @@ def runWithDirector(logging=True, start_tor=True):
sys.exit(5)
start_tor |= deck.requiresTor
- d = director.start(start_tor=start_tor)
+ d = director.start(start_tor=start_tor,
+ check_incoherences=check_incoherences)
def setup_nettest(_):
try:
diff --git a/ooni/tests/test_oonicli.py b/ooni/tests/test_oonicli.py
index 92da134..78f8b66 100644
--- a/ooni/tests/test_oonicli.py
+++ b/ooni/tests/test_oonicli.py
@@ -43,7 +43,7 @@ advanced:
geoip_data_dir: /usr/share/GeoIP
debug: false
interface: auto
- start_tor: true
+ start_tor: false
measurement_timeout: 60
measurement_retries: 2
measurement_concurrency: 10
@@ -53,6 +53,8 @@ advanced:
data_dir: /usr/share/ooni
oonid_api_port: 8042
tor:
+ socks_port: 9050
+
"""
@@ -88,7 +90,7 @@ class TestRunDirector(ConfigTestCase):
sys.argv.extend(ooni_args)
sys.argv.extend(['-n', '-o', output_file, test_name])
sys.argv.extend(nettest_args)
- yield runWithDirector(False, False)
+ yield runWithDirector(False, False, False)
with open(output_file) as f:
entries = yaml.safe_load_all(f)
header = entries.next()
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits