* main - lvmdbustest: Utilize addCleanup in unit test
@ 2022-09-19 15:58 Tony Asleson
0 siblings, 0 replies; only message in thread
From: Tony Asleson @ 2022-09-19 15:58 UTC (permalink / raw)
To: lvm-devel
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b6dc96d8ef03e7af6624ab88a94654ffa94c50ba
Commit: b6dc96d8ef03e7af6624ab88a94654ffa94c50ba
Parent: e977b70bfb0a26a8dd5cd06d581cb810e2a6f10b
Author: Tony Asleson <tasleson@redhat.com>
AuthorDate: Wed Aug 31 18:03:16 2022 -0500
Committer: Tony Asleson <tasleson@redhat.com>
CommitterDate: Fri Sep 16 10:49:37 2022 -0500
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.
---
test/dbus/lvmdbustest.py | 8 +++-----
1 file 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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-09-19 15:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-19 15:58 main - lvmdbustest: Utilize addCleanup in unit test Tony Asleson
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.