Running ‘run-all.R’ [5s/10s]
  Running ‘test_help.R’ [1s/4s]
  Comparing ‘test_help.Rout’ to ‘test_help.Rout.save’ ... OK
  Running ‘test_version.R’ [1s/4s]
  Comparing ‘test_version.Rout’ to ‘test_version.Rout.save’ ... OK
Running the tests in ‘tests/run-all.R’ failed.
Complete output:
  > library("testthat")
  > 
  > test_check("argparse")
  Loading required package: argparse
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  argparse
   --- call from context --- 
  parser$parse_args()
   --- call from argument --- 
  if (grepl("^\\{", output)) {
      args <- jsonlite::fromJSON(paste(output, collapse = ""))
      return(args)
  } else {
      .print_message_and_exit(output, "version requested:")
  }
   --- R stacktrace ---
  where 1: parser$parse_args()
  where 2: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 3: withCallingHandlers({
      code
      NULL
  }, error = function(cnd) {
      if (can_entrace(cnd)) {
          cnd <- cnd_entrace(cnd)
      }
      return_from(env, cnd)
  })
  where 4: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 5: quasi_capture(enquo(object), label, capture_error, entrace = TRUE)
  where 6 at testthat/test-argparse.R#166: expect_error(parser$parse_args(), "Positional argument following keyword argument.")
  where 7: eval(code, test_env)
  where 8: eval(code, test_env)
  where 9: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 10: doTryCatch(return(expr), name, parentenv, handler)
  where 11: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 12: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 13: doTryCatch(return(expr), name, parentenv, handler)
  where 14: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 15: tryCatchList(expr, classes, parentenv, handlers)
  where 16: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 17: test_code(desc, code, env = parent.frame())
  where 18 at testthat/test-argparse.R#151: test_that("parse_args works as expected", {
      parser <- ArgumentParser(prog = "foobar", usage = "%(prog)s arg1 arg2")
      parser$add_argument("--hello", dest = "saying", action = "store", 
          default = "foo", choices = c("foo", "bar"), help = "%(prog)s's saying (default: %(default)s)")
      expect_equal(parser$parse_args("--hello=bar"), list(saying = "bar"))
      expect_error(parser$parse_args("--hello=what"))
      parser <- ArgumentParser()
      parser$add_argument("M", required = TRUE, help = "Test")
      expect_error(parser$parse_args(), "python error")
      parser <- ArgumentParser("positional_argument")
      expect_error(parser$parse_args(), "Positional argument following keyword argument.")
      p <- argparse::ArgumentParser()
      p$add_argument("--int", type = "integer")
      p$add_argument("--double", type = "double")
      p$add_argument("--character", type = "character")
      input <- "1"
      args <- p$parse_args(c("--int", input, "--double", input, 
          "--character", input))
      expect_equal(class(args$int), "integer")
      expect_equal(class(args$double), "numeric")
      expect_equal(class(args$character), "character")
      expect_equal(args$int, as.integer(1))
      expect_equal(args$double, 1)
      expect_equal(args$character, "1")
      skip_on_cran()
      parser <- ArgumentParser()
      parser$add_argument("--lotsofstuff", type = "character", 
          nargs = "+")
      args <- parser$parse_args(c("--lotsofstuff", rep("stuff", 
          1000)))
      expect_equal(args$lotsofstuff, rep("stuff", 1000))
  })
  where 19: eval(code, test_env)
  where 20: eval(code, test_env)
  where 21: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 22: doTryCatch(return(expr), name, parentenv, handler)
  where 23: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 24: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 25: doTryCatch(return(expr), name, parentenv, handler)
  where 26: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 27: tryCatchList(expr, classes, parentenv, handlers)
  where 28: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 29: test_code(NULL, exprs, env)
  where 30: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 31: force(code)
  where 32: doWithOneRestart(return(expr), restart)
  where 33: withOneRestart(expr, restarts[[1L]])
  where 34: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 35: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 36: FUN(X[[i]], ...)
  where 37: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 38: force(code)
  where 39: doWithOneRestart(return(expr), restart)
  where 40: withOneRestart(expr, restarts[[1L]])
  where 41: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 42: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 43: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 44: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 45: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 46: test_check("argparse")
  
   --- value of length: 4 type: logical ---
  [1] FALSE FALSE FALSE FALSE
   --- function from context --- 
  function (args = commandArgs(TRUE)) 
  {
      new_code <- c(sprintf("args = %s.parse_args([%s])", private$name, 
          paste(sprintf("'%s'", args), collapse = ", ")), "print(json.dumps(args.__dict__, sort_keys=True))")
      output <- private$python_code$run(new_code)
      if (grepl("^usage:", output[1])) {
          has_positional_arguments <- any(grepl("^positional arguments:", 
              output))
          has_optional_arguments <- any(grepl("^optional arguments:", 
              output))
          if (has_positional_arguments || has_optional_arguments) {
              .print_message_and_exit(output, "help requested:")
          }
          else {
              .stop(output, "parse error:")
          }
      }
      else if (grepl("^Traceback", output[1])) {
          .stop(output, "Error: python error")
      }
      else if (grepl("^SyntaxError: Non-ASCII character", output[2])) {
          message <- paste("Non-ASCII character detected.", "If you wish to use Unicode arguments/options", 
              "please upgrade to Python 3.2+", "Please see file INSTALL for more details.")
          .stop(message, "non-ascii character error:")
      }
      else if (grepl("^SyntaxError: positional argument follows keyword argument", 
          output[2]) || grepl("^SyntaxError: non-keyword arg after keyword arg", 
          output[2])) {
          message <- paste("Positional argument following keyword argument.", 
              "Please note ``ArgumentParser`` only accepts keyword arguments.")
          .stop(message, "syntax error:")
      }
      else if (grepl("^\\{", output)) {
          args <- jsonlite::fromJSON(paste(output, collapse = ""))
          return(args)
      }
      else {
          .print_message_and_exit(output, "version requested:")
      }
  }
  <environment: 0x56541468cac8>
   --- function search by body ---
   ----------- END OF FAILURE REPORT -------------- 
  ── 1. Failure: parse_args works as expected (@test-argparse.R#166)  ────────────
  `parser$parse_args()` threw an error with unexpected message.
  Expected match: "Positional argument following keyword argument."
  Actual message: "the condition has length > 1"
  Backtrace:
   1. testthat::expect_error(parser$parse_args(), "Positional argument following keyword argument.")
   6. parser$parse_args()
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 61 | SKIPPED: 5 | WARNINGS: 0 | FAILED: 1 ]
  1. Failure: parse_args works as expected (@test-argparse.R#166) 
  
  Error: testthat unit tests failed
  Execution halted