----- "Amos Kong" <[email protected]> wrote:
> If login timeout, wait_for() returned 'None' and assigned to
> 'session'.
> When call session.close(), this prlblem was caused:
> "AttributeError: 'NoneType' object has no attribute 'close'"
>
> Signed-off-by: Amos Kong <[email protected]>
> ---
> client/tests/kvm/tests/timedrift_with_migration.py | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/client/tests/kvm/tests/timedrift_with_migration.py
> b/client/tests/kvm/tests/timedrift_with_migration.py
> index a012db3..0b93183 100644
> --- a/client/tests/kvm/tests/timedrift_with_migration.py
> +++ b/client/tests/kvm/tests/timedrift_with_migration.py
> @@ -76,7 +76,8 @@ def run_timedrift_with_migration(test, params,
> env):
> time_filter_re,
> time_format)
>
> finally:
> - session.close()
> + if session != None:
> + session.close()
Agreed, but we can make this simply:
if session:
session.close()
There's no need to explicitly check for None (and if there was,
the preferred syntax would be 'is not None' rather than '!= None').
Also, just to be safe, we should make the same modification to
timedrift_with_reboot.py.
We can also consider removing the try..finally clauses altogether
because sessions are now closed automatically when they're no longer
needed.
>
> # Report results
> host_delta = ht1 - ht0
> --
> 1.5.5.6
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest