summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadomir Dopieralski <openstack@dopieralski.pl>2022-11-14 12:18:23 +0100
committerRadomir Dopieralski <openstack@dopieralski.pl>2022-11-14 17:03:32 +0100
commit6d7ecc144107b38101edc7b58e0b3f3519c61cb2 (patch)
treef4b41a7185c5f42435555500d6e86296e4bb317a
parentc319118d7d18a34bd73584b750fe40f3ccafb965 (diff)
downloadhorizon-6d7ecc144107b38101edc7b58e0b3f3519c61cb2.tar.gz
Attach video even if the exception happens in cleanup
The way we were handling attaching video in integration tests, it would not attach it if the error happened in a cleanup, not in the main body of the test. This should fix that. Change-Id: I356e6849892ed87b2827740e265fcf15fc076cb5
-rw-r--r--openstack_dashboard/test/integration_tests/helpers.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/openstack_dashboard/test/integration_tests/helpers.py b/openstack_dashboard/test/integration_tests/helpers.py
index f3941f259..0e2ef5fde 100644
--- a/openstack_dashboard/test/integration_tests/helpers.py
+++ b/openstack_dashboard/test/integration_tests/helpers.py
@@ -149,15 +149,20 @@ class BaseTestCase(testtools.TestCase):
self.video_recorder = VideoRecorder(width, height, display=display)
self.video_recorder.start()
- self.addOnException(
- lambda exc_info: setattr(self, '_need_attach_video', True))
+ def attach_video(exc_info):
+ if getattr(self, '_attached_video', None):
+ return
+ self.video_recorder.stop()
+ self._attach_video()
+ setattr(self, '_attached_video', True)
+
+ self.addOnException(attach_video)
def cleanup():
+ if getattr(self, '_attached_video', None):
+ return
self.video_recorder.stop()
- if getattr(self, '_need_attach_video', None):
- self._attach_video()
- else:
- self.video_recorder.clear()
+ self.video_recorder.clear()
self.addCleanup(cleanup)