def test_push_invalidates_cache_hg(self): key = CacheInvalidation.query().filter(CacheInvalidation.cache_key ==HG_REPO).one() key.cache_active = True Session().add(key) Session().commit() DEST = _get_tmp_dir() clone_url = _construct_url(HG_REPO, dest=DEST) stdout, stderr = Command('/tmp').execute('hg clone', clone_url) stdout, stderr = _add_files_and_push('hg', DEST, files_no=1) key = CacheInvalidation.query().filter(CacheInvalidation.cache_key ==HG_REPO).one() self.assertEqual(key.cache_active, False)
def test_push_invalidates_cache_hg(self): key = CacheInvalidation.query().filter( CacheInvalidation.cache_key == HG_REPO).one() key.cache_active = True Session().add(key) Session().commit() DEST = _get_tmp_dir() clone_url = _construct_url(HG_REPO, dest=DEST) stdout, stderr = Command('/tmp').execute('hg clone', clone_url) stdout, stderr = _add_files_and_push('hg', DEST, files_no=1) key = CacheInvalidation.query().filter( CacheInvalidation.cache_key == HG_REPO).one() self.assertEqual(key.cache_active, False)
def command(self): #get SqlAlchemy session self._init_session() _caches = CacheInvalidation.query().order_by(CacheInvalidation.cache_key).all() if self.options.show: for c_obj in _caches: print 'key:%s active:%s' % (c_obj.cache_key, c_obj.cache_active) elif self.options.cleanup: for c_obj in _caches: Session().delete(c_obj) print 'removing key:%s' % (c_obj.cache_key) Session().commit() else: print 'nothing done exiting...' sys.exit(0)
def command(self): #get SqlAlchemy session self._init_session() _caches = CacheInvalidation.query().order_by( CacheInvalidation.cache_key).all() if self.options.show: for c_obj in _caches: print 'key:%s active:%s' % (c_obj.cache_key, c_obj.cache_active) elif self.options.cleanup: for c_obj in _caches: Session().delete(c_obj) print 'removing key:%s' % (c_obj.cache_key) Session().commit() else: print 'nothing done exiting...' sys.exit(0)