Comments (5)
-
Your overall point makes sense. Of all the tests in the package, this is the only one I see that doesn't depend on hitting the demo server.
-
I don't understand that specific error message. The value I see is "2023-01-01"
dataverse-client-r/inst/constants.yml
Line 3 in 099b0df
dataverse-client-r/tests/testthat.R
Line 26 in efdcb33
from dataverse-client-r.
Do you know why this part might get evaluated
No, and that's tricky to debug. It's not like we can play with different version.
I can see how CRAN changes some environmental subtly (eg, it used to be "CRAN" but now it's "cran"). But I can't see how/why something on CRAN would set "NOT_CRAN".
Oh wait, I think this comment helps:
skip_on_cran()
skips on CRAN (using theNOT_CRAN
env var set by devtools and friends).
I'm interpreting that this variable is set only if testthat/devtools is the one starting the test. So if you don't want it running on CRAN, change it to if (Sys.getenv("NOT_CRAN") == "true") {
from dataverse-client-r.
That sounds like the same as what we had (if (Sys.getenv("NOT_CRAN") %in% c("", "true"))
), but this is helpful. In the dev branch in the above commit I have used identical
to match it up with the testthat code, and also loaded the devtools
package since from the description NOT_CRAN gets set by devtools.
I plan to re-submit it to CRAN as v.0.3.13 tomorrow. The Github Actions checks now all pass!
from dataverse-client-r.
For some reason the new token I got and submitted for v0.3.12 had an expiration date in March 2023, so now the tests are failing again at CRAN after only two months. CRAN gave me a deadline to fix this by March 27.
I can fix this again with a token that lasts till 2024-03-13, but I wonder if it is better to try and skip even this expiration check for CRAN, like we do for all the tests. @wibeasley what do you think? I wonder if we can put skip_on_cran()
in the testthat/testthat.R
root file, which is what's failing now. Even a once-a-year update now feels like a liability to keep this package on CRAN.
Log. Currently on: https://cran.r-project.org/web/checks/check_results_dataverse.html
Version: 0.3.12
Check: tests
Result: ERROR
Running ‘testthat.R’ [1s/1s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library("testthat")
> library("dataverse")
>
> if (!requireNamespace("yaml", quietly = TRUE)) {
+ warning("The 'yaml' package must be present to test the dataverse package.")
+ } else if (!requireNamespace("checkmate", quietly = TRUE)) {
+ warning("The 'checkmate' package must be present to test the dataverse package.")
+ } else {
+ server <- Sys.getenv("DATAVERSE_SERVER")
+ key <- Sys.getenv("DATAVERSE_KEY")
+
+ if (server == "" | key == "") {
+ config <- yaml::read_yaml(system.file("constants.yml", package = "dataverse"))
+ # config <- yaml::read_yaml("inst/constants.yml")
+
+ Sys.setenv("DATAVERSE_SERVER" = config$server)
+ Sys.setenv("DATAVERSE_KEY" = config$api_token)
+
+ # To better identify the source of problems, check if the token is expired.
+ # This check *should* be unnecessary on CRAN, since not CRAN tests should
+ # try to access any server.
+ if (Sys.getenv("NOT_CRAN") %in% c("", "true")) {
+ if (as.Date(config$api_token_expiration) < Sys.Date()) {
+ stop(
+ "The API token expired on `",
+ config$api_token_expiration,
+ "`, so the tests would probably fail. ",
+ "Please regenerate a new token and update `inst/constants.yml`"
+ )
+ }
+ }
+ rm(config)
+ }
+ rm(server, key)
+
+ message("Using Dataverse server `", Sys.getenv("DATAVERSE_SERVER"), "`.")
+
+ test_check("dataverse")
+ }
Error: The API token expired on `2023-03-10`, so the tests would probably fail. Please regenerate a new token and update `inst/constants.yml`
Execution halted
from dataverse-client-r.
Thank you @wibeasley.
From the log, I think the error is coming from testthat/testthat.R
dataverse-client-r/tests/testthat.R
Lines 19 to 22 in efdcb33
rather than a specific test function. Do you know why this part might get evaluated and throw an error in CRAN's server even though we have
Sys.getenv("NOT_CRAN")
?
I will also put a skip_if_cran()
on standardize_string()
, but that function does not use any dataverse functions.
For your point 2, I think the issue is that the version on CRAN right now is the package from the dev branch, rather than master.
from dataverse-client-r.
Related Issues (20)
- Return 0.3.8 to CRAN
- Release dataverse 0.3.9
- Unused and unbuilt functions
- Improve doc on how to read objects without object assignment HOT 2
- Progress bar HOT 4
- Expired API token for R check HOT 2
- Faster JSON parser HOT 2
- Better detection test for whether a file is ingested HOT 7
- Unable to retrieve an unpublished data file. HOT 12
- add_dataset_file error HOT 10
- CRAN 0.3.11 HOT 4
- release of haven 2.5.0 HOT 1
- Problema para recuperar informação pela API HOT 3
- GitHub Actions failing due to spending limits HOT 7
- rename default branch to "main" HOT 4
- How to download an RData file? HOT 9
- Problem downloading larger files HOT 1
- HTTP 503 on data that used to work HOT 4
- CRAN checks failing at vignette when network resource unavailable HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dataverse-client-r.