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

Tests need to fail gracefully without internet #230

Closed
cboettig opened this issue Apr 21, 2019 · 4 comments
Closed

Tests need to fail gracefully without internet #230

cboettig opened this issue Apr 21, 2019 · 4 comments

Comments

@cboettig
Copy link
Member

A good number of functions require an internet connection, running the test suite without a connection still goes poorly. CRAN's solaris machines seem particularly good at failing to make successful internet calls and CRAN doesn't like it when this causes the tests to fail...

@maelle
Copy link
Member

maelle commented Apr 22, 2019

So should the whole test suite be skipped if there's no internet connection? Not very graceful though, we should make the whole package better at working w/o internet. 🤔

@maelle
Copy link
Member

maelle commented Apr 22, 2019

Cf also #175

@cboettig
Copy link
Member Author

I modified codemeta_validate() to return with a warning if no internet connection is available, and for sys_reqs method to return NULL if no connection is available. Then I decided that patching everything wasn't going to happen before CRAN kicked us off and switched over to skipping tests instead.

I used pingr::is_online() to define a skip_if_offline() method (which is apparently already available as a skip in the dev version of testthat, though not sure if it uses pingr or something else). I added that skip to any test_that() block that failed when I switched internet off (i.e. most but not all).

In principle we should overhaul the design to work better in offline mode (i.e. warnings and fall-back methods instead of errors), though in practice that loses a lot of the richness of the current package. A codemeta-lite that worked with minimal dependencies to parse local DESCRIPTION, README, etc would be a more practical offline solution and could eventually be swapped in here to provide the core functionality. but that's a big lift so not sure when it would happen.

@cboettig
Copy link
Member Author

but meanwhile I've gone and released 1.8 with these patches so at least the powers-at-CRAN should be happy for a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants