CABLE-LSM / benchcab

Tool for evaluation of CABLE land surface model
https://benchcab.readthedocs.io/en/latest/
Apache License 2.0
2 stars 3 forks source link

`project` keyword improvements in `config.yml` #232

Closed abhaasgoyal closed 7 months ago

abhaasgoyal commented 8 months ago

Fixes #231 , #246

Merge Message

codecov[bot] commented 8 months ago

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (5b6c6fa) 59.13% compared to head (e3f1f9e) 59.65%. Report is 8 commits behind head on main.

Files Patch % Lines
tests/test_benchcab.py 59.25% 11 Missing :warning:
benchcab/benchcab.py 0.00% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #232 +/- ## ========================================== + Coverage 59.13% 59.65% +0.51% ========================================== Files 29 30 +1 Lines 2129 2191 +62 ========================================== + Hits 1259 1307 +48 - Misses 870 884 +14 ```

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

abhaasgoyal commented 8 months ago

@ccarouge @SeanBryan51 right now the CI test is failing due to not having $PROJECT. I was wondering about how to go about this in terms of best practices of writing unit tests:

  1. Unit tests should be independent of environment variable -> So in the unit test itself I could add a condition that if it's run on Gadi, only then look for existing $PROJECT, else define it on os.environ before running the test function
  2. I could add an environment variable in Github for actions, but that would mean that any machine would need to define $PROJECT first, or define project in every config.yaml
  3. Use a fallback project by default, providing user with different messages on verbose on whether it's using the Gadi machine or not (could define the environment variable in __init__.py)
abhaasgoyal commented 8 months ago

Ok so for now I've created a mock test environment variable within the test-config module using monkeypatch. This will clear out all environment variables and reset $PROJECT before running each test.