[master 21/21] Guard tests against device support being missing.

mulkieran installerbot-noreply at redhat.com
Tue May 12 21:36:03 UTC 2015


From: mulhern <amulhern at redhat.com>

Related: #12

Signed-off-by: mulhern <amulhern at redhat.com>
---
 tests/action_test.py           |  9 +++++++++
 tests/clearpart_test.py        |  6 ++++++
 tests/devices_test/lvm_test.py | 11 +++++++++++
 3 files changed, 26 insertions(+)

diff --git a/tests/action_test.py b/tests/action_test.py
index f030153..69b2c86 100644
--- a/tests/action_test.py
+++ b/tests/action_test.py
@@ -24,6 +24,15 @@
 from blivet.deviceaction import ActionAddMember
 from blivet.deviceaction import ActionRemoveMember
 
+DEVICE_CLASSES = [
+   DiskDevice,
+   PartitionDevice,
+   MDRaidArrayDevice,
+   LVMVolumeGroupDevice,
+   LVMLogicalVolumeDevice
+]
+
+ at unittest.skipUnless(not any(x.unavailableTypeDependencies() for x in DEVICE_CLASSES), "some unsupported device classes required for this test")
 class DeviceActionTestCase(StorageTestCase):
     """ DeviceActionTestSuite """
 
diff --git a/tests/clearpart_test.py b/tests/clearpart_test.py
index 80d43ee..de10186 100644
--- a/tests/clearpart_test.py
+++ b/tests/clearpart_test.py
@@ -6,6 +6,12 @@
 from parted import PARTITION_NORMAL
 from blivet.flags import flags
 
+DEVICE_CLASSES = [
+    blivet.devices.DiskDevice,
+    blivet.devices.PartitionDevice
+]
+
+ at unittest.skipUnless(not any(x.unavailableTypeDependencies() for x in DEVICE_CLASSES), "some unsupported device classes required for this test")
 class ClearPartTestCase(unittest.TestCase):
     def setUp(self):
         flags.testing = True
diff --git a/tests/devices_test/lvm_test.py b/tests/devices_test/lvm_test.py
index 12f0807..72fbd83 100644
--- a/tests/devices_test/lvm_test.py
+++ b/tests/devices_test/lvm_test.py
@@ -14,6 +14,17 @@
 from blivet.devices import LVMVolumeGroupDevice
 from blivet.size import Size
 
+DEVICE_CLASSES = [
+   LVMLogicalVolumeDevice,
+   LVMSnapShotDevice,
+   LVMThinLogicalVolumeDevice,
+   LVMThinPoolDevice,
+   LVMThinSnapShotDevice,
+   LVMVolumeGroupDevice,
+   StorageDevice
+]
+
+ at unittest.skipUnless(not any(x.unavailableTypeDependencies() for x in DEVICE_CLASSES), "some unsupported device classes required for this test")
 class LVMDeviceTest(unittest.TestCase):
     def testLVMSnapShotDeviceInit(self):
         pv = StorageDevice("pv1", fmt=blivet.formats.getFormat("lvmpv"),


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/220369a834144c4439a7f23db870170e90f61567


More information about the anaconda-patches mailing list