This patch adds an error exception if the specification of the test
module from "repos/" ends with a colon (does not specify the module
name) instead of a meaningless backtrace.
---
exception.py | 10 ++++++++++
proxy.py | 4 ++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/exception.py b/exception.py
index 1a6d6f1..eeb899a 100644
--- a/exception.py
+++ b/exception.py
@@ -75,6 +75,16 @@ class FileExist(LibvirtException):
class CaseConfigfileError(LibvirtException):
code = 210
message = "Case config file Error"
+ def __init__(self, errorstr=None):
+ self.errorstr = errorstr
+
+ def __str__(self):
+ return repr(self.errorstr)
+
+ def response(self):
+ self.status = {'code':self.code, 'message':"%s:%s" %
+ (self.message, str(self))}
+ return self.status
class MissingVariable(LibvirtException):
code = 210
diff --git a/proxy.py b/proxy.py
index aa34d9a..16d498b 100644
--- a/proxy.py
+++ b/proxy.py
@@ -18,6 +18,8 @@
# The proxy examines the list of unique test cases, received from the
# generator and import each test case from appropriate module directory.
+import exception
+
class Proxy(object):
""" The Proxy class is used for getting real function call reference
"""
@@ -86,6 +88,8 @@ class Proxy(object):
# Import recursively module
for component in components[1:]:
+ if component=="":
+ raise exception.CaseConfigfileError("Missing module name after
\":\"")
case_mod = getattr(case_mod, component)
main_function_ref = getattr(case_mod, func)
return main_function_ref
--
1.7.3.4