PecanProject / pecan

The Predictive Ecosystem Analyzer (PEcAn) is an integrated ecological bioinformatics toolbox.
www.pecanproject.org
Other
202 stars 230 forks source link

Use DB mocking for tests that require BETY? #3066

Open Aariq opened 1 year ago

Aariq commented 1 year ago

Description

Tests for some packages fail in environments without access to BETYdb. E.g. PEcAn.BIOCRO.

Proposed Solution

I'm familiar with "webmocking", where requests to an API are stored and then used to simulate future API calls for unit tests without the necessity for a internet connection. A preliminary search for database mocking turned up with dittodb, an rOpenSci package inspired by httrtest (for webmocking) but for mocking database connections. Using database mocking with tests would help make PEcAn packages more modular and would be necessary for passing unit tests for CRAN.

Alternatives

meetagrawal09 commented 1 year ago

The logs of PEcAn.BIOCRO seem to have expired. So is the failing test being talked about here in PEcAn.BIOCRO package present in this file : Link ?

infotroph commented 1 year ago

@meetagrawal09 Yes, that's the one.

A lot of the complexity in that file is my fault (from 5 years ago now!) -- feel free to ask me me questions about it as needed. It may be obvious, but in case: Note that there are two separate kinds of mocking at play here.

(^all of that applies only to this particular BioCro test, not to bety-dependent tests in other packages)

Laiba-zaheer20 commented 9 months ago

@Aariq , I would like to work on this.