def tearDown(self): """ Cleans up after tests. """ self._tear_down_called = True try: sgtk.set_authenticated_user(self._authenticated_user) # get rid of path cache from local ~/.shotgun storage if self._do_io: pc = path_cache.PathCache(self.tk) path_cache_file = pc._get_path_cache_location() pc.close() if os.path.exists(path_cache_file): os.remove(path_cache_file) # get rid of init cache if os.path.exists(pipelineconfig_factory._get_cache_location()): os.remove(pipelineconfig_factory._get_cache_location()) # move project scaffold out of the way self._move_project_data() # important to delete this to free memory self.tk = None # clear global shotgun accessor tank.util.shotgun.connection._g_sg_cached_connections = threading.local() finally: if self._old_shotgun_home is not None: os.environ[self.SHOTGUN_HOME] = self._old_shotgun_home else: del os.environ[self.SHOTGUN_HOME]
def tearDown(self): """ Cleans up after tests. """ try: sgtk.set_authenticated_user(self._authenticated_user) # get rid of path cache from local ~/.shotgun storage pc = path_cache.PathCache(self.tk) path_cache_file = pc._get_path_cache_location() pc.close() if os.path.exists(path_cache_file): os.remove(path_cache_file) # clear global shotgun accessor tank.util.shotgun._g_sg_cached_connections = threading.local() # get rid of init cache if os.path.exists(pipelineconfig_factory._get_cache_location()): os.remove(pipelineconfig_factory._get_cache_location()) # move project scaffold out of the way self._move_project_data() # important to delete this to free memory self.tk = None finally: if self._old_shotgun_home is not None: os.environ[self.SHOTGUN_HOME] = self._old_shotgun_home else: del os.environ[self.SHOTGUN_HOME]