ropensci / geojsonio

Convert many data formats to & from GeoJSON & TopoJSON
https://docs.ropensci.org/geojsonio
Other
150 stars 59 forks source link

test failures #175

Closed maelle closed 2 years ago

maelle commented 2 years ago

:wave: @sckott

==> devtools::test()

ℹ Loading geojsonio
Registered S3 method overwritten by 'geojson':
  method        from     
  print.geojson geojsonsf
ℹ Testing geojsonio
✓ | F W S  OK | Context
✓ |        23 | as.json [2.0s]                                      
✓ |         7 | as.location                                         
✓ |         9 | bounds                                              
✓ |         9 | centroid                                            
✓ |         8 | construction [0.6s]                                 
x | 2      75 | file_to_geojson [19.8s]                             
────────────────────────────────────────────────────────────────────
Failure (test-file_to_geojson.R:241:3): file_to_geojson fails well
`file_to_geojson()` threw an error with unexpected message.
Expected match: "argument \"input\" is missing"
Actual message: "l'argument \"input\" est manquant, avec aucune valeur par défaut"
Backtrace:
  1. testthat::expect_error(file_to_geojson(), "argument \"input\" is missing") test-file_to_geojson.R:241:2
  6. geojsonio::file_to_geojson()
  7. geojsonio::handle_remote(input) /home/maelle/Documents/ropensci/geojsonio/R/file_to_geojson.r:63:2
  8. geojsonio::is.url(x) /home/maelle/Documents/ropensci/geojsonio/R/file_to_geojson.r:185:2
  9. base::grepl("^(ftp|http)s?://", x) /home/maelle/Documents/ropensci/geojsonio/R/as.location.R:46:2
 10. base::is.factor(x)

Failure (test-file_to_geojson.R:242:3): file_to_geojson fails well
`file_to_geojson(file, method = "adfadf")` threw an error with unexpected message.
Expected match: "'arg' should be one of"
Actual message: "'arg' doit être un de “web”, “local”"
Backtrace:
 1. testthat::expect_error(...) test-file_to_geojson.R:242:2
 6. geojsonio::file_to_geojson(file, method = "adfadf")
 7. base::match.arg(method, choices = c("web", "local")) /home/maelle/Documents/ropensci/geojsonio/R/file_to_geojson.r:60:2
────────────────────────────────────────────────────────────────────
✓ |        35 | test-geo_topo.R [0.5s]                              
x | 1       8 | geojson_atomize [1.2s]                              
────────────────────────────────────────────────────────────────────
Failure (test-geojson_atomize.R:47:3): geojson_atomize fails well
`geojson_atomize()` threw an error with unexpected message.
Expected match: "argument \"x\" is missing"
Actual message: "l'argument \"x\" est manquant, avec aucune valeur par défaut"
Backtrace:
 1. testthat::expect_error(geojson_atomize(), "argument \"x\" is missing") test-geojson_atomize.R:47:2
 7. geojsonio::geojson_atomize.default() /home/maelle/Documents/ropensci/geojsonio/R/geojson_atomize.R:69:19
 8. base::stop("no 'geojson_atomize' method for ", class(x)) /home/maelle/Documents/ropensci/geojsonio/R/geojson_atomize.R:73:2
 9. base::.makeMessage(..., domain = domain)
