Test suite should pass even if example dependencies are not present
This commit is contained in:
parent
dfc1b39164
commit
de3f84934d
|
@ -3,6 +3,7 @@ from libmproxy import utils, script
|
||||||
from libmproxy.proxy import config
|
from libmproxy.proxy import config
|
||||||
import tservers
|
import tservers
|
||||||
|
|
||||||
|
|
||||||
def test_load_scripts():
|
def test_load_scripts():
|
||||||
example_dir = utils.Data("libmproxy").path("../examples")
|
example_dir = utils.Data("libmproxy").path("../examples")
|
||||||
scripts = glob.glob("%s/*.py" % example_dir)
|
scripts = glob.glob("%s/*.py" % example_dir)
|
||||||
|
@ -16,5 +17,10 @@ def test_load_scripts():
|
||||||
f += " foo" # one argument required
|
f += " foo" # one argument required
|
||||||
if "modify_response_body" in f:
|
if "modify_response_body" in f:
|
||||||
f += " foo bar" # two arguments required
|
f += " foo bar" # two arguments required
|
||||||
|
try:
|
||||||
s = script.Script(f, tmaster) # Loads the script file.
|
s = script.Script(f, tmaster) # Loads the script file.
|
||||||
|
except Exception, v:
|
||||||
|
if not "ImportError" in str(v):
|
||||||
|
raise
|
||||||
|
else:
|
||||||
s.unload()
|
s.unload()
|
Loading…
Reference in New Issue