aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2015-03-12 16:57:10 +1100
committerAldo Cortesi <aldo@nullcube.com>2015-03-12 16:57:10 +1100
commitde3f84934d86e48bf89822828df3eb9c3bd8e1e1 (patch)
tree17db4aba1acefbf05f83de7004ecb511e0809940
parentdfc1b391643d3e2d6b71d5844a48a197709ae469 (diff)
downloadmitmproxy-de3f84934d86e48bf89822828df3eb9c3bd8e1e1.tar.gz
mitmproxy-de3f84934d86e48bf89822828df3eb9c3bd8e1e1.tar.bz2
mitmproxy-de3f84934d86e48bf89822828df3eb9c3bd8e1e1.zip
Test suite should pass even if example dependencies are not present
-rw-r--r--test/test_examples.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test_examples.py b/test/test_examples.py
index 6fd126b8..e63f1c7a 100644
--- a/test/test_examples.py
+++ b/test/test_examples.py
@@ -3,6 +3,7 @@ from libmproxy import utils, script
from libmproxy.proxy import config
import tservers
+
def test_load_scripts():
example_dir = utils.Data("libmproxy").path("../examples")
scripts = glob.glob("%s/*.py" % example_dir)
@@ -16,5 +17,10 @@ def test_load_scripts():
f += " foo" # one argument required
if "modify_response_body" in f:
f += " foo bar" # two arguments required
- s = script.Script(f, tmaster) # Loads the script file.
- s.unload() \ No newline at end of file
+ try:
+ s = script.Script(f, tmaster) # Loads the script file.
+ except Exception, v:
+ if not "ImportError" in str(v):
+ raise
+ else:
+ s.unload()