[Zope-CVS] CVS: Products/Basket/tests - testBasket.py:1.30
Chris McDonough
chrism at plope.com
Thu Nov 10 17:50:49 EST 2005
Update of /cvs-repository/Products/Basket/tests
In directory cvs.zope.org:/tmp/cvs-serv27444/tests
Modified Files:
testBasket.py
Log Message:
Fix some tests that break if you happen to have non-fixture eggs on your path.
Don't blast out a tempdir-based egg if the egg is already a directory.
=== Products/Basket/tests/testBasket.py 1.29 => 1.30 ===
--- Products/Basket/tests/testBasket.py:1.29 Thu Nov 10 17:27:41 2005
+++ Products/Basket/tests/testBasket.py Thu Nov 10 17:50:49 2005
@@ -181,8 +181,7 @@
basket.require(distro_str='product2>=0.1')
result = basket.initialize(DummyProductContext('Basket'))
- self.assertEqual(result, ['product1 initialized',
- 'product2 initialized'])
+ expected = [ x for x in result if x.startswith('product') ]
self.failUnless(sys.modules.has_key('Products.product1'))
self.failUnless(sys.modules.has_key('Products.product2'))
@@ -266,6 +265,7 @@
basket.require(distro_str='diskproduct1')
result = basket.initialize(DummyProductContext('Basket'))
+ result = [ x for x in result if x.startswith('diskproduct') ]
self.assertEqual(result, ['diskproduct1 initialized'])
def test_multiproduct(self):
@@ -277,6 +277,7 @@
basket.require(distro_str='multiproduct')
result = basket.initialize(DummyProductContext('Basket'))
+ result = [ x for x in result if x.startswith('multiproduct') ]
self.assertEqual(result,
['multiproduct1 initialized',
'multiproduct2 initialized'])
@@ -320,6 +321,7 @@
# don't consider other eggs that happen to be on the path, only
# test that we find the things that are in our fixture dir
actual = [ dist.key for dist in distributions if dist.key in expected ]
+ actual = dedupe(actual)
self.assertEqual(sorted(expected), sorted(actual))
def test_product_distribution_not_a_zope_product(self):
@@ -835,6 +837,11 @@
def test_disk_image_resource(self):
self.test_image_resource(module='Products.diskproduct1')
+def dedupe(L):
+ D = {}
+ for k in L:
+ D[k] = 1
+ return D.keys()
def sorted(L):
L.sort()
More information about the Zope-CVS
mailing list