SCasanova / f1dataR

An R package to access Formula 1 Data from the Ergast API and the unofficial F1 data stream via the fastf1 python library.
https://scasanova.github.io/f1dataR/
Other
52 stars 5 forks source link

Cran network stable fixes (#228) #229

Closed pbulsink closed 6 months ago

pbulsink commented 6 months ago

Per the request from CRAN and closes #228: this should now fail gracefully (return NULL) for any Ergast function if there's a connection/internet issue, and the code has been abstracted to be more general. It will also display a message with the failure to get Ergast data.

Previous behaviour was to fail with a warning (against CRAN policy) and harder-coded data manipulation wasn't flexible against small changes in results returned. This should be more forgiving now.

Notable adds:

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 89.79592% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 93.95%. Comparing base (0041c82) to head (5496bbc).

:exclamation: Current head 5496bbc differs from pull request most recent head 1a20e27. Consider uploading reports for the commit 1a20e27 to get more accurate results

Files Patch % Lines
R/load_laps.R 50.00% 2 Missing :warning:
R/load_constructors.R 50.00% 1 Missing :warning:
R/load_drivers.R 93.75% 1 Missing :warning:
R/load_pitstops.R 50.00% 1 Missing :warning:
R/load_quali.R 94.11% 1 Missing :warning:
R/load_results.R 83.33% 1 Missing :warning:
R/load_schedule.R 97.36% 1 Missing :warning:
R/load_sprint.R 50.00% 1 Missing :warning:
R/load_standings.R 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #229 +/- ## ========================================== - Coverage 95.16% 93.95% -1.21% ========================================== Files 19 19 Lines 600 596 -4 ========================================== - Hits 571 560 -11 - Misses 29 36 +7 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

pbulsink commented 6 months ago

@SCasanova still need to validate code works with no internet connection. Seems like there's not a really easy way of specifying it in test without adding code switches (see https://community.rstudio.com/t/unit-testing-for-non-working-internet-connection/31894 or https://blog.r-hub.io/2023/01/23/code-switch-escape-hatch-test/ ).