From: Tony Mack Date: Tue, 29 Jan 2008 22:02:15 +0000 (+0000) Subject: attempt to execute file from bash if call() fails X-Git-Tag: 2008-02-11-last-vmware-support~58 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=aa4439984d8c8b628630875f3277062da3dbf810;p=tests.git attempt to execute file from bash if call() fails --- diff --git a/qaapi/qa/tests/Test.py b/qaapi/qa/tests/Test.py index d7ab1e3..08f49f1 100644 --- a/qaapi/qa/tests/Test.py +++ b/qaapi/qa/tests/Test.py @@ -32,7 +32,7 @@ class Test: def __init__(self, config = Config()): self.name = self.__class__.__name__ - self.path=os.path.dirname(sys.argv[0]) + self.path=os.path.abspath(os.path.dirname(sys.argv[0])) self.config = config self.errors = [] @@ -47,8 +47,18 @@ class Test: # Check that the right number of arguments were passed in #if len(args) < len(min_args) or len(args) > len(max_args): # raise Exception#, (len(args), len(min_args), len(max_args)) - - result = self.call(*args, **kwds) + + module = self.__class__.__module__.replace(".", os.sep) + file = self.path + os.sep + module + ".py" + try: + result = self.call(*args, **kwds) + except NameError: + command = "%s %s" % (file, " ".join(args)) + utils.header(command) + (stdout, stderr) = utils.popen(command) + print "".join(stdout) + result = None + return result