diff options
author | Zuul <zuul@review.opendev.org> | 2022-12-03 00:31:04 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-12-03 00:31:04 +0000 |
commit | 19a0132ab20b6accc95977162bf7dc7fae70c506 (patch) | |
tree | 279fd3e470cf7614c954f99fcd4e259a3458efbe | |
parent | f59ba56268048de83f8440a4616342206a29b633 (diff) | |
parent | 6d7ecc144107b38101edc7b58e0b3f3519c61cb2 (diff) | |
download | horizon-19a0132ab20b6accc95977162bf7dc7fae70c506.tar.gz |
Merge "Attach video even if the exception happens in cleanup"
-rw-r--r-- | openstack_dashboard/test/integration_tests/helpers.py | 17 |
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) |