Skip to content

Commit 1c1eba5

Browse files
committed
added skip_on_ci()s
1 parent aae887d commit 1c1eba5

10 files changed

+44
-0
lines changed

tests/testthat/test-api-bugs.R

+9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ test_that("there is case sensitivity on string equals", {
8080

8181
test_that("string vs text operators behave differently", {
8282
skip_on_cran()
83+
skip_on_ci()
8384

8485
# # reported to the API team PVS-1147
8586
query <- qry_funs$begins(assignee_organization = "johnson")
@@ -161,6 +162,7 @@ eps <- (get_endpoints())
161162

162163
test_that("We can call all the legitimate HATEOAS endpoints", {
163164
skip_on_cran()
165+
skip_on_ci()
164166

165167
# these currently throw Error: Internal Server Error
166168
broken_single_item_queries <- c(
@@ -182,6 +184,7 @@ test_that("We can call all the legitimate HATEOAS endpoints", {
182184

183185
test_that("individual fields are still broken", {
184186
skip_on_cran()
187+
skip_on_ci()
185188

186189
# Sample fields that cause 500 errors when requested by themselves.
187190
# Some don't throw errors when included in get_fields() but they do if
@@ -207,6 +210,7 @@ test_that("individual fields are still broken", {
207210

208211
test_that("we can't sort by all fields", {
209212
skip_on_cran()
213+
skip_on_ci()
210214

211215
# PVS-1377
212216
sorts_to_try <- c(
@@ -250,6 +254,7 @@ test_that("we can't sort by all fields", {
250254

251255
test_that("withdrawn patents are still present in the database", {
252256
skip_on_cran()
257+
skip_on_ci()
253258

254259
# PVS-1342 Underlying data issues
255260
# There are 8,000 patents that were in the bulk xml files patentsiew is based on.
@@ -271,6 +276,7 @@ test_that("withdrawn patents are still present in the database", {
271276

272277
test_that("missing patents are still missing", {
273278
skip_on_cran()
279+
skip_on_ci()
274280

275281
# PVS-1342 Underlying data issues
276282
# There are around 300 patents that aren't in the bulk xml files patentsiew is based on.
@@ -291,6 +297,7 @@ test_that("missing patents are still missing", {
291297

292298
test_that("we can't explicitly request assignee_ or inventor_years.num_patents", {
293299
skip_on_cran()
300+
skip_on_ci()
294301

295302
bad_eps <- c(
296303
"assignee", # Invalid field: assignee_years.num_patents. assignee_years is not a nested field
@@ -313,6 +320,7 @@ test_that("we can't explicitly request assignee_ or inventor_years.num_patents",
313320

314321
test_that("uspcs aren't right", {
315322
skip_on_cran()
323+
skip_on_ci()
316324

317325
# PVS-1615
318326

@@ -333,6 +341,7 @@ test_that("uspcs aren't right", {
333341

334342
test_that("endpoints are still broken", {
335343
skip_on_cran()
344+
skip_on_ci()
336345
# this will fail when the api is fixed
337346

338347
broken_endpoints <- c(

tests/testthat/test-cast-pv-data.R

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("cast_pv_data casts patent fields as expected", {
22
skip_on_cran()
3+
skip_on_ci()
34

45
pv_out <- search_pv(
56
query = '{"patent_id":"5116621"}', fields = get_fields("patent")
@@ -58,6 +59,7 @@ test_that("cast_pv_data casts assignee fields as expected", {
5859

5960
test_that("we can cast a bool", {
6061
skip_on_cran()
62+
skip_on_ci()
6163

6264
# TODO(any): remove when the API returns this as a boolean
6365
fields <- c("rule_47_flag")

tests/testthat/test-check-query.R

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
test_that("errors are thrown on invalid queries", {
33
skip_on_cran()
4+
skip_on_ci()
45

56
expect_error(
67
search_pv(qry_funs$eq("shoe_size" = 11.5)),
@@ -66,6 +67,7 @@ test_that("errors are thrown on invalid queries", {
6667

6768
test_that("a valid nested field can be queried", {
6869
skip_on_cran()
70+
skip_on_ci()
6971

7072
results <- search_pv(qry_funs$eq("application.rule_47_flag" = FALSE))
7173

@@ -74,6 +76,7 @@ test_that("a valid nested field can be queried", {
7476

7577
test_that("the _eq message is thrown when appropriate", {
7678
skip_on_cran()
79+
skip_on_ci()
7780

7881
expect_message(
7982
search_pv(list(patent_date = "2007-03-06")),
@@ -83,6 +86,7 @@ test_that("the _eq message is thrown when appropriate", {
8386

8487
test_that("a query with an and operator returns results", {
8588
skip_on_cran()
89+
skip_on_ci()
8690

8791
patents_query <-
8892
with_qfuns(

tests/testthat/test-get-fields.R

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("get_fields works as expected", {
22
skip_on_cran()
3+
skip_on_ci()
34

45
expect_error(
56
get_fields("bogus endpoint"),
@@ -23,6 +24,7 @@ test_that("get_fields works as expected", {
2324

2425
test_that("the endpoints are stable", {
2526
skip_on_cran()
27+
skip_on_ci()
2628

2729
# quick check of the endpoints - useful after an api update. We run fieldsdf.R
2830
# and do a build. This test would fail if an endpoint was added, moved or deleted

tests/testthat/test-print.R

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("We can print the returns from all endpoints ", {
22
skip_on_cran()
3+
skip_on_ci()
34

45
eps <- get_endpoints()
56
bad_eps <- c("cpc_subclass", "uspc_subclass", "uspc_mainclass", "wipo")
@@ -20,6 +21,7 @@ test_that("We can print the returns from all endpoints ", {
2021

2122
test_that("we can print a query, its request, and unnested data", {
2223
skip_on_cran()
24+
skip_on_ci()
2325

2426
x <- "patent"
2527
q <- qry_funs$eq(patent_id = "11530080")

tests/testthat/test-query-dsl.R

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("between works as expected", {
22
skip_on_cran()
3+
skip_on_ci()
34

45
query <- qry_funs$in_range(patent_date = c("1976-01-06", "1976-01-13"))
56

@@ -10,6 +11,7 @@ test_that("between works as expected", {
1011

1112
test_that("with_qfuns() works as advertised", {
1213
skip_on_cran() # wouldn't necessarily have to skip!
14+
skip_on_ci() # wouldn't necessarily have to skip!
1315

1416
a <- with_qfuns(
1517
and(
@@ -28,6 +30,7 @@ test_that("with_qfuns() works as advertised", {
2830

2931
test_that("argument check works on in_range", {
3032
skip_on_cran() # wouldn't necessarily have to skip!
33+
skip_on_ci() # wouldn't necessarily have to skip!
3134

3235
expect_error(
3336
qq <- qry_funs$in_range("patent_id", c("10000000", "10000002")),

tests/testthat/test-search-pv.R

+17
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ endpoints <- get_endpoints()
77

88
test_that("API returns expected df names for all endpoints", {
99
skip_on_cran()
10+
skip_on_ci()
1011

1112
broken_endpoints <- c(
1213
"cpc_subclass",
@@ -36,6 +37,7 @@ test_that("API returns expected df names for all endpoints", {
3637

3738
test_that("DSL-based query returns expected results", {
3839
skip_on_cran()
40+
skip_on_ci()
3941

4042
query <- with_qfuns(
4143
and(
@@ -52,6 +54,7 @@ test_that("DSL-based query returns expected results", {
5254

5355
test_that("You can download up to 9,000+ records", {
5456
skip_on_cran()
57+
skip_on_ci()
5558

5659
# Should return 9,000+ rows
5760
query <- with_qfuns(
@@ -66,6 +69,7 @@ test_that("You can download up to 9,000+ records", {
6669

6770
test_that("search_pv can pull all fields for all endpoints", {
6871
skip_on_cran()
72+
skip_on_ci()
6973

7074
troubled_endpoints <- c(
7175
"cpc_subclass", "location",
@@ -87,6 +91,7 @@ test_that("search_pv can pull all fields for all endpoints", {
8791

8892
test_that("Sort option works as expected", {
8993
skip_on_cran()
94+
skip_on_ci()
9095

9196
out <- search_pv(
9297
qry_funs$neq(assignee_id = ""),
@@ -101,6 +106,7 @@ test_that("Sort option works as expected", {
101106

102107
test_that("search_pv properly URL encodes queries", {
103108
skip_on_cran()
109+
skip_on_ci()
104110

105111
# Covers https://github.com/ropensci/patentsview/issues/24
106112
# need to use the assignee endpoint now
@@ -129,6 +135,7 @@ test_that("search_pv properly URL encodes queries", {
129135

130136
test_that("We won't expose the user's patentsview API key to random websites", {
131137
skip_on_cran()
138+
skip_on_ci()
132139

133140
# We will try to call the api that tells us who is currently in space
134141
in_space_now_url <- "http://api.open-notify.org/astros.json"
@@ -138,6 +145,7 @@ test_that("We won't expose the user's patentsview API key to random websites", {
138145

139146
test_that("We can call all the legitimate HATEOAS endpoints", {
140147
skip_on_cran()
148+
skip_on_ci()
141149

142150
single_item_queries <- c(
143151
"cpc_subclass/A01B/",
@@ -207,6 +215,7 @@ test_that("We can call all the legitimate HATEOAS endpoints", {
207215

208216
test_that("posts and gets return the same data", {
209217
skip_on_cran()
218+
skip_on_ci()
210219

211220
bad_eps <- c(
212221
"cpc_subclass"
@@ -247,6 +256,7 @@ test_that("posts and gets return the same data", {
247256

248257
test_that("nested shorthand produces the same results as fully qualified ones", {
249258
skip_on_cran()
259+
skip_on_ci()
250260

251261
# the API now allows a shorthand in the fields/f: parameter
252262
# just the group name will retrieve all that group's attributes
@@ -264,6 +274,7 @@ test_that("nested shorthand produces the same results as fully qualified ones",
264274

265275
test_that("the 'after' parameter works properly", {
266276
skip_on_cran()
277+
skip_on_ci()
267278

268279
sort <- c("patent_id" = "asc")
269280
big_query <- qry_funs$eq(patent_date = "2000-01-04") # 3003 total_hits
@@ -300,6 +311,7 @@ test_that("the 'after' parameter works properly", {
300311

301312
test_that("the documentation and Swagger UI URLs work properly", {
302313
skip_on_cran()
314+
skip_on_ci()
303315

304316
documentation_url <-
305317
'https://search.patentsview.org/api/v1/patent/?q={"_text_any":{"patent_title":"COBOL cotton gin"}}&s=[{"patent_id": "asc" }]&o={"size":50}&f=["inventors.inventor_name_last","patent_id","patent_date","patent_title"]'
@@ -316,6 +328,7 @@ test_that("the documentation and Swagger UI URLs work properly", {
316328

317329
test_that("an error occurs if all_pages is TRUE and there aren't any results", {
318330
skip_on_cran()
331+
skip_on_ci()
319332

320333
too_early <- qry_funs$lt(patent_date = "1976-01-01")
321334

@@ -332,6 +345,7 @@ test_that("an error occurs if all_pages is TRUE and there aren't any results", {
332345

333346
test_that("we can retrieve all_pages = TRUE without specifiying fields", {
334347
skip_on_cran()
348+
skip_on_ci()
335349

336350
query <- qry_funs$eq(patent_date = "1976-01-06")
337351
sort <- c("patent_type" = "asc", "patent_id" = "asc")
@@ -348,6 +362,7 @@ test_that("we can retrieve all_pages = TRUE without specifiying fields", {
348362
# the two responses match, then we've correctly handled throttling errors.
349363
test_that("Throttled requests are automatically retried", {
350364
skip_on_cran()
365+
skip_on_ci()
351366

352367
res <- search_pv('{"_gte":{"patent_date":"2007-01-04"}}', size = 50)
353368
patent_ids <- res$data$patents$patent_id
@@ -421,6 +436,7 @@ test_that("Throttled requests are automatically retried", {
421436

422437
test_that("we can sort on an unrequested field across page boundaries", {
423438
skip_on_cran()
439+
skip_on_ci()
424440

425441
# total_hits = 5,352
426442
query <- qry_funs$in_range(patent_date = c("1976-01-01", "1976-01-31"))
@@ -451,6 +467,7 @@ test_that("we can sort on an unrequested field across page boundaries", {
451467

452468
test_that("sort works across page boundaries", {
453469
skip_on_cran()
470+
skip_on_ci()
454471

455472
sort <- c("patent_type" = "desc", "patent_id" = "desc")
456473
results <- search_pv(

tests/testthat/test-unnest-pv-data.R

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ eps <- get_endpoints()
22

33
test_that("we can unnest all entities", {
44
skip_on_cran()
5+
skip_on_ci()
56

67
# TODO(any): add back fields = get_fields(x)
78
# API throws 500s if some nested fields are included
@@ -48,6 +49,7 @@ test_that("we can unnest all entities", {
4849

4950
test_that("endpoint's pks match their entity's pks", {
5051
skip_on_cran()
52+
skip_on_ci()
5153

5254
# the overloaded_entities endpoints return the same entity, rel_app_texts,
5355
# so we can't determine the endpoint from the entity like we can

tests/testthat/test-utils.R

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
test_that("we can cast the endpoints that return the same entity", {
22
skip_on_cran()
3+
skip_on_ci()
34

45
endpoints <- c("patent/rel_app_text", "publication/rel_app_text")
56

tests/testthat/test-validate-args.R

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
test_that("validate_args throws errors for all bad args", {
66
skip_on_cran()
7+
skip_on_ci()
78

89
# requesting the old plural endpoint should now throw an error
910
expect_error(
@@ -65,6 +66,7 @@ test_that("validate_args throws errors for all bad args", {
6566

6667
test_that("group names can be requested as fields via new API shorthand", {
6768
skip_on_cran()
69+
skip_on_ci()
6870

6971
endpoint <- "patent"
7072
shorthand <- get_fields("patent", groups=c("application"))

0 commit comments

Comments
 (0)