[config] Exclude "pyramid" cube when initializing application cubes
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 06 Oct 2016 12:15:43 +0200
changeset 11710 dd5df5fe7137
parent 11709 c16fe74d0a5f
child 11711 fe0fcb9e1fd0
[config] Exclude "pyramid" cube when initializing application cubes Related to #14023058.
cubicweb/cwconfig.py
cubicweb/test/unittest_cwconfig.py
--- a/cubicweb/cwconfig.py	Wed Oct 05 16:20:52 2016 +0200
+++ b/cubicweb/cwconfig.py	Thu Oct 06 12:15:43 2016 +0200
@@ -881,6 +881,11 @@
     _cubes = None
 
     def init_cubes(self, cubes):
+        cubes = list(cubes)
+        if 'pyramid' in cubes:
+            self.warning("cubicweb-pyramid got integrated into CubicWeb; "
+                         "remove it from your project's dependencies")
+            cubes.remove('pyramid')
         self._cubes = self.reorder_cubes(cubes)
         # load cubes'__init__.py file first
         for cube in cubes:
--- a/cubicweb/test/unittest_cwconfig.py	Wed Oct 05 16:20:52 2016 +0200
+++ b/cubicweb/test/unittest_cwconfig.py	Thu Oct 06 12:15:43 2016 +0200
@@ -142,6 +142,12 @@
                               ['email/views', 'email/hooks.py'])
         self.assertEqual(path[10:], ['test/data/entities.py', 'test/data/views.py'])
 
+    def test_init_cubes_ignore_pyramid_cube(self):
+        warning_msg = 'cubicweb-pyramid got integrated into CubicWeb'
+        with self.assertLogs('cubicweb.configuration', level='WARNING') as cm:
+            self.config.init_cubes(['pyramid', 'card'])
+        self.assertIn(warning_msg, cm.output[0])
+        self.assertNotIn('pyramid', self.config._cubes)
 
 class CubicWebConfigurationWithLegacyCubesTC(CubicWebConfigurationTC):