diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 45b72c659..17aa453c6 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -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 }} diff --git a/README.md b/README.md index d6482e561..f7149d262 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,14 @@ 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 @@ -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: diff --git a/rdtools/test/interpolate_test.py b/rdtools/test/interpolate_test.py index 448d3ed39..40bac08bc 100644 --- a/rdtools/test/interpolate_test.py +++ b/rdtools/test/interpolate_test.py @@ -2,6 +2,7 @@ import numpy as np from rdtools import interpolate import pytest +import warnings @pytest.fixture @@ -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 diff --git a/setup.py b/setup.py index 8a106a86a..4e0fc9b35 100755 --- a/setup.py +++ b/setup.py @@ -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