Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add code coverage #411

Merged
merged 5 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,8 @@ jobs:
pip install --timeout=300 ${{ matrix.env }}
- name: Test with pytest ${{ matrix.env }}
run: |
pytest
python -m pytest --cov=./ --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<img src="./docs/sphinx/source/_images/logo_horizontal_highres.png" width="500" alt="RdTools logo"/>

Master branch:
[![Build Status](https://github.com/NREL/rdtools/workflows/pytest/badge.svg?branch=master)](https://github.com/NREL/rdtools/actions?query=branch%3Amaster)
Master branch:
[![Build Status](https://github.com/NREL/rdtools/workflows/pytest/badge.svg?branch=master)](https://github.com/NREL/rdtools/actions?query=branch%3Amaster)

Development branch:
Development branch:
[![Build Status](https://github.com/NREL/rdtools/workflows/pytest/badge.svg?branch=development)](https://github.com/NREL/rdtools/actions?query=branch%3Adevelopment)

Code coverage:
[![codecov](https://codecov.io/gh/NREL/rdtools/graph/badge.svg?token=K2HDjFkBws)](https://codecov.io/gh/NREL/rdtools)

RdTools is an open-source library to support reproducible technical analysis of
time series data from photovoltaic energy systems. The library aims to provide
best practice analysis routines along with the building blocks for users to
Expand Down Expand Up @@ -57,11 +60,11 @@ appropriate:
Detection Techniques in AC Power Time Series," 2021 IEEE 48th Photovoltaic
Specialists Conference (PVSC), pp. 1638-1643 2021, DOI: [10.1109/PVSC43889.2021.9518733](https://doi.org/10.1109/PVSC43889.2021.9518733).


## References
The clear sky temperature calculation, `clearsky_temperature.get_clearsky_tamb()`, uses data
from images created by Jesse Allen, NASA’s Earth Observatory using data courtesy of the MODIS Land Group.
https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD_LSTD_CLIM_M
from images created by Jesse Allen, NASA’s Earth Observatory using data courtesy of the MODIS Land Group.
https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD_LSTD_CLIM_M
https://neo.sci.gsfc.nasa.gov/view.php?datasetId=MOD_LSTN_CLIM_M

Other useful references which may also be consulted for degradation rate methodology include:
Expand Down
9 changes: 5 additions & 4 deletions rdtools/test/interpolate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import numpy as np
from rdtools import interpolate
import pytest
import warnings


@pytest.fixture
Expand Down Expand Up @@ -132,9 +133,9 @@ def test_interpolate_warning(test_df, df_target_index, df_expected_result):
interpolate(test_df, df_target_index, pd.to_timedelta('15 minutes'),
warning_threshold=0.1)

with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
interpolate(test_df, df_target_index, pd.to_timedelta('15 minutes'),
warning_threshold=0.5)
if 'Fraction of excluded data' in ';'.join([str(x.message) for x in record.list]):
pytest.fail("normalize.interpolate raised a warning about "
"excluded data even though the threshold was high")
warnings.filterwarnings("error", message='Fraction of excluded data')
# if this test fails, it means a warning was raised that was not expected
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

TESTS_REQUIRE = [
'pytest >= 3.6.3',
'pytest-cov',
'coverage',
'flake8',
'nbval==0.9.6', # https://github.com/computationalmodelling/nbval/issues/194
Expand Down
Loading