Beispiel #1
0
    def setUp(self):
      '''Sets up the fixture. Do not override,
         use the hooks instead.
      '''
      from Products.CMFActivity.ActivityRuntimeEnvironment import BaseMessage
      # Activities in unit tests shall never fail.
      # Let's be a litte tolerant for the moment.
      BaseMessage.max_retry = property(lambda self:
        self.activity_kw.get('max_retry', 1))

      template_list = list(self.getBusinessTemplateList())
      erp5_catalog_storage = os.environ.get('erp5_catalog_storage',
                                            'erp5_mysql_innodb_catalog')
      update_business_templates = os.environ.get('update_business_templates') is not None
      erp5_load_data_fs = int(os.environ.get('erp5_load_data_fs', 0))
      if update_business_templates and erp5_load_data_fs:
        update_only = os.environ.get('update_only', None)
        template_list[:0] = (erp5_catalog_storage, 'erp5_property_sheets',
                             'erp5_core', 'erp5_xhtml_style')
        # Update only specified business templates, regular expression
        # can be used.
        if update_only is not None:
          update_only_list = update_only.split(',')
          matching_template_list = []
          # First parse the template list in order to keep same order
          for business_template in template_list:
            for expression in update_only_list:
              if re.search(expression, business_template):
                matching_template_list.append(business_template)
          template_list = matching_template_list

      # keep a mapping type info name -> property sheet list, to remove them in
      # tear down.
      self._added_property_sheets = {}
      light_install = self.enableLightInstall()
      create_activities = self.enableActivityTool()
      hot_reindexing = self.enableHotReindexing()
      for x, y in (("erp5_core_proxy_field_legacy", "erp5_base"),
                   ("erp5_stock_cache", "erp5_pdm")):
        if x not in template_list:
          try:
            template_list.insert(template_list.index(y), x)
          except ValueError:
            pass
      self.setUpERP5Site(business_template_list=template_list,
                         light_install=light_install,
                         create_activities=create_activities,
                         quiet=install_bt5_quiet,
                         hot_reindexing=hot_reindexing,
                         erp5_catalog_storage=erp5_catalog_storage)
      PortalTestCase.setUp(self)