summaryrefslogtreecommitdiffstats
path: root/tests/pyanaconda_test
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2011-07-29 10:57:17 -0400
committerChris Lumens <clumens@redhat.com>2011-08-01 10:02:28 -0400
commitca27378ad0229c66c3bbcbd6636f2e555c2d6db8 (patch)
treebd6ed7a840d0dea7270bf2ad872fb8de1f82068c /tests/pyanaconda_test
parent3d40080aba68361a8d46200b7a8afa46021598bf (diff)
downloadanaconda-ca27378ad0229c66c3bbcbd6636f2e555c2d6db8.tar.gz
anaconda-ca27378ad0229c66c3bbcbd6636f2e555c2d6db8.tar.xz
anaconda-ca27378ad0229c66c3bbcbd6636f2e555c2d6db8.zip
Delete the Mocked pyanaconda.product to fix product tests.
Since anaconda modules are such a tangle, running one of the earlier tests causes pyanaconda.product to get imported early. On that import, it gets created as a Mock object, so the later import doesn't do anything useful and all the product tests will therefore fail. If we delete and then re-import, everything will work. This is only seen if you run everything in tests/, not if you just run the product_test.py by itself.
Diffstat (limited to 'tests/pyanaconda_test')
-rw-r--r--tests/pyanaconda_test/product_test.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/pyanaconda_test/product_test.py b/tests/pyanaconda_test/product_test.py
index 5be51d373..9fd37a50e 100644
--- a/tests/pyanaconda_test/product_test.py
+++ b/tests/pyanaconda_test/product_test.py
@@ -50,31 +50,37 @@ class ProductTest(mock.TestCase):
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)