Skip to content

Clean up tests outputs/prints/messages/etc #284

@bms63

Description

@bms63

Testthat produces a lot of noise which make it hard to parse out problems. could we look at reducing the artifacts being spit out here? @kodesiba, @parmsam-pfizer, @nicholas-masel do you all see the same thing when running logrx tests

=> devtools::test()

ℹ Testing logrx
✔ | F W S OK | Context
⠏ | 0 | axecute [1] "hello logrx"
⠹ | 3 | axecute hello logrx
⠸ | 14 | axecute hello logrx
⠇ | 19 | axecute hello logrx
⠏ | 20 | axecute hello logrx
⠹ | 23 | axecute hello logrx
this is output
Warning: closing unused connection 4 (/tmp/RtmpREIYgA/log_out_nested.Rds)
⠧ | 28 | axecute hello logrx
⠋ | 31 | axecute hello logrx
⠼ | 35 | axecute

processing file: ex1.Rmd
1/7
2/7 [cars]
3/7
4/7 [pressure]
5/7
6/7 [unnamed-chunk-1]
7/7
[1] "print"
output file: ex1.knit.md

/usr/lib/rstudio-server/bin/quarto/bin/tools/x86_64/pandoc +RTS -K512m -RTS ex1.knit.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output ex1.html --lua-filter /cloud/lib/x86_64-pc-linux-gnu-library/4.2/rmarkdown/rmarkdown/lua/pagebreak.lua --lua-filter /cloud/lib/x86_64-pc-linux-gnu-library/4.2/rmarkdown/rmarkdown/lua/latex-div.lua --lua-filter /cloud/lib/x86_64-pc-linux-gnu-library/4.2/rmarkdown/rmarkdown/lua/table-classes.lua --embed-resources --standalone --variable bs3=TRUE --section-divs --template /cloud/lib/x86_64-pc-linux-gnu-library/4.2/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable theme=bootstrap --mathjax --variable 'mathjax-url=https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' --include-in-header /tmp/RtmpREIYgA/rmarkdown-str20fb4679b1ee.html

Output created: ex1.html

processing file: ref/ex1.Rmd
1/7
2/7 [cars]
3/7
4/7 [pressure]
5/7
6/7 [unnamed-chunk-1]
7/7
output file: /tmp/RtmpREIYgA/file20fb63d12062.R

