openclimatefix / pv-site-api

Site specific API for PV forecasting
6 stars 11 forks source link

Uniformize check to FAKE and fix related test #77

Closed simlmx closed 1 year ago

simlmx commented 1 year ago

Our checks to the environment variables were different and error prone (one test was silently broken). It's also annoying to pass FAKE=0 when wanting to start the API, as this feels like a sane default.

In this PR I make them uniform and make it optional to pass FAKE=0.


Some tests were breaking depending on the time at which they ran so I hard-coded the times in all the tests using freezegun (see the last commit of the PR).

codecov[bot] commented 1 year ago

Codecov Report

Merging #77 (4307066) into main (cc4037a) will increase coverage by 0.94%. The diff coverage is 91.66%.

@@            Coverage Diff             @@
##             main      #77      +/-   ##
==========================================
+ Coverage   92.42%   93.37%   +0.94%     
==========================================
  Files           8        8              
  Lines         330      332       +2     
==========================================
+ Hits          305      310       +5     
+ Misses         25       22       -3     
Impacted Files Coverage Δ
pv_site_api/session.py 37.50% <0.00%> (ø)
pv_site_api/__init__.py 100.00% <100.00%> (ø)
pv_site_api/main.py 92.25% <100.00%> (+2.06%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

peterdudfield commented 1 year ago

Is it ok If I review once the tests are working?

Or would you like help fixing?

simlmx commented 1 year ago

@peterdudfield No it's all good you can review after. I tagged you before I found the issue.