────────────────────────────────────────────────────────────────────
✓ |        21 | geojson_json [7.2s]                                 
✓ |         9 | geojson_json precision [5.0s]                       
✓ |        21 | geojson_list                                        
✓ |        20 | geojson_read [0.3s]                                 
✓ |         6 | geojson_sf [1.6s]                                   
✓ |         5 | geojson_sp [1.6s]                                   
✓ |        23 | geojson_write [0.4s]                                
x | 8       0 | map_gist [1.9s]                                     
────────────────────────────────────────────────────────────────────
Error (test-map_gist.R:10:3): map_gist works with file inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(file = as.location(tfile), browse = FALSE) test-map_gist.R:10:2
 2. geojsonio::map_gist.location_(file = as.location(tfile), browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:312:2
 4. gistr:::gist_POST(...)
 5. gistr:::process(response)
 6. gistr:::stopstatus(x)

Error (test-map_gist.R:22:3): map_gist works with geo_list inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(res, browse = FALSE) test-map_gist.R:22:2
 2. geojsonio::map_gist.geo_list(res, browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. geojsonio::gistc(input, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:328:2
 4. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
 5. gistr:::gist_POST(...)
 6. gistr:::process(response)
 7. gistr:::stopstatus(x)

Error (test-map_gist.R:33:3): map_gist works with json inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(x, browse = FALSE) test-map_gist.R:33:2
 2. geojsonio::map_gist.json(x, browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. geojsonio::gistc(input, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:320:2
 4. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
 5. gistr:::gist_POST(...)
 6. gistr:::process(response)
 7. gistr:::stopstatus(x)

Error (test-map_gist.R:48:3): map_gist works with SpatialPoints inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(x, browse = FALSE) test-map_gist.R:48:2
 2. geojsonio::map_gist.SpatialPoints(x, browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. geojsonio::gistc(dat, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:176:2
 4. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
 5. gistr:::gist_POST(...)
 6. gistr:::process(response)
 7. gistr:::stopstatus(x)

Error (test-map_gist.R:63:3): map_gist works with SpatialPointsDataFrame inputs
Error: Not Found

Backtrace:
  1. geojsonio:::supw(map_gist(s, browse = FALSE)) test-map_gist.R:63:2
  5. geojsonio::map_gist.SpatialPointsDataFrame(s, browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
  6. geojsonio::gistc(input, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:186:2
  7. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
  8. gistr:::gist_POST(...)
  9. gistr:::process(response)
 10. gistr:::stopstatus(x)

Error (test-map_gist.R:79:3): map_gist works with SpatialPolygons inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(sp_poly, browse = FALSE) test-map_gist.R:79:2
 2. geojsonio::map_gist.SpatialPolygons(sp_poly, browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. geojsonio::gistc(input, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:194:2
 4. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
 5. gistr:::gist_POST(...)
 6. gistr:::process(response)
 7. gistr:::stopstatus(x)

Error (test-map_gist.R:90:3): map_gist works with data.frame inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(us_cities[1:50, ], browse = FALSE) test-map_gist.R:90:2
 2. geojsonio::map_gist.data.frame(us_cities[1:50, ], browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. geojsonio::gistc(input, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:294:2
 4. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
 5. gistr:::gist_POST(...)
 6. gistr:::process(response)
 7. gistr:::stopstatus(x)

Error (test-map_gist.R:99:3): map_gist works with data.frame inputs
Error: Not Found

Backtrace:
 1. geojsonio::map_gist(c(32.45, -99.74), browse = FALSE) test-map_gist.R:99:2
 2. geojsonio::map_gist.numeric(c(32.45, -99.74), browse = FALSE) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:166:2
 3. geojsonio::gistc(input, file, description, public, browse, ...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:285:2
 4. gistr::gist_create(...) /home/maelle/Documents/ropensci/geojsonio/R/mapgist.R:333:2
 5. gistr:::gist_POST(...)
 6. gistr:::process(response)
 7. gistr:::stopstatus(x)
────────────────────────────────────────────────────────────────────
Maximum number of failures exceeded; quitting at end of file.
Increase this number with (e.g.) `Sys.setenv('TESTTHAT_MAX_FAILS' = Inf)` 

══ Results ═════════════════════════════════════════════════════════
Duration: 42.3 s

[ FAIL 11 | WARN 0 | SKIP 0 | PASS 279 ]
══ Terminated early ════════════════════════════════════════════════

No one is perfect!

Some of those are false positives due to my laptop showing error messages in French. Maybe the others are due to auth?

sckott commented 2 years ago

thanks i'll have a look

sckott commented 2 years ago

@maelle Looks like its just map_gist tests that are not working for you. can you run the map_gist tests line by line, and do traceback or so to see where the error is coming from.

i tried unsetting github_pat and that doesn't reproduce this, neither does setting github_pat to an invalid string

maelle commented 2 years ago

I see

library("geojsonio")
#> Registered S3 method overwritten by 'geojsonsf':
#>   method        from   
#>   print.geojson geojson
#> 
#> Attachement du package : 'geojsonio'
#> L'objet suivant est masqué depuis 'package:base':
#> 
#>     pretty
tfile <- tempfile(fileext = ".geojson")
geojson_write(us_cities[1:20, ], lat='lat', lon='long', file = tfile)
#> Success! File is at /tmp/Rtmp4mWKbY/file441346cfe15c.geojson
#> <geojson-file>
#>   Path:       /tmp/Rtmp4mWKbY/file441346cfe15c.geojson
#>   From class: data.frame
a <- map_gist(file=as.location(tfile), browse = FALSE)
#> Error: Not Found

Created on 2022-01-03 by the reprex package (v2.0.1)

maelle commented 2 years ago

This was a PAT scope problem :woman_facepalming:

sckott commented 2 years ago

nice job figuring it out!

github-actions[bot] commented 2 years ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.