It's possible for the test to fail when there's no shell session to close, and then session.close() in the finally clause raises a TypeError. Signed-off-by: Michael Goldish <mgoldish@xxxxxxxxxx> --- client/tests/kvm/kvm_tests.py | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/client/tests/kvm/kvm_tests.py b/client/tests/kvm/kvm_tests.py index 446b415..43a6291 100644 --- a/client/tests/kvm/kvm_tests.py +++ b/client/tests/kvm/kvm_tests.py @@ -44,18 +44,17 @@ def run_boot(test, params, env): 120, 0, 1): raise error.TestFail("Guest refuses to go down") + finally: session.close() - logging.info("Guest is down; waiting for it to go up again...") - - session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2) - if not session: - raise error.TestFail("Could not log into guest after reboot") + logging.info("Guest is down; waiting for it to go up again...") - logging.info("Guest is up again") + session = kvm_utils.wait_for(vm.remote_login, 240, 0, 2) + if not session: + raise error.TestFail("Could not log into guest after reboot") + session.close() - finally: - session.close() + logging.info("Guest is up again") def run_shutdown(test, params, env): -- 1.5.4.1 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html