✔ | 46 | axecute [10.8s]
⠇ | 9 | get Rows: 3
Columns: 2
$ cyl 4, 6, 8
$ mean 26.66364, 19.74286, 15.10000
⠋ | 11 | get [1] "hello logrx"
Error: ref/ex4.R:5:0: unexpected end of input
3:
4: print("hello logrx"
^
⠼ | 15 | get [1] 1
⠧ | 18 | get [1] 1

processing file: ref/ex1.Rmd
1/7
2/7 [cars]
3/7
4/7 [pressure]
5/7
6/7 [unnamed-chunk-1]
7/7
output file: /tmp/RtmpREIYgA/file20fb28e71d07.R

[1] "print"
✔ | 21 | get [3.7s]
⠏ | 0 | interact [1] "log print"
[1] "log print 2"
log catlog cat 2log inform
log inform 2
log message
log message 2
⠋ | 3 8 | interact Error: log error
⠦ | 4 13 | interact
Attaching package: 'magrittr'

The following object is masked from 'package:logrx':

set_names

The following objects are masked from 'package:testthat':

equals, is_less_than, not

✔ | 4 18 | interact [2.1s]
─────────────────────────────────────────────────────────────────────────
Warning (test-interact.R:85:3): setting log name works
log_path already assigned, will not be overwritten
Backtrace:

  1. ├─testthat::expect_warning(set_log_name_path(log_name = "test_log_name2")) at test-interact.R:85:3
  2. │ └─testthat:::expect_condition_matching(...)
  3. │ └─testthat:::quasi_capture(...)
  4. │ ├─testthat (local) .capture(...)
  5. │ │ └─base::withCallingHandlers(...)
  6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  7. └─logrx:::set_log_name_path(log_name = "test_log_name2")

Warning (test-interact.R:113:3): setting path name works
log_path already assigned, will not be overwritten
Backtrace:

  1. ├─testthat::expect_warning(set_log_name_path(log_path = ".")) at test-interact.R:113:3
  2. │ └─testthat:::expect_condition_matching(...)
  3. │ └─testthat:::quasi_capture(...)
  4. │ ├─testthat (local) .capture(...)
  5. │ │ └─base::withCallingHandlers(...)
  6. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  7. └─logrx:::set_log_name_path(log_path = ".")

Warning (test-interact.R:123:3): run_safely_loudly works for warnings, errors, messages, and output
log warning
Backtrace:

  1. └─logrx:::run_safely_loudly(fp) at test-interact.R:123:3
  2. ├─logrx:::loudly(run_safely(file)) at project/R/interact.R:152:3
  3. │ └─base::withCallingHandlers(code, warning = wHandler, message = mHandler) at project/R/utils-execution.R:31:3
  4. └─purrr (local) run_safely(file) at project/R/utils-execution.R:31:3
  5. ├─purrr:::capture_error(.f(...), otherwise, quiet)
    
  6. │ └─base::tryCatch(...)
    
  7. │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  8. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  9. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  10. └─logrx (local) .f(...)
    
  11.   └─base::source(file, local = exec_env) at project/R/interact.R:136:5
    
  12.     ├─base::withVisible(eval(ei, envir))
    
  13.     └─base::eval(ei, envir)
    
  14.       └─base::eval(ei, envir)
    

Warning (test-interact.R:123:3): run_safely_loudly works for warnings, errors, messages, and output
log warning2
Backtrace:

  1. └─logrx:::run_safely_loudly(fp) at test-interact.R:123:3
  2. ├─logrx:::loudly(run_safely(file)) at project/R/interact.R:152:3
  3. │ └─base::withCallingHandlers(code, warning = wHandler, message = mHandler) at project/R/utils-execution.R:31:3
  4. └─purrr (local) run_safely(file) at project/R/utils-execution.R:31:3
  5. ├─purrr:::capture_error(.f(...), otherwise, quiet)
    
  6. │ └─base::tryCatch(...)
    
  7. │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  8. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  9. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  10. └─logrx (local) .f(...)
    
  11.   └─base::source(file, local = exec_env) at project/R/interact.R:136:5
    
  12.     ├─base::withVisible(eval(ei, envir))
    
  13.     └─base::eval(ei, envir)
    
  14.       └─base::eval(ei, envir)
    

─────────────────────────────────────────────────────────────────────────
⠹ | 3 | log Removing existing log.rx environment and proceeding...

A log.rx environment already exists and cannot be used for a new execution.

This typically happens when:

  • A previous logrx execution did not complete properly
  • The log.rx environment was not cleaned up after a previous run

To resolve this issue, you have the following options:

  1. Allow logrx to remove the environment and proceed with execution
  2. Manually remove the environment using log_remove() or restart your R session

⠋ | 11 | log
A log.rx environment already exists and cannot be used for a new execution.

This typically happens when:

  • A previous logrx execution did not complete properly
  • The log.rx environment was not cleaned up after a previous run

To resolve this issue, you have the following options:

  1. Allow logrx to remove the environment and proceed with execution
  2. Manually remove the environment using log_remove() or restart your R session

A log.rx environment already exists and cannot be used for a new execution.

This typically happens when:

  • A previous logrx execution did not complete properly
  • The log.rx environment was not cleaned up after a previous run

To resolve this issue, you have the following options:

  1. Allow logrx to remove the environment and proceed with execution
  2. Manually remove the environment using log_remove() or restart your R session

A log.rx environment already exists and cannot be used for a new execution.

This typically happens when:

  • A previous logrx execution did not complete properly
  • The log.rx environment was not cleaned up after a previous run

To resolve this issue, you have the following options:

  1. Allow logrx to remove the environment and proceed with execution
  2. Manually remove the environment using log_remove() or restart your R session

A log.rx environment already exists and cannot be used for a new execution.

This typically happens when:

  • A previous logrx execution did not complete properly
  • The log.rx environment was not cleaned up after a previous run

To resolve this issue, you have the following options:

  1. Allow logrx to remove the environment and proceed with execution
  2. Manually remove the environment using log_remove() or restart your R session

Removing existing log.rx environment and proceeding...
✔ | 19 | log [1.3s]
⠋ | 1 | parse [1] "hello logrx"
✔ | 1 6 | parse [1.3s]
─────────────────────────────────────────────────────────────────────────
Warning (test-parse.R:15:3): read_log_file will parse a logrx log file and create the necessary object
5 parsing failures.
row col expected actual file
27 -- 7 columns 5 columns literal data
68 -- 7 columns 2 columns literal data
69 -- 7 columns 2 columns literal data
70 -- 7 columns 2 columns literal data
72 -- 7 columns 6 columns literal data

Backtrace:

  1. ├─logrx::read_log_file(filePath) at test-parse.R:15:3
  2. │ └─flines %>% reformat_subsections() %>% nest_log() %>% ... at project/R/read_log_file.R:328:3
  3. ├─logrx:::parse_log(.)
  4. │ └─... %>% readr::read_table(skip = 1, col_names = FALSE) at project/R/read_log_file.R:194:5
  5. └─readr::read_table(., skip = 1, col_names = FALSE)
  6. └─readr:::read_delimited(...)
  7. └─readr:::warn_problems(out)
    

─────────────────────────────────────────────────────────────────────────
⠋ | 1 | sha1 hello logrx
⠙ | 2 | sha1 hello again logrx
⠹ | 3 | sha1 hello logrx
✔ | 4 | sha1 [4.3s]
✔ | 2 | utils
⠸ | 14 | writer [1] "log print"
[1] "log print 2"
log catlog cat 2log inform
log inform 2
log message
log message 2
⠼ | 1 14 | writer Error: log error
⠦ | 2 15 | writer [1] "log print"
[1] "log print 2"
log catlog cat 2log inform
log inform 2
log message
log message 2
⠧ | 3 15 | writer Error: log error
⠋ | 4 17 | writer [1] 1
⠙ | 4 18 | writer [1] 1
✔ | 4 24 | writer [11.0s]
─────────────────────────────────────────────────────────────────────────
Warning (test-writer.R:189:3): write_output will return a formatted log output element
log warning
Backtrace:

  1. └─logrx:::run_safely_loudly(fp) at test-writer.R:189:3
  2. ├─logrx:::loudly(run_safely(file)) at project/R/interact.R:152:3
  3. │ └─base::withCallingHandlers(code, warning = wHandler, message = mHandler) at project/R/utils-execution.R:31:3
  4. └─purrr (local) run_safely(file) at project/R/utils-execution.R:31:3
  5. ├─purrr:::capture_error(.f(...), otherwise, quiet)
    
  6. │ └─base::tryCatch(...)
    
  7. │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  8. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  9. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  10. └─logrx (local) .f(...)
    
  11.   └─base::source(file, local = exec_env) at project/R/interact.R:136:5
    
  12.     ├─base::withVisible(eval(ei, envir))
    
  13.     └─base::eval(ei, envir)
    
  14.       └─base::eval(ei, envir)
    

Warning (test-writer.R:189:3): write_output will return a formatted log output element
log warning2
Backtrace:

  1. └─logrx:::run_safely_loudly(fp) at test-writer.R:189:3
  2. ├─logrx:::loudly(run_safely(file)) at project/R/interact.R:152:3
  3. │ └─base::withCallingHandlers(code, warning = wHandler, message = mHandler) at project/R/utils-execution.R:31:3
  4. └─purrr (local) run_safely(file) at project/R/utils-execution.R:31:3
  5. ├─purrr:::capture_error(.f(...), otherwise, quiet)
    
  6. │ └─base::tryCatch(...)
    
  7. │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  8. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  9. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  10. └─logrx (local) .f(...)
    
  11.   └─base::source(file, local = exec_env) at project/R/interact.R:136:5
    
  12.     ├─base::withVisible(eval(ei, envir))
    
  13.     └─base::eval(ei, envir)
    
  14.       └─base::eval(ei, envir)
    

Warning (test-writer.R:201:3): write_messages will return a formatted log messages element
log warning
Backtrace:

  1. └─logrx:::run_safely_loudly(fp) at test-writer.R:201:3
  2. ├─logrx:::loudly(run_safely(file)) at project/R/interact.R:152:3
  3. │ └─base::withCallingHandlers(code, warning = wHandler, message = mHandler) at project/R/utils-execution.R:31:3
  4. └─purrr (local) run_safely(file) at project/R/utils-execution.R:31:3
  5. ├─purrr:::capture_error(.f(...), otherwise, quiet)
    
  6. │ └─base::tryCatch(...)
    
  7. │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  8. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  9. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  10. └─logrx (local) .f(...)
    
  11.   └─base::source(file, local = exec_env) at project/R/interact.R:136:5
    
  12.     ├─base::withVisible(eval(ei, envir))
    
  13.     └─base::eval(ei, envir)
    
  14.       └─base::eval(ei, envir)
    

Warning (test-writer.R:201:3): write_messages will return a formatted log messages element
log warning2
Backtrace:

  1. └─logrx:::run_safely_loudly(fp) at test-writer.R:201:3
  2. ├─logrx:::loudly(run_safely(file)) at project/R/interact.R:152:3
  3. │ └─base::withCallingHandlers(code, warning = wHandler, message = mHandler) at project/R/utils-execution.R:31:3
  4. └─purrr (local) run_safely(file) at project/R/utils-execution.R:31:3
  5. ├─purrr:::capture_error(.f(...), otherwise, quiet)
    
  6. │ └─base::tryCatch(...)
    
  7. │   └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  8. │     └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  9. │       └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  10. └─logrx (local) .f(...)
    
  11.   └─base::source(file, local = exec_env) at project/R/interact.R:136:5
    
  12.     ├─base::withVisible(eval(ei, envir))
    
  13.     └─base::eval(ei, envir)
    
  14.       └─base::eval(ei, envir)
    

─────────────────────────────────────────────────────────────────────────

══ Results ══════════════════════════════════════════════════════════════
Duration: 34.9 s

[ FAIL 0 | WARN 9 | SKIP 0 | PASS 140 ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions