diff --git a/robottelo/hosts.py b/robottelo/hosts.py index 8f52e34616a..7e4b1696275 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -1766,17 +1766,15 @@ def get_caller(): return None try: - ui_session = Session( + with Session( session_name=testname or get_caller(), user=user or settings.server.admin_username, password=password or settings.server.admin_password, url=url, hostname=self.hostname, login=login, - ) - yield ui_session - except Exception: - raise + ) as ui_session: + yield ui_session finally: video_url = settings.ui.grid_url.replace( ':4444', f'/videos/{ui_session.ui_session_id}.mp4'