
Sharad Mishra wrote:
+ + except Exception, detail: + logger.error("Exception: %s", detail) + status = FAIL
Instead of calling undefine before each call to raise Exception(), why not put the undefine call in the except block? This means you'll only need to call undefine() once for any exception. And if this test case is extended in the future, it'll safe guard against an accidental exclusion of the undefine() call when an exception occurs.
There is an exception raised if define fails. We don't want to call undefine if the VM wasn't defined.
Ah, agreed. Although, many of test cases do this anyway. Because we don't check the output of undefine() (except for certain occasions). So the worst thing that happens is that the undefine() call returns an error. And we get some additional negative testing in... Generally, I prefer to make sure the cleanup happens in one place - that way it is easy to tell whether the test is cleaning up properly. But this is a good point. It's fine to leave it as is.