Commits

Olemis Lang committed b9c38d9

BH Multiproduct #539 : Minor tweaks to cope with components on/off config side-effects

  • Participants
  • Parent commits 0a95656
  • Branches t539_product_config_sync

Comments (0)

Files changed (1)

File t539/t539_r1545950_product_component_dyn_status.diff

 
 diff -r 83c2eaf869e0 bloodhound_multiproduct/multiproduct/env.py
 --- a/bloodhound_multiproduct/multiproduct/env.py	Thu Nov 28 14:52:13 2013 -0500
-+++ b/bloodhound_multiproduct/multiproduct/env.py	Sun Dec 01 00:10:42 2013 -0500
-@@ -635,6 +635,25 @@
++++ b/bloodhound_multiproduct/multiproduct/env.py	Sun Dec 01 15:08:12 2013 -0500
+@@ -324,8 +324,7 @@
+             del env._rules
+         except AttributeError:
+             pass
+-        # FIXME: Shall we ?
+-        #env.config.save()
++        env.config.save()
+ 
+     def reset_db(self, default_data=None):
+         multiproduct_schema = self._multiproduct_schema_enabled
+@@ -635,6 +634,25 @@
  
      is_component_enabled_local = trac.env.Environment.is_component_enabled.im_func
  
      def is_component_enabled(self, cls):
          """Implemented to only allow activation of components already 
          activated in the global environment that are in turn not disabled in
-@@ -807,6 +826,7 @@
+@@ -807,6 +825,7 @@
          else:
              parents = [self.parent.config]
          self.config = Configuration(self.parent, self.product.prefix, parents)
      def setup_log(self):
 diff -r 83c2eaf869e0 bloodhound_multiproduct/tests/env.py
 --- a/bloodhound_multiproduct/tests/env.py	Thu Nov 28 14:52:13 2013 -0500
-+++ b/bloodhound_multiproduct/tests/env.py	Sun Dec 01 00:10:42 2013 -0500
-@@ -27,8 +27,9 @@
++++ b/bloodhound_multiproduct/tests/env.py	Sun Dec 01 15:08:12 2013 -0500
+@@ -22,13 +22,15 @@
+ from inspect import stack
+ import os.path
+ import shutil
++import sys
+ import tempfile
+ from sqlite3 import OperationalError
  from tests import unittest
  from types import MethodType
  
  from trac.env import Environment
  from trac.test import EnvironmentStub, MockPerm
  from trac.tests.env import EnvironmentTestCase
-@@ -678,11 +679,141 @@
+@@ -224,8 +226,8 @@
+         r"""Apply multi product upgrades
+         """
+         # Do not break wiki parser ( see #373 )
+-        env.disable_component(TicketModule)
+-        env.disable_component(ReportModule)
++        EnvironmentStub.disable_component_in_config(env, TicketModule)
++        EnvironmentStub.disable_component_in_config(env, ReportModule)
+ 
+         mpsystem = MultiProductSystem(env)
+         try:
+@@ -396,6 +398,7 @@
+             pass
+         # Let's pretend this was declared elsewhere
+         C.__module__ = 'dummy_module'
++        sys.modules['dummy_module'] = sys.modules[__name__]
+ 
+         global_env = self.env
+         product_env = self.product_env
+@@ -412,6 +415,8 @@
+             expected_rules = {
+                 'multiproduct': True,
+                 'trac': True,
++                'trac.ticket.report.reportmodule': False,
++                'trac.ticket.web_ui.ticketmodule': False,
+                 'trac.db': True,
+                 cname: False,
+             }
+@@ -678,11 +683,141 @@
      product_base_url = staticmethod(product_base_url)
  
  
  if __name__ == '__main__':
 diff -r 83c2eaf869e0 trac/trac/test.py
 --- a/trac/trac/test.py	Thu Nov 28 14:52:13 2013 -0500
-+++ b/trac/trac/test.py	Sun Dec 01 00:10:42 2013 -0500
++++ b/trac/trac/test.py	Sun Dec 01 15:08:12 2013 -0500
 @@ -285,7 +285,7 @@
  
          init_global = False