From df857b7f69f6914f55c7e10a916fd8e9bc3ded30 Mon Sep 17 00:00:00 2001 From: Jan Jasek Date: Mon, 8 Jan 2024 09:17:42 +0100 Subject: [PATCH] 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 --- openstack_dashboard/test/selenium/conftest.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openstack_dashboard/test/selenium/conftest.py b/openstack_dashboard/test/selenium/conftest.py index f2fdd60333..acd8385972 100644 --- a/openstack_dashboard/test/selenium/conftest.py +++ b/openstack_dashboard/test/selenium/conftest.py @@ -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')