[PATCH 2/2] Move importing of tested modules into setUp methods

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 tests/kickstart/commands.py        |    9 ++++++---
 tests/storage/devicelibs/crypto.py |    6 +++++-
 tests/storage/devicelibs/lvm.py    |    5 ++++-
 tests/storage/devicelibs/mdraid.py |    6 ++++--
 tests/storage/devicelibs/mpath.py  |    5 ++++-
 tests/storage/devicelibs/swap.py   |    5 ++++-
 6 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/tests/kickstart/commands.py b/tests/kickstart/commands.py
index 4dc8ed0..63de209 100755
--- a/tests/kickstart/commands.py
+++ b/tests/kickstart/commands.py
@@ -18,14 +18,14 @@
 # Author: Chris Lumens <clumens@xxxxxxxxxx>
 import unittest
 
-import kickstart
-import pykickstart.version
-
 # Verify that each kickstart command in anaconda uses the correct version of
 # that command as provided by pykickstart.  That is, if there's an FC3 and an
 # F10 version of a command, make sure anaconda >= F10 uses the F10 version.
 class CommandVersionTestCase(unittest.TestCase):
     def setUp(self):
+        import kickstart
+        import pykickstart.version
+
         self.handler = pykickstart.version.makeVersion(kickstart.ver)
 
     def runTest(self):
@@ -37,6 +37,9 @@ class CommandVersionTestCase(unittest.TestCase):
 # Do the same thing as CommandVersionTestCase, but for data objects.
 class DataVersionTestCase(unittest.TestCase):
     def setUp(self):
+        import kickstart
+        import pykickstart.version
+
         self.handler = pykickstart.version.makeVersion(kickstart.ver)
 
     def runTest(self):
diff --git a/tests/storage/devicelibs/crypto.py b/tests/storage/devicelibs/crypto.py
index 772ef09..434fdcb 100755
--- a/tests/storage/devicelibs/crypto.py
+++ b/tests/storage/devicelibs/crypto.py
@@ -1,13 +1,17 @@
 #!/usr/bin/python
 import baseclass
 import unittest
-import storage.devicelibs.crypto as crypto
 
 import tempfile
 import os
 
 class CryptoTestCase(baseclass.DevicelibsTestCase):
 
+    def setUp(self):
+        baseclass.DevicelibsTestCase.setUp(self)
+        import storage.devicelibs.crypto as crypto
+
+
     def testCrypto(self):
         ##
         ## is_luks
diff --git a/tests/storage/devicelibs/lvm.py b/tests/storage/devicelibs/lvm.py
index 31e486f..734644d 100755
--- a/tests/storage/devicelibs/lvm.py
+++ b/tests/storage/devicelibs/lvm.py
@@ -1,10 +1,13 @@
 #!/usr/bin/python
 import baseclass
 import unittest
-import storage.devicelibs.lvm as lvm
 
 class LVMTestCase(baseclass.DevicelibsTestCase):
 
+    def setUp(self):
+        baseclass.DevicelibsTestCase.setUp(self)
+        import storage.devicelibs.lvm as lvm
+
     def testLVM(self):
         ##
         ## pvcreate
diff --git a/tests/storage/devicelibs/mdraid.py b/tests/storage/devicelibs/mdraid.py
index eada528..9dde22d 100755
--- a/tests/storage/devicelibs/mdraid.py
+++ b/tests/storage/devicelibs/mdraid.py
@@ -1,12 +1,14 @@
 #!/usr/bin/python
 import baseclass
 import unittest
-import storage.devicelibs.mdraid as mdraid
-
 import time
 
 class MDRaidTestCase(baseclass.DevicelibsTestCase):
 
+    def setUp(self):
+        baseclass.DevicelibsTestCase.setUp(self)
+        import storage.devicelibs.mdraid as mdraid
+
     def testMDRaid(self):
         ##
         ## getRaidLevels
diff --git a/tests/storage/devicelibs/mpath.py b/tests/storage/devicelibs/mpath.py
index 3fdbe10..813a516 100755
--- a/tests/storage/devicelibs/mpath.py
+++ b/tests/storage/devicelibs/mpath.py
@@ -1,9 +1,12 @@
 #!/usr/bin/python
 import baseclass
 import unittest
-import storage.devicelibs.mpath as mpath
 
 class MPathTestCase(baseclass.DevicelibsTestCase):
+    def setUp(self):
+        baseclass.DevicelibsTestCase.setUp(self)
+        import storage.devicelibs.mpath as mpath
+
     def testMPath(self):
         ##
         ## parseMultipathOutput
diff --git a/tests/storage/devicelibs/swap.py b/tests/storage/devicelibs/swap.py
index ca78cac..ddf8d21 100755
--- a/tests/storage/devicelibs/swap.py
+++ b/tests/storage/devicelibs/swap.py
@@ -1,10 +1,13 @@
 #!/usr/bin/python
 import baseclass
 import unittest
-import storage.devicelibs.swap as swap
 
 class SwapTestCase(baseclass.DevicelibsTestCase):
 
+    def setUp(self):
+        baseclass.DevicelibsTestCase.setUp(self)
+        import storage.devicelibs.swap as swap
+
     def testSwap(self):
         ##
         ## mkswap
-- 
1.6.6.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux