Running 'testthat.R' [3s/187s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(crimedata)
  > 
  > test_check("crimedata")
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  -- 1. Error: return value of get_crime_data is a tibble or SF object (@test_get_
  unknown input format
  1: expect_is(get_crime_data(), "tbl_df") at testthat/test_get_crime_data.R:4
  2: quasi_label(enquo(object), label, arg = "object")
  3: eval_bare(get_expr(quo), get_env(quo))
  4: get_crime_data()
  5: urls %>% purrr::transpose(.names = paste0(.$data_type, .$city, .$year)) %>% purrr::map(function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     }) %>% dplyr::bind_rows() %>% dplyr::arrange(.data$uid)
  6: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  7: eval(quote(`_fseq`(`_lhs`)), env, env)
  8: eval(quote(`_fseq`(`_lhs`)), env, env)
  9: `_fseq`(`_lhs`)
  10: freduce(value, `_function_list`)
  11: function_list[[i]](value)
  12: purrr::map(., function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     })
  13: .f(.x[[i]], ...)
  14: readRDS(temp_file)
  
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  -- 2. Error: partially missing data produce warnings (@test_get_crime_data.R#21)
  unknown input format
  1: expect_warning(get_crime_data(cities = "Virginia Beach", years = 2012:2013), "Data are not available for crimes in") at testthat/test_get_crime_data.R:21
  2: quasi_capture(enquo(object), label, capture_warnings)
  3: .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
  4: withCallingHandlers(code, warning = function(condition) {
         out$push(condition)
         invokeRestart("muffleWarning")
     })
  5: eval_bare(get_expr(.quo), get_env(.quo))
  6: get_crime_data(cities = "Virginia Beach", years = 2012:2013)
  7: urls %>% purrr::transpose(.names = paste0(.$data_type, .$city, .$year)) %>% purrr::map(function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     }) %>% dplyr::bind_rows() %>% dplyr::arrange(.data$uid)
  8: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  9: eval(quote(`_fseq`(`_lhs`)), env, env)
  10: eval(quote(`_fseq`(`_lhs`)), env, env)
  11: `_fseq`(`_lhs`)
  12: freduce(value, `_function_list`)
  13: function_list[[i]](value)
  14: purrr::map(., function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     })
  15: .f(.x[[i]], ...)
  16: readRDS(temp_file)
  
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  -- 3. Error: quiet execution does not return any messages (@test_get_crime_data.
  unknown input format
  1: expect_message(get_crime_data(quiet = TRUE), NA) at testthat/test_get_crime_data.R:28
  2: quasi_capture(enquo(object), label, capture_messages)
  3: .capture(act$val <- eval_bare(get_expr(.quo), get_env(.quo)), ...)
  4: withCallingHandlers(code, message = function(condition) {
         out$push(condition)
         invokeRestart("muffleMessage")
     })
  5: eval_bare(get_expr(.quo), get_env(.quo))
  6: get_crime_data(quiet = TRUE)
  7: urls %>% purrr::transpose(.names = paste0(.$data_type, .$city, .$year)) %>% purrr::map(function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     }) %>% dplyr::bind_rows() %>% dplyr::arrange(.data$uid)
  8: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  9: eval(quote(`_fseq`(`_lhs`)), env, env)
  10: eval(quote(`_fseq`(`_lhs`)), env, env)
  11: `_fseq`(`_lhs`)
  12: freduce(value, `_function_list`)
  13: function_list[[i]](value)
  14: purrr::map(., function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     })
  15: .f(.x[[i]], ...)
  16: readRDS(temp_file)
  
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  
    |                                                                            
    |                                                                      |   0%
    |                                                                            
    |======================================================================| 100%
  -- 4. Error: data cache works as expected (@test_get_crime_data.R#34)  ---------
  unknown input format
  1: get_crime_data(cities = "Detroit") at testthat/test_get_crime_data.R:34
  2: urls %>% purrr::transpose(.names = paste0(.$data_type, .$city, .$year)) %>% purrr::map(function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     }) %>% dplyr::bind_rows() %>% dplyr::arrange(.data$uid)
  3: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  4: eval(quote(`_fseq`(`_lhs`)), env, env)
  5: eval(quote(`_fseq`(`_lhs`)), env, env)
  6: `_fseq`(`_lhs`)
  7: freduce(value, `_function_list`)
  8: function_list[[i]](value)
  9: purrr::map(., function(x) {
         if (quiet == FALSE) {
             message("Downloading ", x[["data_type"]], " data for ", x[["city"]], " in ", 
                 x[["year"]], appendLF = TRUE)
         }
         temp_file <- tempfile(pattern = "code_data_", fileext = ".Rds")
         httr::GET(x[["file_url"]], progress(type = "down")) %>% httr::content(as = "raw") %>% 
             writeBin(temp_file)
         this_crime_data <- readRDS(temp_file)
         file.remove(temp_file)
         this_crime_data
     })
  10: .f(.x[[i]], ...)
  11: readRDS(temp_file)
  
  == testthat results  ===========================================================
  OK: 29 SKIPPED: 0 WARNINGS: 0 FAILED: 4
  1. Error: return value of get_crime_data is a tibble or SF object (@test_get_crime_data.R#4) 
  2. Error: partially missing data produce warnings (@test_get_crime_data.R#21) 
  3. Error: quiet execution does not return any messages (@test_get_crime_data.R#28) 
  4. Error: data cache works as expected (@test_get_crime_data.R#34) 
  
  Error: testthat unit tests failed
  Execution halted