ropensci / weathercan

R package for downloading weather data from Environment and Climate Change Canada
https://docs.ropensci.org/weathercan
GNU General Public License v3.0
102 stars 29 forks source link

Add one vcr test #93

Closed maelle closed 4 years ago

maelle commented 4 years ago

:wave: @steffilazerte! Here's my shameless vcr promotion effort! :wink:

I ran vcr::use_vcr() and then created an example test based off the first part of an existing test.

codecov-io commented 4 years ago

Codecov Report

Merging #93 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #93   +/-   ##
=======================================
  Coverage   79.16%   79.16%           
=======================================
  Files           6        6           
  Lines         912      912           
=======================================
  Hits          722      722           
  Misses        190      190

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 35ba5da...ff04b6c. Read the comment docs.

steffilazerte commented 4 years ago

Thanks! I'm going to leave this PR here as a reference and will hopefully have some time to take a look in the near future. If I get things figured out, perhaps for that blog post, I could talk a bit about using both/either vcr and mockery to solve my internet connection issues!

maelle commented 4 years ago

perhaps for that blog post, I could talk a bit about using both/either vcr and mockery to solve my internet connection issues!

No pressure :angel: but that sounds like an awesome blog post topic :heart_eyes_cat:

maelle commented 4 years ago

One last thing that might be useful to you since you want to check real API things regularly (which I learnt in your comm call talk :wink:): https://docs.ropensci.org/vcr/reference/lightswitch.html (see e.g. a config file where vcr is turned off for one build).

steffilazerte commented 4 years ago

Oh that's a great option! Especially being able to integrate it into Travis CI and AppVeyor!

steffilazerte commented 4 years ago

I switched all the tests to vcr and CRAN had no problem. I did have to think hard sometimes, to make sure that the test fixtures remained small. But everything worked out well!

maelle commented 4 years ago

This is so cool!!

Do you mean making the test cases small or editing the fixtures by hand?

steffilazerte commented 4 years ago

Definitely not editing by hand! I meant re-using examples for different tests and strategically picking dates (i.e. daily data in ECCC is downloaded by month, so instead of a date range of 2018-09-01 to 2018-10-01, which downloads two months, I would change that to 2018-09-31, which downloads one mont, unless the point was to test downloading multiple months.)

maelle commented 4 years ago

thank you! :pray: