Skip to content

[R-pkg-devel] CRAN, API packages, Keys and tests

4 messages · Joshua Ulrich, Rainer M Krug

#
I know this has been asked a few times - but I can?t find anything which might help me.

I have a package (https://github.com/rkrug/ROriginStamp) which wraps around API calls to OriginStamp (https://originstamp.com) to obtain trusted time stamps.

The package works, but the tests are the problem on remote machines.

My question is:

1) I have disabled all tests and all examples if there is no environmental variable set with the API Key - is this OK for CRAN?
2) If not, how can I make this CRAN compliant?

Thanks,

Rainer


--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982





--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982
#
Hi Rainer,

You could set an environment variable with the API key, and only run
the tests if the variable is set.

Here's an example that I use:
https://github.com/joshuaulrich/quantmod/blob/master/tests/test_getSymbols.R#L4

Best,
Josh
On Fri, Sep 4, 2020 at 3:25 AM Rainer M Krug <Rainer at krugs.de> wrote:

  
    
#
On Fri, Sep 4, 2020 at 9:20 AM Joshua Ulrich <josh.m.ulrich at gmail.com> wrote:
Sorry, I missed that you're already doing this.  I confirm that it
works for CRAN.  I also set my API key as a private/secure variable on
TravisCI, so the tests will run there.

IIRC, testthat does something similar. You could look at that pattern,
since it works on CRAN for many packages.

  
    
2 days later
#
Hi Josh,

Thanks for the thumbs-up for CRAN.

With the secure variable on Travis - that is exactly what I am doing.

Thanks a lot,

Rainer
--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Z?rich
Office Y34-J-74
Winterthurerstrasse 190
8075 Z?rich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug at uzh.ch
		Rainer at krugs.de
Skype:     RMkrug

PGP: 0x0F52F982