pytest-based selenium tests add fix recording issue

When tests are very short and passed (they do not wait for any element).
Specifically: test_user_login, test_admin_login.
The action in UI (login and check the homepage) is super quick (0.5s-1s).
So the video is not even created - we do not need to clean it up.

Change-Id: Id8433842247258f472fa3951fcdfa2b0e78ae781
This commit is contained in:
Jan Jasek 2024-01-08 09:17:42 +01:00
parent 42915b6a78
commit df857b7f69

View File

@ -148,7 +148,10 @@ def record_video(request, report_dir, xdisplay):
popen.communicate()
thread.join()
if not request.node.stash.get(STASH_FAILED, False):
os.remove(filepath)
try:
os.remove(filepath)
except OSError:
pass
@pytest.fixture(scope='session')