@@ -11,42 +11,55 @@ expect_length <- function(expr, len){
1111test_that(" basic Zotero search" , {
1212 # # if (httr::http_error("https://api.zotero.org/users"))
1313 # # skip("Couldn't connect to Zotero")
14- res <- ReadZotero(user = ' 1648676' ,
14+ try_again(5 ,
15+ {
16+ res <- ReadZotero(user = ' 1648676' ,
1517 .params = list (q = ' bayesian' ,
1618 key = ' 7lhgvcwVq60CDi7E68FyE3br' , limit = 2 ))
17- if (! length(res ))
18- skip(" Couldn't connect to Zotero" )
19- expect_length(res , 2L )
19+ if (! length(res ))
20+ skip(" Couldn't connect to Zotero" )
21+ expect_length(res , 2L )
22+ })
2023})
2124
2225test_that(" Search specific collection" , {
23- # # if (httr::http_error("https://api.zotero.org/users"))
26+ # # if (httr::http_error("https://api.zotero.org/users"))
2427 # # skip("Couldn't connect to Zotero")
25- Sys.sleep(2 )
26- res <- ReadZotero(user = ' 1648676' ,
28+ try_again(5 ,
29+ {
30+ Sys.sleep(2 )
31+ res <- ReadZotero(user = ' 1648676' ,
2732 .params = list (q = ' yu' , key = ' 7lhgvcwVq60CDi7E68FyE3br' ,
2833 collection = ' 3STEQRNU' ))
29- if (! length(res ))
30- skip(" Couldn't connect to Zotero" )
31- expect_length(res , 3L )
34+ if (! length(res ))
35+ skip(" Couldn't connect to Zotero" )
36+ expect_length(res , 3L )
37+ })
3238})
3339
3440test_that(" Search by tag" , {
35- # # Notice issue with how Zotero uses Techreport entry for arXiv manuscripts
36- # # if (httr::http_error("https://api.zotero.org/users"))
37- # # skip("Couldn't connect to Zotero")
38- Sys.sleep(2 )
39- BibOptions(check.entries = " error" )
40- res <- suppressMessages(ReadZotero(user = ' 1648676' ,
41- .params = list (key = ' 7lhgvcwVq60CDi7E68FyE3br' ,
42- tag = ' Statistics - Machine Learning' )))
43-
44- expect_length(res , 0L )
45- BibOptions(check.entries = FALSE )
46- res <- suppressMessages(ReadZotero(user = ' 1648676' ,
47- .params = list (key = ' 7lhgvcwVq60CDi7E68FyE3br' ,
48- tag = ' Statistics - Machine Learning' )))
49- if (! length(res ))
50- skip(" Couldn't connect to Zotero" )
51- expect_length(res , 10L )
41+ # # Notice issue with how Zotero uses Techreport entry for arXiv manuscripts
42+ # # if (httr::http_error("https://api.zotero.org/users"))
43+ # # skip("Couldn't connect to Zotero")
44+ try_again(5 ,
45+ {
46+ Sys.sleep(2 )
47+ BibOptions(check.entries = " error" )
48+ res <- suppressMessages(ReadZotero(user = ' 1648676' ,
49+ .params = list (key = ' 7lhgvcwVq60CDi7E68FyE3br' ,
50+ tag = ' Statistics - Machine Learning' )))
51+
52+ expect_length(res , 0L )
53+ })
54+
55+ try_again(5 ,
56+ {
57+ BibOptions(check.entries = FALSE )
58+ res <- suppressMessages(ReadZotero(user = ' 1648676' ,
59+ .params = list (key = ' 7lhgvcwVq60CDi7E68FyE3br' ,
60+ tag = ' Statistics - Machine Learning' )))
61+ if (! length(res ))
62+ skip(" Couldn't connect to Zotero" )
63+ expect_length(res , 10L )
64+ })
5265})
0 commit comments