[Checkins] SVN: Products.GenericSetup/branches/wichert-dependencies/t Some more fixes. The tests run properly now

Wichert Akkerman wichert at wiggy.net
Wed Nov 21 18:55:04 EST 2007


Log message for revision 81955:
  Some more fixes. The tests run properly now

Changed:
  U   Products.GenericSetup/branches/wichert-dependencies/tests/test_tool.py
  U   Products.GenericSetup/branches/wichert-dependencies/tool.py

-=-
Modified: Products.GenericSetup/branches/wichert-dependencies/tests/test_tool.py
===================================================================
--- Products.GenericSetup/branches/wichert-dependencies/tests/test_tool.py	2007-11-21 21:30:44 UTC (rev 81954)
+++ Products.GenericSetup/branches/wichert-dependencies/tests/test_tool.py	2007-11-21 23:55:03 UTC (rev 81955)
@@ -59,7 +59,7 @@
 <metadata>
   <version>1.0</version>
   <dependencies>
-    <dependency>profile-bar</dependency>
+    <dependency>profile-other:bar</dependency>
   </dependencies>
 </metadata>
 """
@@ -70,6 +70,7 @@
     layer = ExportImportZCMLLayer
 
     _PROFILE_PATH = '/tmp/STT_test'
+    _PROFILE_PATH2 = '/tmp/STT_test2'
 
     def afterSetUp(self):
         self._profile_registry_info = profile_registry._profile_info
@@ -527,18 +528,16 @@
         tool = self._makeOne('setup_tool').__of__( site )
 
         profile_registry.registerProfile('foo', 'Foo', '', self._PROFILE_PATH)
-        profile_registry.registerProfile('bar', 'Bar', '', self._PROFILE_PATH)
+        profile_registry.registerProfile('bar', 'Bar', '', self._PROFILE_PATH2)
 
         _imported = []
-        def _runImportStepsFromContext(context, steps=None, purge_old=None, profile_id=None):
-            _imported.append(profile_id)
-            return dict(steps=[], messages="")
+        def applyContext(context):
+            _imported.append(context._profile_path)
 
-        tool._runImportStepsFromContext=_runImportStepsFromContext
-        import pdb ; pdb.set_trace()
+        tool.applyContext=applyContext
         result = tool.runAllImportStepsFromProfile('profile-other:foo',
                                                    ignore_dependencies=False)
-        self.assertEqual(_imported, ["profile-other:bar", "profile-other:foo"])
+        self.assertEqual(_imported, [self._PROFILE_PATH2, self._PROFILE_PATH])
 
 
     def test_runExportStep_nonesuch( self ):

Modified: Products.GenericSetup/branches/wichert-dependencies/tool.py
===================================================================
--- Products.GenericSetup/branches/wichert-dependencies/tool.py	2007-11-21 21:30:44 UTC (rev 81954)
+++ Products.GenericSetup/branches/wichert-dependencies/tool.py	2007-11-21 23:55:03 UTC (rev 81955)
@@ -866,7 +866,10 @@
 
     security.declareProtected(ManagePortal, 'getDependenciesForProfile')
     def getDependenciesForProfile(self, profile_id):
-        return self.getProfileInfo( profile_id ).get('dependencies', ())
+        try:
+            return self.getProfileInfo( profile_id ).get('dependencies', ())
+        except KeyError:
+            return ()
 
 
     security.declareProtected(ManagePortal, 'listProfilesWithUpgrades')
@@ -1115,7 +1118,7 @@
                         continue
                     self._runImportStepsFromContext(steps=steps,
                                                     purge_old=purge_old,
-                                                    profile_id=profile_id,
+                                                    profile_id=dependency,
                                                     ignore_dependencies=ignore_dependencies,
                                                     seen=seen)
 



More information about the Checkins mailing list