yonicd / covrpage

Create a summary readme for the testthat subdirectory to communicate with potential users
https://yonicd.github.io/covrpage/
Other
52 stars 7 forks source link

Error in file(con, "r") : cannot open the connection #59

Closed IndrajeetPatil closed 2 years ago

IndrajeetPatil commented 4 years ago

I updated to R-devel (4.0) and running the following command

covrpage::covrpage(
  update_badge = TRUE,
  vignette = TRUE,
  preview = TRUE
)

is now giving me the following error:

Error in file(con, "r") : cannot open the connection

Here is the traceback:

24: file(con, "r")
23: readLines(file.path(lib, pkg_name, "R", pkg_name))
22: add_hooks(pkg$package, tmp_lib, fix_mcexit = should_enable_parallel_mcexit_fix(pkg))
21: covr::package_coverage()
20: covrpage::coverage_skip(test_path = "../tests/testthat", test_skip = test_skip)
19: eval(expr, envir, enclos)
18: eval(expr, envir, enclos)
17: withVisible(eval(expr, envir, enclos))
16: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler, 
        error = eHandler, message = mHandler)
15: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir, 
        enclos)), warning = wHandler, error = eHandler, message = mHandler))
14: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr, 
        envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
13: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos, 
        debug = debug, last = i == length(out), use_try = stop_on_error != 
            2L, keep_warning = keep_warning, keep_message = keep_message, 
        output_handler = output_handler, include_timing = include_timing)
12: evaluate::evaluate(...)
11: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning), 
        keep_message = !isFALSE(options$message), stop_on_error = if (options$error && 
            options$include) 0L else 2L, output_handler = knit_handlers(options$render, 
            options))
10: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE, 
        keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message), 
        stop_on_error = if (options$error && options$include) 0L else 2L, 
        output_handler = knit_handlers(options$render, options)))
9: block_exec(params)
8: call_block(x)
7: process_group.block(group)
6: process_group(group)
5: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), 
       error = function(e) {
           setwd(wd)
           cat(res, sep = "\n", file = output %n% "")
           message("Quitting from lines ", paste(current_lines(i), 
               collapse = "-"), " (", knit_concord$get("infile"), 
               ") ")
       })
4: process_file(text, output)
3: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
2: rmarkdown::render(input = "tests/_covrpage.Rmd", output_file = "README.md", 
       output_dir = "tests", output_format = "github_document", 
       output_options = list(toc = TRUE, toc_depth = 3))
1: covrpage::covrpage(update_badge = TRUE, vignette = TRUE, preview = TRUE)

Some other details that might be helpful:

> sessioninfo::session_info(include_base = TRUE)
- Session info ----------------------------------------------------------------------
 setting  value                                             
 version  R Under development (unstable) (2020-02-28 r77874)
 os       Windows 10 x64                                    
 system   x86_64, mingw32                                   
 ui       RStudio                                           
 language (EN)                                              
 collate  English_United States.1252                        
 ctype    English_United States.1252                        
 tz       Europe/Berlin                                     
 date     2020-03-0
yonicd commented 4 years ago

Did any tests fail for you? I can see that covrpage_skip was invoked

IndrajeetPatil commented 4 years ago

No, all of my tests succeed locally

== Results ==========================================================
Duration: 172.9 s

OK:       796
Failed:   0
Warnings: 0
Skipped:  0

on Travis: https://travis-ci.org/IndrajeetPatil/ggstatsplot/builds/657026885 and on AppVeyor: https://ci.appveyor.com/project/IndrajeetPatil/ggstatsplot/builds/31165748 on both R 3.6.3 and R 4.0.

yonicd commented 4 years ago

Ok. I’ll try and see what is changing in the R-devel, but it will probably take a while.

Are those local results above from test_dir or test_check?

Eluvias commented 4 years ago

I confirm the same issue. All tests succeed.

Any plans to have this fixed?

Thanks

yonicd commented 4 years ago

Thanks for the update. What repo are you working with?

Eluvias commented 4 years ago

Thanks for coming back. I am working on private repos and all have the same issue. (R version 4.0.2 (2020-06-22).

Eluvias commented 4 years ago

Another problem is that covrpage updates the status on the README but it's false because the process never succeeded. Please see an example on this repo https://github.com/ropenscilabs/tic.covrpage.

image

Clicking on covrpage status to check the report: image

yonicd commented 4 years ago

Thanks, can you please open this as a separate issue. I’ll get to this too.

I just don’t want to create issues that have multiple problems, it is harder to track.

Thanks

yonicd commented 4 years ago

@IndrajeetPatil I just rebuilt covrpage on 4.0.2 and all tests pass for the package.

I merged your master of ggstatsplot on my fork and ran covrpage and it didnt crash.

It did skip a lot of the tests though do to judicious use of testthat::skip_on_cran()

here is the tests/readme

@Eluvias i'm not sure what you mean by not succeeded, it is passing on travis, thus updating the badge on success.

Eluvias commented 4 years ago

@yonicd Have you tested it on Windows platform? I am on Windows, the covrpage for ggstatsplot was run on Windows too.

i'm not sure what you mean by not succeeded, it is passing on travis, thus updating the badge on success.

When I run covrpage::covrpage() the process runs successfully despite the fact the knitting of _covrpage.Rmd never succeeds. It just continues to the next process by knitting the README.Rmd. As a a result, the badge gets updated signalling that covrpage was completed successfully - but when inspecting the covrpage report ( README ) the file was never updated.

yonicd commented 4 years ago

Thanks for the clarification, I'll continue digging.

Eluvias commented 4 years ago

@yonicd Potential root cause:

# current
covrpage:::package_name("..")
#> Error in normalizePath(path.expand(path), winslash, mustWork) : 
#>   path[1]="../DESCRIPTION": The system cannot find the file specified

# this works
covrpage:::package_name(".")

See R News about `normalizePath()` - `https://cran.r-project.org/bin/windows/base/NEWS.R-4.0.2.html
yonicd commented 4 years ago

inst/_covrpage rmd is copied into tests subdir and the rmd is rendered, so the correct input for package_name is .., see here for the src script of package_name

nothing in the news notes changed the behavior of normalizpath from what i can see.

you are welcome to use your winOS to see if by forcing a winslash in the normalizePath call resolves the issue.

yonicd commented 4 years ago

this issue may be the stem of the issue https://github.com/r-lib/covr/issues/443 and the reason it is specific to winos runs

IndrajeetPatil commented 4 years ago

https://github.com/r-lib/covr/issues/443 is resolved, but I still can't get this to work (GitHub version of covr + R-devel), so maybe that wasn't the issue?

yonicd commented 4 years ago

This is something that was changed in base R 3.4.6. The dll's arent being released between concurrent sessions in winOS. So when test_dir is run then the package is loaded and coverpage_skip get's locked out from trying to install the package.

I am looking into how to sequence things better with that change in mind.

IndrajeetPatil commented 2 years ago

I can no longer reproduce this issue with 4.1, so seems to have resolved itself ☺️