summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2022-08-31 18:03:16 -0500
committerTony Asleson <tasleson@redhat.com>2022-09-16 10:49:37 -0500
commitb6dc96d8ef03e7af6624ab88a94654ffa94c50ba (patch)
treef479313cfab6bea11a0bf4d7e76281435a80bcf4
parente977b70bfb0a26a8dd5cd06d581cb810e2a6f10b (diff)
downloadlvm2-b6dc96d8ef03e7af6624ab88a94654ffa94c50ba.tar.gz
lvmdbustest: Utilize addCleanup in unit test
Register the clean up with addCleanup so we ensure clean_up gets run regardless of what happens in setUp.
-rwxr-xr-xtest/dbus/lvmdbustest.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index c932d0830..0d06177c0 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -383,6 +383,9 @@ class DaemonInfo(object):
# noinspection PyUnresolvedReferences
class TestDbusService(unittest.TestCase):
def setUp(self):
+
+ self.addCleanup(self.clean_up)
+
# Because of the sensitive nature of running LVM tests we will only
# run if we have PVs and nothing else, so that we can be confident that
# we are not mucking with someone's data on their system
@@ -463,11 +466,6 @@ class TestDbusService(unittest.TestCase):
# print('Re-creating PV=', p)
self._pv_create(p)
- def tearDown(self):
- # If we get here it means we passed setUp, so lets remove anything
- # and everything that remains, besides the PVs themselves
- self.clean_up()
-
def _check_consistency(self):
# Only do consistency checks if we aren't running the unit tests
# concurrently