From aa4439984d8c8b628630875f3277062da3dbf810 Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Tue, 29 Jan 2008 22:02:15 +0000 Subject: [PATCH] attempt to execute file from bash if call() fails --- qaapi/qa/tests/Test.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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 -- 2.43.0