[blivet:rhel7/master 1/4] Move SwapSpace tests into a separate class (#1065422)

mulhern amulhern at redhat.com
Tue Feb 18 16:28:16 UTC 2014


Related: rbhz#1065422

Swap space is not like the other things tested here. Moving it into
a separate class allows abstraction of some of the other tests.

Signed-off-by: mulhern <amulhern at redhat.com>
---
 tests/formats_test/misc_test.py | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tests/formats_test/misc_test.py b/tests/formats_test/misc_test.py
index 1c08e37..bb2b586 100755
--- a/tests/formats_test/misc_test.py
+++ b/tests/formats_test/misc_test.py
@@ -332,27 +332,27 @@ class LabelingAsRootTestCase(baseclass.DevicelibsTestCase):
         an_fs = fs.HFS(device=_LOOP_DEV0, label="")
         self.assertIsNone(an_fs.create())
 
-    @unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
-    def testLabelingSwapSpace(self):
+ at unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
+class LabelingSwapSpaceTestCase(baseclass.DevicelibsTestCase):
+
+    def testLabeling(self):
         _LOOP_DEV0 = self._loopMap[self._LOOP_DEVICES[0]]
 
-        an_fs = swap.SwapSpace(device=_LOOP_DEV0)
-        an_fs.label = "mkswap is really pretty permissive about labels"
-        self.assertIsNone(an_fs.create())
+        swp = swap.SwapSpace(device=_LOOP_DEV0)
+        swp.label = "mkswap is really pretty permissive about labels"
+        self.assertIsNone(swp.create())
 
-    @unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
     def testCreatingSwapSpaceNone(self):
         _LOOP_DEV0 = self._loopMap[self._LOOP_DEVICES[0]]
 
-        an_fs = swap.SwapSpace(device=_LOOP_DEV0, label=None)
-        self.assertIsNone(an_fs.create())
+        swp = swap.SwapSpace(device=_LOOP_DEV0, label=None)
+        self.assertIsNone(swp.create())
 
-    @unittest.skipUnless(os.geteuid() == 0, "requires root privileges")
     def testCreatingSwapSpaceEmpty(self):
         _LOOP_DEV0 = self._loopMap[self._LOOP_DEVICES[0]]
 
-        an_fs = swap.SwapSpace(device=_LOOP_DEV0, label="")
-        self.assertIsNone(an_fs.create())
+        swp = swap.SwapSpace(device=_LOOP_DEV0, label="")
+        self.assertIsNone(swp.create())
 
 def suite():
     suite1 = unittest.TestLoader().loadTestsFromTestCase(InitializationTestCase)
-- 
1.8.3.1



More information about the anaconda-patches mailing list