summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAles Kozumplik <akozumpl@redhat.com>2011-08-03 08:12:36 +0200
committerAles Kozumplik <akozumpl@redhat.com>2011-08-05 15:01:24 +0200
commit67c4a5fd8602958fc9a6e4bacfe23fa85ccff475 (patch)
tree84a32baddfeb9668cbb065d64082290eecbce36b /tests
parent336e9f2a7be3c9df3e76333f112efe040d979143 (diff)
downloadanaconda-67c4a5fd8602958fc9a6e4bacfe23fa85ccff475.tar.gz
anaconda-67c4a5fd8602958fc9a6e4bacfe23fa85ccff475.tar.xz
anaconda-67c4a5fd8602958fc9a6e4bacfe23fa85ccff475.zip
ut: product_test.py should not fail if executed by itself.
Do the sys.modules magic in setup and be mindful. Also see ca27378ad0229c66c3bbcbd6636f2e555c2d6db8.
Diffstat (limited to 'tests')
-rw-r--r--tests/pyanaconda_test/product_test.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/tests/pyanaconda_test/product_test.py b/tests/pyanaconda_test/product_test.py
index 9fd37a50e..9b0d86449 100644
--- a/tests/pyanaconda_test/product_test.py
+++ b/tests/pyanaconda_test/product_test.py
@@ -43,44 +43,40 @@ class ProductTest(mock.TestCase):
self.open = __builtin__.open
__builtin__.open = self.fs.open
+ if 'pyanaconda.product' in sys.modules:
+ del(sys.modules["pyanaconda.product"])
+
def tearDown(self):
__builtin__.open = self.open
self.tearDownModules()
-
def bug_url_test(self):
sys.modules['os'].access = mock.Mock(return_value=True)
- del(sys.modules["pyanaconda.product"])
import pyanaconda.product
self.assertEqual(pyanaconda.product.bugUrl, self.BUGURL)
def is_final_test(self):
sys.modules['os'].access = mock.Mock(return_value=True)
- del(sys.modules["pyanaconda.product"])
import pyanaconda.product
self.assertFalse(pyanaconda.product.isFinal)
def product_arch_test(self):
sys.modules['os'].access = mock.Mock(return_value=True)
- del(sys.modules["pyanaconda.product"])
import pyanaconda.product
self.assertEqual(pyanaconda.product.productArch, self.ARCH)
def product_name_test(self):
sys.modules['os'].access = mock.Mock(return_value=True)
- del(sys.modules["pyanaconda.product"])
import pyanaconda.product
self.assertEqual(pyanaconda.product.productName, self.NAME)
def product_stamp_test(self):
sys.modules['os'].access = mock.Mock(return_value=True)
- del(sys.modules["pyanaconda.product"])
import pyanaconda.product
self.assertEqual(pyanaconda.product.productStamp, self.UUID)
def product_version_test(self):
sys.modules['os'].access = mock.Mock(return_value=True)
- del(sys.modules["pyanaconda.product"])
import pyanaconda.product
self.assertEqual(pyanaconda.product.productVersion, self.VERSION)