1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
########################################################
# couldn't implement
# do to ERROR in BiocManager::version()
# when repeating calls to different cache location
#########################################################
test_cache <- function(){
cache <- tempfile()
dir.create(cache)
ah <- AnnotationHub(cache=cache)
checkTrue(dir.exists(cache))
locfiles <- dir(cache)
checkTrue(file.exists(file.path(cache, "BiocFileCache.sqlite")))
checkTrue(any(endsWith(locfiles, "annotationhub.sqlite3")))
checkTrue(any(endsWith(locfiles, "hub_index.rds")))
temp <- AnnotationHub:::.create_cache(.class="AnnotationHub",
url=getAnnotationHubOpion("URL"),
cache=cache,
proxy=getAnnotationHubOption("PROXY"),
localHub=FALSE)
if (.Platform$OS.type == "windows"){
checkIdentical(normalizePath(hubCache(ah),winslash="/"), dirname(temp))
}else{
checkIdentical(hubCache(ah), dirname(temp))
}
bfc <- BiocFileCache(cache)
checkIdentical(length(bfc), 2L)
bfc2 <- AnnotationHub:::.get_cache(ah)
checkIdentical(bfc, bfc2)
removeCache(ah, ask=FALSE)
}
|