# HG changeset patch # User Sylvain Thénault # Date 1284121958 -7200 # Node ID d3dea5f844042d6a8ba8e3db6bf938122196ec34 # Parent 30f6e9d2addc062d89cb9b503238fd072c8cf319 [test] during some tests (unittest_migrations), we should not register ClearGroupMap which is actually already there diff -r 30f6e9d2addc -r d3dea5f84404 server/migractions.py --- a/server/migractions.py Fri Sep 10 14:31:42 2010 +0200 +++ b/server/migractions.py Fri Sep 10 14:32:38 2010 +0200 @@ -93,16 +93,19 @@ self.repo_connect() # no config on shell to a remote instance if config is not None and (cnx or connect): + repo = self.repo self.session.data['rebuild-infered'] = False # register a hook to clear our group_mapping cache and the # self._synchronized set when some group is added or updated ClearGroupMap.mih = self - self.repo.vreg.register(ClearGroupMap) - CW_EVENT_MANAGER.bind('after-registry-reload', - self.repo.vreg.register, ClearGroupMap) + # may be already registered in tests (e.g. unittest_migractions) + if not ClearGroupMap.__regid__ in repo.vreg['after_add_entity_hooks']: + repo.vreg.register(ClearGroupMap) + CW_EVENT_MANAGER.bind('after-registry-reload', + repo.vreg.register, ClearGroupMap) # notify we're starting maintenance (called instead of server_start # which is called on regular start - self.repo.hm.call_hooks('server_maintenance', repo=self.repo) + repo.hm.call_hooks('server_maintenance', repo=repo) if not schema and not getattr(config, 'quick_start', False): schema = config.load_schema(expand_cubes=True) self.fs_schema = schema