commit bcc2be41fb5b3a0ce45e5dce81718f677fbf0af5 Author: Arturo Filastò arturo@filasto.net Date: Wed Mar 16 20:10:12 2016 +0100
Fix bug in parsing of options for Lantern
* Add check to assert if lantern is installed in test requirements --- ooni/nettests/third_party/lantern.py | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/ooni/nettests/third_party/lantern.py b/ooni/nettests/third_party/lantern.py index da19566..5018ccb 100644 --- a/ooni/nettests/third_party/lantern.py +++ b/ooni/nettests/third_party/lantern.py @@ -10,6 +10,9 @@ from ooni.templates.process import ProcessTest, ProcessDirector from ooni.utils import log, net from ooni.errors import handleAllFailures
+class LanternNotInstalled(Exception): + pass + class UsageOptions(usage.Options): optParameters = [ ['url', 'u', net.GOOGLE_HUMANS[0], @@ -35,6 +38,11 @@ class LanternTest(ProcessTest): author = "Aaron Gibson" version = "0.1.0" timeout = 120 + usageOptions = UsageOptions + + def requirements(self): + if not distutils.spawn.find_executable("lantern"): + raise LanternNotInstalled('lantern is not installed')
def setUp(self): self.report['body'] = None