ropensci / wateRinfo

R package to download time series data from waterinfo.be
https://docs.ropensci.org/wateRinfo
MIT License
13 stars 3 forks source link

Date parse error when on devtools::check #30

Closed peterdesmet closed 5 years ago

peterdesmet commented 6 years ago

When doing a devtools::check(), I get:

* checking examples ... ERROR
Running examples in ‘wateRinfo-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: get_timeseries_tsid
> ### Title: Download timeseries data from waterinfo.be
> ### Aliases: get_timeseries_tsid
> 
> ### ** Examples
> 
> get_timeseries_tsid("35055042", from = "2017-01-01", to = "2017-01-02")
Error in check_date_format(from) : 
  The date string can not be properly parsed in any of the
             following formats: ymd_hms, ymd, ym, y)
Calls: get_timeseries_tsid -> parse_period -> check_date_format
Execution halted

Line causing the error:

https://github.com/inbo/wateRinfo/blob/199e426b18b4957584cd54d935607b7d1dff25f2/R/get_timeseries.R#L35

Function called:

https://github.com/inbo/wateRinfo/blob/a31a5c231f7ee59056ee3183103553cb5ee83142/R/parse_period.R#L49-L60

I have tried to look into this, but I am stuck. 😄

peterdesmet commented 6 years ago

Debugging so far:

  1. On branch master
  2. Create project in wateRinfo root
  3. Do Install and Restart (or use library(wateRinfo)
  4. In console do: get_timeseries_tsid("35055042", from="2017-01-01", to="2017-01-02")
 Error in check_date_format(from) : 
  The date string can not be properly parsed in any of the
             following formats: ymd_hms, ymd, ym, y) 
  1. Do get_timeseries_tsid("5156042", period = "P3D")
  2. Works
  3. Do get_timeseries_tsid("35055042", from="2017-01-01", to="2017-01-02") again:
  4. Works
stijnvanhoey commented 6 years ago

When I try to reproduce step 1 -> 4, I get the data.frame as expected...

stijnvanhoey commented 6 years ago

@peterdesmet still an issue?

peterdesmet commented 5 years ago

I still get the same error:

1. Error: Impossible date/period input combinations (@test-period_formatting.R#62) 

Error: testthat unit tests failed

Maybe there is an issue with my system date settings?

stijnvanhoey commented 5 years ago

Seems a failure of a unit test now, whereas previously, it was an example in the roxygen documentation, get_timeseries_tsid("35055042", from = "2017-01-01", to = "2017-01-02").

The test of line 62 on the test-period_formatting.R file is:

parse_period(from = "2012-11-01", to = "2013-12-01")

could you recheck and provide some additional info by providing the output of sessionInfo()?

stijnvanhoey commented 5 years ago

@peterdesmet can you have a check if this is still relevant?

peterdesmet commented 5 years ago

Package builds fine, so I'm not getting this error anymore. Closing issue.