Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0% coverage reported on Windows #291

Closed
maelle opened this issue Nov 11, 2017 · 19 comments
Closed

0% coverage reported on Windows #291

maelle opened this issue Nov 11, 2017 · 19 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@maelle
Copy link

maelle commented Nov 11, 2017

I am using the development version of covr which solved this issue I had with a previous version.

When running covr::package_coverage() for this package with tests I get 0% coverage which puzzles me given 1) codecov results 2) the fact that tests actually run on my laptop via devtools::test().

I am not sure which info to include in this issue. :-)

@wlandau-lilly
Copy link

wlandau-lilly commented Nov 11, 2017

@maelle I could not reproduce this issue with 3c24869, 32-bit R-devel (2017-09-23 r73342), and Windows 7. For me, coverage is still 100% for drake. Do you also get 0% coverage with other packages?

> sessionInfo()
R Under development (unstable) (2017-09-23 r73342)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] covr_3.0.1

loaded via a namespace (and not attached):
[1] compiler_3.5.0 lazyeval_0.2.1 magrittr_1.5   rex_1.1.2     
[5] tools_3.5.0    withr_2.1.0    rstudioapi_0.7 yaml_2.1.14   
[9] crayon_1.3.4 

@maelle
Copy link
Author

maelle commented Nov 11, 2017

Good question, yes I get it with other packages, I have just tried that.

I get this warning

Warning messages:
1: running command 'C:/PROGRA~1/R/R-34~1.0PA/bin/x64/R --vanilla CMD config CC' had status 1 
2: running command 'C:/PROGRA~1/R/R-34~1.0PA/bin/x64/R --vanilla CMD config CC' had status 1 
> sessionInfo()
R version 3.4.0 Patched (2017-05-10 r72669)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.0 lazyeval_0.2.0 magrittr_1.5   rex_1.1.2      tools_3.4.0   
[6] withr_2.1.0    rstudioapi_0.6 crayon_1.3.4   covr_3.0.1 

will update lazyeval and rstudioapi.

@maelle
Copy link
Author

maelle commented Nov 11, 2017

Update: updating these two packages didn't make a difference.

@wlandau-lilly
Copy link

wlandau-lilly commented Nov 11, 2017

I tried to meet you half-way: 64-bit R 3.4.0. After update.packages(), I got 100% coverage for this package (quicker to test).

From your warning messages, I see your R installations are in C:/Program Files/R/. For different issues, the space in that file path was the culprit, so now I keep all my R versions in C:/R/. Not sure if it would help in this case, but if covr is spawning child processes, it might.

@maelle
Copy link
Author

maelle commented Nov 11, 2017

Oh interesting! I'm not going to change the R location right now, but it's good to know.

@wlandau-lilly
Copy link

I am glad you did not jump at the suggestion because C:/Program Files/ does not seem to be the problem. I tried installing R 3.4.2 there, and I still got the expected full coverage.

@jimhester
Copy link
Member

@maelle can you try running system("C:/PROGRA~1/R/R-34~1.0PA/bin/x64/R --vanilla CMD config CC") directly? I think this is an issue with interpreting short names on the OS, not sure what the solution is, we have similar issue in devtools (r-lib/devtools#885) with some possible user side fixes.

@maelle
Copy link
Author

maelle commented Nov 21, 2017

`

system("C:/PROGRA1/R/R-341.0PA/bin/x64/R --vanilla CMD config CC")
"sh" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
Warning message:
running command 'C:/PROGRA1/R/R-341.0PA/bin/x64/R --vanilla CMD config CC' had status 1 `

So sh is not recognized, whatever that means?

@wlandau-lilly
Copy link

wlandau-lilly commented Nov 21, 2017

What if you updated Rtools? It's a shot in the dark, but it seems like the easiest next thing to try.

@randomsven
Copy link

... just to avoid "special moments" - I also had a similar problem to you (if I read correctly): running covr on a collection of R scripts on Windows (red herring) produced 0 coverage. The code I was trying to check test coverage for was being migrated into a package, but was originally a set of scripts - tests had to leverage the source function to drag sets of functions in, which overwrites the code that has been instrumented by covr - getting rid of any source statements and building the package solved the problem. ... not saying this is your issue, but it had me stumped for a little while :)

@robne1982
Copy link

robne1982 commented Nov 23, 2017

If it helps, I have the exact same issue as @maelle . Not sure there's much I can add, but I'd be happy to try out any suggestions anyone has?

UPDATE - I tried installing the latest version of Rtools too.

My version is

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

@maelle
Copy link
Author

maelle commented Nov 23, 2017

@wlandau-lilly Thank you, I just ran installr::install.Rtools() that told me I have the relevant version installed. 🤔

@randomsven Thanks but in my case the exact same packages gets a different coverage on other systems. 😉

@rnobleeddy Thank you, I'm happy to not be alone in this position and I hope we'll soon get it sorted out!

@tonyelhabr
Copy link

I'm having the same issue.

@thomaslaber
Copy link

Same here.

@idefer
Copy link

idefer commented Feb 13, 2018

I don't know if it may be related, but I was getting the same issue while running file_coverage(), using it for one source file and one test file. It turned out, I had rm(list = ls()) at the top of the test file to clean up the environment before running the tests. Removing that line fixed the issue.

@hartmast
Copy link

hartmast commented Feb 24, 2018

I have the same issue on a Mac, both with the CRAN and the Github versions; I tried running package_coverage() on several different packages.

EDIT: Apologies, I found out that the error was entirely on my side - I had .gitignored the test files; after changing this, everything works like a charm.

@q23qweliuhan
Copy link

q23qweliuhan commented Mar 6, 2018

I got similar issue here, just create a new package with the hello.R, and created test using use_test().
After pointing to the correct Rtools directory, I don't get the warnings on the CMD config anymore. But I still get this 0% coverage. Apparently they are not related.

> devtools::test()
Loading test
Testing test
√ | OK F W S | Context
√ |  1       | test-example.R

== Results =====================================================================
Duration: 0.2 s

OK:       1
Failed:   0
Warnings: 0
Skipped:  0
> package_coverage()
test Coverage: 0.00%
R/hello.R: 0.00%

@jimhester
Copy link
Member

So I think these errors tend to occur because covr expects that R and RTools are installed on your PATH. If they are not you need to use something like devtools::setup_rtools() to put it on the PATH prior to running covr.

@jimhester
Copy link
Member

This should now be fixed, although you may still get similar installation errors if you try to run covr on a package needing compilation without Rtools being on the path.

@jimhester jimhester added the bug an unexpected problem or unintended behavior label May 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

10 participants