calliope-project / calliope

A multi-scale energy systems modelling framework
https://www.callio.pe
Apache License 2.0
277 stars 89 forks source link

Clean up warning capture #577

Closed brynpickering closed 4 months ago

brynpickering commented 4 months ago

Fixes reduced coverage reported in #574 (I hope).

It turns out that the warning formatter wasn't being called, maybe some change in Python warnings (but couldn't see anything in the changelog). I've also updated how we capture warnings with our logging module, so it actually pipes warnings to the logger.

Reviewer checklist:

codecov[bot] commented 4 months ago

Codecov Report

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

Project coverage is 95.83%. Comparing base (872978d) to head (e8ec00b). Report is 5 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #577 +/- ## ========================================== - Coverage 95.85% 95.83% -0.02% ========================================== Files 24 24 Lines 3619 3628 +9 Branches 788 724 -64 ========================================== + Hits 3469 3477 +8 Misses 86 86 - Partials 64 65 +1 ``` | [Files](https://app.codecov.io/gh/calliope-project/calliope/pull/577?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project) | Coverage Δ | | |---|---|---| | [src/calliope/model.py](https://app.codecov.io/gh/calliope-project/calliope/pull/577?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL21vZGVsLnB5) | `93.62% <100.00%> (-0.03%)` | :arrow_down: | | [src/calliope/preprocess/load.py](https://app.codecov.io/gh/calliope-project/calliope/pull/577?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL3ByZXByb2Nlc3MvbG9hZC5weQ==) | `92.20% <ø> (ø)` | | | [src/calliope/util/logging.py](https://app.codecov.io/gh/calliope-project/calliope/pull/577?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL3V0aWwvbG9nZ2luZy5weQ==) | `94.33% <100.00%> (+0.46%)` | :arrow_up: | | [src/calliope/exceptions.py](https://app.codecov.io/gh/calliope-project/calliope/pull/577?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=calliope-project#diff-c3JjL2NhbGxpb3BlL2V4Y2VwdGlvbnMucHk=) | `97.14% <66.66%> (-2.86%)` | :arrow_down: |