devtools/testlib.py
branchstable
changeset 4689 4eb1f4490538
parent 4681 5f72584ab1d7
child 4690 0cfb6b63f90b
equal deleted inserted replaced
4688:6ea3a3b21c6a 4689:4eb1f4490538
    64     else:
    64     else:
    65         protected_entities = yams.schema.BASE_TYPES.union(SYSTEM_ENTITIES)
    65         protected_entities = yams.schema.BASE_TYPES.union(SYSTEM_ENTITIES)
    66     return set(schema.entities()) - protected_entities
    66     return set(schema.entities()) - protected_entities
    67 
    67 
    68 
    68 
    69 def get_versions(self, checkversions=False):
    69 def refresh_repo(repo, resetschema=False, resetvreg=False):
    70     """return the a dictionary containing cubes used by this instance
       
    71     as key with their version as value, including cubicweb version. This is a
       
    72     public method, not requiring a session id.
       
    73 
       
    74     replace Repository.get_versions by this method if you want to get versions
       
    75     from code instead of from the database
       
    76     """
       
    77     vcconf = {'cubicweb': self.config.cubicweb_version()}
       
    78     self.config.bootstrap_cubes()
       
    79     for pk in self.config.cubes():
       
    80         version = self.config.cube_version(pk)
       
    81         vcconf[pk] = version
       
    82     self.config._cubes = None
       
    83     return vcconf
       
    84 
       
    85 
       
    86 def refresh_repo(repo):
       
    87     devtools.reset_test_database(repo.config)
    70     devtools.reset_test_database(repo.config)
    88     for pool in repo.pools:
    71     for pool in repo.pools:
    89         pool.reconnect()
    72         pool.reconnect()
    90     repo._type_source_cache = {}
    73     repo._type_source_cache = {}
    91     repo._extid_cache = {}
    74     repo._extid_cache = {}