njtierney / geotargets

Targets extensions for geospatial data
https://njtierney.github.io/geotargets/
Other
49 stars 4 forks source link

code coverage is at 0%? #31

Closed njtierney closed 3 months ago

njtierney commented 3 months ago

image

Given it was at 95% and I removed one file, I'm not sure what's going on here!

brownag commented 3 months ago

Very weird. The codecov action "passes". but is throwing errors (Error: Error in rep_len(1, nchar(x)) : invalid 'length.out' value) starting here

R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
> # * https://testthat.r-lib.org/articles/special-files.html
> 
> library(testthat)
> library(geotargets)
Error: Error in rep_len(1, nchar(x)) : invalid 'length.out' value
> 
> test_check("geotargets")
Error: Error in rep_len(1, nchar(x)) : invalid 'length.out' value
Loading required namespace: terra
▶ dispatched target test_terra_rast
● completed target test_terra_rast [0.011 seconds]
▶ ended pipeline [0.098 seconds]
Error: Error in rep_len(1, nchar(x)) : invalid 'length.out' value
▶ dispatched target test_terra_vect
● completed target test_terra_vect [2.442 seconds]
▶ ended pipeline [2.5 seconds]
[ FAIL 0 | WARN 0 | SKIP 0 | PASS 5 ]
> 

Reverting a709181 seems to get it working for me again locally, and more specifically putting any function back in R/utils.R seems to fix it--which is magical and mysterious indeed.

When I run covr::package_coverage() locally after a709181 I do not see these errors, but I see the 0% coverage for whole package and AAAA.R

Aariq commented 3 months ago

Would it be helpful to maybe look at how targets, tarchetypes, etc. deals with this? There might be some hints in their github actions or in commit history. I'm assuming the coverage issues have something to do with callr R sessions in tests, but I don't actually know. Not sure if this is helpful, but I've noticed that the tests use the installed version of geotargets because of the namepacing with geotargets:: rather than using the current state of the code.

njtierney commented 3 months ago

I guess all we needed was a utils.R file after all? How strange, though! Thanks for digginng into this @brownag

Good ideas for searching for this, @Aariq !

njtierney commented 3 months ago

image

Woo! Thanks to @brownag for #43