From 1e3e72db6038e3431c1479126d490fc44d7d308b Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Tue, 11 Feb 2020 22:33:22 -0700 Subject: [PATCH 01/22] enable pytest_remotedata for psm3 --- azure-pipelines.yml | 7 ++----- ci/requirements-py35-min.yml | 1 + ci/requirements-py35.yml | 1 + ci/requirements-py36.yml | 1 + ci/requirements-py37.yml | 1 + pvlib/tests/iotools/test_psm3.py | 4 ++++ setup.py | 6 +++--- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f008531824..93ccd7b3e4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -26,10 +26,10 @@ jobs: versionSpec: '$(python.version)' - script: | - pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures + pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata pip install -e . export NREL_API_KEY=$(nrelApiKey) - pytest pvlib --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html + pytest pvlib --remote-data --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html displayName: 'Test with pytest' - task: PublishTestResults@2 @@ -76,7 +76,6 @@ jobs: displayName: 'List installed dependencies' - script: | source activate test_env - export NREL_API_KEY=$(nrelApiKey) pytest pvlib --junitxml=junit/test-results.xml --cov --cov-report=xml --cov-report=html displayName: 'pytest' # - script: | @@ -129,7 +128,6 @@ jobs: displayName: 'List installed dependencies' - script: | call activate test_env - set NREL_API_KEY=$(nrelApiKey) pytest pvlib --junitxml=junit/test-results.xml displayName: 'pytest' - task: PublishTestResults@2 @@ -159,7 +157,6 @@ jobs: - script: | pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pip install -e . - export NREL_API_KEY=$(nrelApiKey) pytest pvlib --junitxml=junit/test-results.xml --cov=pvlib --cov-report=xml --cov-report=html displayName: 'Test with pytest' diff --git a/ci/requirements-py35-min.yml b/ci/requirements-py35-min.yml index c1d5283293..bcde87c313 100644 --- a/ci/requirements-py35-min.yml +++ b/ci/requirements-py35-min.yml @@ -8,6 +8,7 @@ dependencies: - pytest - pytest-cov - pytest-mock + - pytest-remotedata - pytest-timeout - python=3.5 - pytz diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 3118b7ecbe..39e0db6d80 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -16,6 +16,7 @@ dependencies: - pytest - pytest-cov - pytest-mock + - pytest-remotedata - pytest-timeout - python=3.5 - pytz diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index c0d62c52bc..f579886be1 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -17,6 +17,7 @@ dependencies: - pytest-cov - pytest-mock - pytest-rerunfailures + - pytest-remotedata - pytest-timeout - python=3.6 - pytz diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 1ca2a9ed6c..518e0dc23c 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -18,6 +18,7 @@ dependencies: - pytest-mock - pytest-timeout - pytest-rerunfailures + - pytest-remotedata - python=3.7 - pytz - requests diff --git a/pvlib/tests/iotools/test_psm3.py b/pvlib/tests/iotools/test_psm3.py index 60e1c79079..b31d82bff6 100644 --- a/pvlib/tests/iotools/test_psm3.py +++ b/pvlib/tests/iotools/test_psm3.py @@ -70,6 +70,7 @@ def assert_psm3_equal(header, data, expected): assert (data.index.tzinfo.zone == 'Etc/GMT%+d' % -header['Time Zone']) +@pytest.mark.remote_data @pytest.mark.flaky(reruns=5, reruns_delay=2) def test_get_psm3_tmy(nrel_api_key): """test get_psm3 with a TMY""" @@ -79,6 +80,7 @@ def test_get_psm3_tmy(nrel_api_key): assert_psm3_equal(header, data, expected) +@pytest.mark.remote_data @pytest.mark.flaky(reruns=5, reruns_delay=2) def test_get_psm3_singleyear(nrel_api_key): """test get_psm3 with a single year""" @@ -88,6 +90,7 @@ def test_get_psm3_singleyear(nrel_api_key): assert_psm3_equal(header, data, expected) +@pytest.mark.remote_data @pytest.mark.flaky(reruns=5, reruns_delay=2) def test_get_psm3_check_leap_day(nrel_api_key): _, data_2012 = psm3.get_psm3(LATITUDE, LONGITUDE, nrel_api_key, @@ -102,6 +105,7 @@ def test_get_psm3_check_leap_day(nrel_api_key): (LATITUDE, LONGITUDE, nrel_api_key, 'bad', 60), (LATITUDE, LONGITUDE, nrel_api_key, '2017', 15), ]) +@pytest.mark.remote_data @pytest.mark.flaky(reruns=5, reruns_delay=2) def test_get_psm3_tmy_errors( latitude, longitude, api_key, names, interval diff --git a/setup.py b/setup.py index df8201c0ba..f2d32f144b 100755 --- a/setup.py +++ b/setup.py @@ -37,12 +37,12 @@ MAINTAINER_EMAIL = 'holmgren@email.arizona.edu' URL = 'https://github.com/pvlib/pvlib-python' -INSTALL_REQUIRES = ['numpy >= 1.12.0', - 'pandas >= 0.18.1', +INSTALL_REQUIRES = ['numpy == 1.12.0', + 'pandas == 0.18.1', 'pytz', 'requests'] TESTS_REQUIRE = ['nose', 'pytest', 'pytest-cov', 'pytest-mock', - 'pytest-timeout', 'pytest-rerunfailures'] + 'pytest-timeout', 'pytest-rerunfailures', 'pytest-remotedata'] EXTRAS_REQUIRE = { 'optional': ['ephem', 'cython', 'netcdf4', 'nrel-pysam', 'numba', 'pvfactors', 'scipy', 'siphon', 'tables'], From f0f210d78b85cb4f962c940609ef2779d2611d3b Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Mon, 17 Feb 2020 21:42:10 -0700 Subject: [PATCH 02/22] add pytest_remotedata to test_pvgis.py --- pvlib/tests/iotools/test_pvgis.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pvlib/tests/iotools/test_pvgis.py b/pvlib/tests/iotools/test_pvgis.py index 5227c45841..51bbd01ca6 100644 --- a/pvlib/tests/iotools/test_pvgis.py +++ b/pvlib/tests/iotools/test_pvgis.py @@ -67,6 +67,7 @@ def csv_meta(meta_expected): in meta_expected['outputs']['tmy_hourly']['variables'].items()] +@pytest.mark.remote_data def test_get_pvgis_tmy(expected, month_year_expected, inputs_expected, meta_expected): data, months_selected, inputs, meta = get_pvgis_tmy(45, 8) @@ -92,6 +93,7 @@ def test_get_pvgis_tmy(expected, month_year_expected, inputs_expected, assert meta == meta_expected +@pytest.mark.remote_data def test_get_pvgis_tmy_kwargs(userhorizon_expected): _, _, inputs, _ = get_pvgis_tmy(45, 8, usehorizon=False) assert inputs['meteo_data']['use_horizon'] is False @@ -109,6 +111,7 @@ def test_get_pvgis_tmy_kwargs(userhorizon_expected): assert inputs['meteo_data']['year_max'] == 2016 +@pytest.mark.remote_data def test_get_pvgis_tmy_basic(expected, meta_expected): data, _, _, _ = get_pvgis_tmy(45, 8, outputformat='basic') # check each column of output separately @@ -116,6 +119,7 @@ def test_get_pvgis_tmy_basic(expected, meta_expected): assert np.allclose(data[outvar], expected[outvar]) +@pytest.mark.remote_data def test_get_pvgis_tmy_csv(expected, month_year_expected, inputs_expected, meta_expected, csv_meta): data, months_selected, inputs, meta = get_pvgis_tmy( @@ -138,6 +142,7 @@ def test_get_pvgis_tmy_csv(expected, month_year_expected, inputs_expected, assert meta_value in csv_meta +@pytest.mark.remote_data def test_get_pvgis_tmy_epw(expected, epw_meta): data, _, _, meta = get_pvgis_tmy( 45, 8, outputformat='epw') @@ -148,6 +153,7 @@ def test_get_pvgis_tmy_epw(expected, epw_meta): assert meta == epw_meta +@pytest.mark.remote_data def test_get_pvgis_tmy_error(): err_msg = 'outputformat: Incorrect value.' with pytest.raises(requests.HTTPError, match=err_msg): From 48858ad6dcb32204bdb6be5cdb0af84b46413061 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Tue, 18 Feb 2020 21:55:05 -0700 Subject: [PATCH 03/22] add @pytest.mark.remote_data to other network dependent tests --- pvlib/tests/iotools/test_epw.py | 2 ++ pvlib/tests/iotools/test_midc.py | 3 +-- pvlib/tests/iotools/test_srml.py | 5 +++++ pvlib/tests/iotools/test_surfrad.py | 2 ++ pvlib/tests/iotools/test_tmy.py | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/pvlib/tests/iotools/test_epw.py b/pvlib/tests/iotools/test_epw.py index 50d99acf9b..a9d42e485c 100644 --- a/pvlib/tests/iotools/test_epw.py +++ b/pvlib/tests/iotools/test_epw.py @@ -1,4 +1,5 @@ from pandas.util.testing import network +import pytest from pvlib.iotools import epw from conftest import DATA_DIR @@ -11,6 +12,7 @@ def test_read_epw(): @network +@pytest.mark.remote_data def test_read_epw_remote(): url = 'https://energyplus.net/weather-download/europe_wmo_region_6/NLD//NLD_Amsterdam.062400_IWEC/NLD_Amsterdam.062400_IWEC.epw' epw.read_epw(url) diff --git a/pvlib/tests/iotools/test_midc.py b/pvlib/tests/iotools/test_midc.py index 9c0dec9145..40725938d1 100644 --- a/pvlib/tests/iotools/test_midc.py +++ b/pvlib/tests/iotools/test_midc.py @@ -1,5 +1,4 @@ import pandas as pd -from pandas.util.testing import network import pytest import pytz @@ -64,7 +63,7 @@ def test_read_midc_var_mapping_as_arg(test_mapping): assert 'temp_air' in data.columns -@network +@pytest.mark.remote_data def test_read_midc_raw_data_from_nrel(): start_ts = pd.Timestamp('20181018') end_ts = pd.Timestamp('20181019') diff --git a/pvlib/tests/iotools/test_srml.py b/pvlib/tests/iotools/test_srml.py index 06ff79cdd3..58939c0cb9 100644 --- a/pvlib/tests/iotools/test_srml.py +++ b/pvlib/tests/iotools/test_srml.py @@ -14,6 +14,7 @@ def test_read_srml(): @network +@pytest.mark.remote_data def test_read_srml_remote(): srml.read_srml('http://solardat.uoregon.edu/download/Archive/EUPO1801.txt') @@ -40,6 +41,7 @@ def test_read_srml_nans_exist(): ('http://solardat.uoregon.edu/download/Archive/EUPO1612.txt', 2016, 12), ]) +@pytest.mark.remote_data def test_read_srml_dt_index(url, year, month): data = srml.read_srml(url) start = pd.Timestamp('{:04d}{:02d}01 00:00'.format(year, month)) @@ -63,6 +65,7 @@ def test_map_columns(column, expected): @network +@pytest.mark.remote_data def test_read_srml_month_from_solardat(): url = 'http://solardat.uoregon.edu/download/Archive/EUPO1801.txt' file_data = srml.read_srml(url) @@ -71,6 +74,7 @@ def test_read_srml_month_from_solardat(): @network +@pytest.mark.remote_data def test_15_minute_dt_index(): data = srml.read_srml_month_from_solardat('TW', 2019, 4, 'RQ') start = pd.Timestamp('20190401 00:00') @@ -83,6 +87,7 @@ def test_15_minute_dt_index(): @network +@pytest.mark.remote_data def test_hourly_dt_index(): data = srml.read_srml_month_from_solardat('CD', 1986, 4, 'PH') start = pd.Timestamp('19860401 00:00') diff --git a/pvlib/tests/iotools/test_surfrad.py b/pvlib/tests/iotools/test_surfrad.py index 8e67a639d0..cbe1710911 100644 --- a/pvlib/tests/iotools/test_surfrad.py +++ b/pvlib/tests/iotools/test_surfrad.py @@ -1,5 +1,6 @@ import pandas as pd from pandas.util.testing import network +import pytest from pvlib.iotools import surfrad from conftest import DATA_DIR @@ -10,6 +11,7 @@ @network +@pytest.mark.remote_data def test_read_surfrad_network(): # If this test begins failing, SURFRAD's data structure or data # archive may have changed. diff --git a/pvlib/tests/iotools/test_tmy.py b/pvlib/tests/iotools/test_tmy.py index ca6c2654ba..80deb469eb 100644 --- a/pvlib/tests/iotools/test_tmy.py +++ b/pvlib/tests/iotools/test_tmy.py @@ -1,6 +1,7 @@ from pandas.util.testing import network import numpy as np import pandas as pd +import pytest from pvlib.iotools import tmy from conftest import DATA_DIR @@ -17,6 +18,7 @@ def test_read_tmy3(): @network +@pytest.mark.remote_data def test_read_tmy3_remote(): url = 'http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/703165TYA.CSV' tmy.read_tmy3(url) From 62a486bbea99ea2fbaa52b8ada3349a04e2349e0 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 19 Feb 2020 16:52:06 -0700 Subject: [PATCH 04/22] use up-to-date numpy, pandas --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index f2d32f144b..56d894062d 100755 --- a/setup.py +++ b/setup.py @@ -37,8 +37,8 @@ MAINTAINER_EMAIL = 'holmgren@email.arizona.edu' URL = 'https://github.com/pvlib/pvlib-python' -INSTALL_REQUIRES = ['numpy == 1.12.0', - 'pandas == 0.18.1', +INSTALL_REQUIRES = ['numpy >= 1.12.0', + 'pandas >= 0.18.1', 'pytz', 'requests'] TESTS_REQUIRE = ['nose', 'pytest', 'pytest-cov', 'pytest-mock', From 6fa8ecfa89a829c9a81fec566b2f5e97b9ecda38 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Wed, 19 Feb 2020 21:46:08 -0700 Subject: [PATCH 05/22] install netcdf4 from pip instead of conda --- ci/requirements-py35.yml | 2 +- ci/requirements-py36.yml | 2 +- ci/requirements-py37.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 39e0db6d80..e95b45317a 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -6,7 +6,6 @@ dependencies: - coveralls - cython - ephem - - netcdf4 - nose - numba - numpy @@ -28,3 +27,4 @@ dependencies: - nrel-pysam>=2.0 - pvfactors==1.0.1 - pytest-rerunfailures # conda version is >3.6 + - netcdf4 diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index f579886be1..d8651f2d3a 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -6,7 +6,6 @@ dependencies: - coveralls - cython - ephem - - netcdf4 - nose - numba - numpy @@ -28,3 +27,4 @@ dependencies: - pip: - nrel-pysam>=2.0 - pvfactors==1.0.1 + - netcdf4 diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 518e0dc23c..5c406ac407 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -6,7 +6,6 @@ dependencies: - coveralls - cython - ephem - - netcdf4 - nose - numba - numpy @@ -28,3 +27,4 @@ dependencies: - pip: - nrel-pysam>=2.0 - pvfactors==1.0.1 + - netcdf4 From d2925f966fd48e61bafda32b5db9c92219e2004e Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 10:32:15 -0700 Subject: [PATCH 06/22] install pytest-remotedata from pip for conda 3.5 --- ci/requirements-py35.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index e95b45317a..0fb6fee689 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -15,7 +15,6 @@ dependencies: - pytest - pytest-cov - pytest-mock - - pytest-remotedata - pytest-timeout - python=3.5 - pytz @@ -28,3 +27,4 @@ dependencies: - pvfactors==1.0.1 - pytest-rerunfailures # conda version is >3.6 - netcdf4 + - pytest-remotedata # needs > 0.3.1 From a385968feb056e49d6bd2b73d7874b13e4f18916 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 12:04:55 -0700 Subject: [PATCH 07/22] readd @network to test_midc.py --- pvlib/tests/iotools/test_midc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pvlib/tests/iotools/test_midc.py b/pvlib/tests/iotools/test_midc.py index 40725938d1..912b3b6a29 100644 --- a/pvlib/tests/iotools/test_midc.py +++ b/pvlib/tests/iotools/test_midc.py @@ -1,4 +1,5 @@ import pandas as pd +from pandas.util.testing import network import pytest import pytz @@ -63,6 +64,7 @@ def test_read_midc_var_mapping_as_arg(test_mapping): assert 'temp_air' in data.columns +@network @pytest.mark.remote_data def test_read_midc_raw_data_from_nrel(): start_ts = pd.Timestamp('20181018') From feef27491b3467f63b3ce845f345f4d7969c30e9 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 12:25:34 -0700 Subject: [PATCH 08/22] add pytest-remotedata to py35-min for travis --- ci/requirements-py35-min.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/requirements-py35-min.yml b/ci/requirements-py35-min.yml index bcde87c313..d4113e42d8 100644 --- a/ci/requirements-py35-min.yml +++ b/ci/requirements-py35-min.yml @@ -17,3 +17,4 @@ dependencies: - numpy==1.12.0 - pandas==0.18.1 - pytest-rerunfailures # conda version is >3.6 + - pytest-remotedata # needs > 0.3.1 From 466f2609c81efcb1b1b43df92c1be57100eb1400 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 12:29:28 -0700 Subject: [PATCH 09/22] add to what's new --- docs/sphinx/source/whatsnew/v0.7.2.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 999436bdbd..b80eb9d034 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -25,11 +25,13 @@ Bug fixes passing ``tz=datetime.timezone.utc`` (:pull:`879`) * Fix documentation homepage title to "pvlib python" based on first heading on the page. (:pull:`890`) (:issue:`888`) +* Implement pytest-remotedata to increase test suite speed. Requires + ``--remote-data`` pytest flag to execute data retreival tests over a network. Documentation ~~~~~~~~~~~~~ * Add NumFOCUS affiliation to Sphinx documentation :pull:`862` -* Add example of IV curve generation :pull:`872` +* Add example of IV curve generation :pull:`872` Requirements ~~~~~~~~~~~~ @@ -42,4 +44,4 @@ Contributors * Cameron T. Stark (:ghuser:`camerontstark`) * Will Holmgren (:ghuser:`wholmgren`) * Kevin Anderson (:ghuser:`kanderso-nrel`) -* Karthikeyan Singaravelan (:ghuser:`tirkarthi`) \ No newline at end of file +* Karthikeyan Singaravelan (:ghuser:`tirkarthi`) From e73eeb02db17f930c1958c219d2bdf38b557c726 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 13:37:50 -0700 Subject: [PATCH 10/22] point coverage at run with --remote-data --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 93ccd7b3e4..fd5cc1a650 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,6 +16,7 @@ jobs: python.version: '3.5' Python36: python.version: '3.6' + coverage: true Python37: python.version: '3.7' @@ -56,7 +57,6 @@ jobs: python.version: '35' Python36: python.version: '36' - coverage: true Python37: python.version: '37' From 0b60b084af32d4a7b76cc73d2ff0009001086f68 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 15:38:30 -0700 Subject: [PATCH 11/22] add --remote-data to travis run for coveralls to pickup --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7884982ead..885852d2ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ install: - pip install -e . script: - - pytest pvlib --cov=pvlib --cov-report term-missing + - pytest pvlib --remote-data --cov=pvlib --cov-report term-missing after_script: - if [[ $TASK == "coverage" ]]; then From 17384e0e3b9393aaeb68e46a69ea1732c67bdae6 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 15:50:15 -0700 Subject: [PATCH 12/22] Revert "point coverage at run with --remote-data" This reverts commit e73eeb02db17f930c1958c219d2bdf38b557c726. --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fd5cc1a650..93ccd7b3e4 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,6 @@ jobs: python.version: '3.5' Python36: python.version: '3.6' - coverage: true Python37: python.version: '3.7' @@ -57,6 +56,7 @@ jobs: python.version: '35' Python36: python.version: '36' + coverage: true Python37: python.version: '37' From 68a560a7253ae4351d93331b561dc32ed2cd54bc Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 16:23:37 -0700 Subject: [PATCH 13/22] Update docs/sphinx/source/whatsnew/v0.7.2.rst Co-Authored-By: Will Holmgren --- docs/sphinx/source/whatsnew/v0.7.2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index b80eb9d034..32d390dbbe 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -26,7 +26,7 @@ Bug fixes * Fix documentation homepage title to "pvlib python" based on first heading on the page. (:pull:`890`) (:issue:`888`) * Implement pytest-remotedata to increase test suite speed. Requires - ``--remote-data`` pytest flag to execute data retreival tests over a network. + ``--remote-data`` pytest flag to execute data retrieval tests over a network. Documentation ~~~~~~~~~~~~~ From 5063d60d4968254cc8b018f1df47f3bb0ca31413 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Thu, 20 Feb 2020 16:23:52 -0700 Subject: [PATCH 14/22] Update docs/sphinx/source/whatsnew/v0.7.2.rst Co-Authored-By: Will Holmgren --- docs/sphinx/source/whatsnew/v0.7.2.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 32d390dbbe..6533ceb324 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -25,7 +25,7 @@ Bug fixes passing ``tz=datetime.timezone.utc`` (:pull:`879`) * Fix documentation homepage title to "pvlib python" based on first heading on the page. (:pull:`890`) (:issue:`888`) -* Implement pytest-remotedata to increase test suite speed. Requires +* Implement `pytest-remotedata `_ to increase test suite speed. Requires ``--remote-data`` pytest flag to execute data retrieval tests over a network. Documentation From 2e9236a8e62959b477c4919b75f745ef54a09b75 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 10:31:21 -0700 Subject: [PATCH 15/22] Revert "install netcdf4 from pip instead of conda" This reverts commit 6fa8ecfa89a829c9a81fec566b2f5e97b9ecda38. --- ci/requirements-py35.yml | 2 +- ci/requirements-py36.yml | 2 +- ci/requirements-py37.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci/requirements-py35.yml b/ci/requirements-py35.yml index 0fb6fee689..8fe88c839b 100644 --- a/ci/requirements-py35.yml +++ b/ci/requirements-py35.yml @@ -6,6 +6,7 @@ dependencies: - coveralls - cython - ephem + - netcdf4 - nose - numba - numpy @@ -26,5 +27,4 @@ dependencies: - nrel-pysam>=2.0 - pvfactors==1.0.1 - pytest-rerunfailures # conda version is >3.6 - - netcdf4 - pytest-remotedata # needs > 0.3.1 diff --git a/ci/requirements-py36.yml b/ci/requirements-py36.yml index d8651f2d3a..f579886be1 100644 --- a/ci/requirements-py36.yml +++ b/ci/requirements-py36.yml @@ -6,6 +6,7 @@ dependencies: - coveralls - cython - ephem + - netcdf4 - nose - numba - numpy @@ -27,4 +28,3 @@ dependencies: - pip: - nrel-pysam>=2.0 - pvfactors==1.0.1 - - netcdf4 diff --git a/ci/requirements-py37.yml b/ci/requirements-py37.yml index 5c406ac407..518e0dc23c 100644 --- a/ci/requirements-py37.yml +++ b/ci/requirements-py37.yml @@ -6,6 +6,7 @@ dependencies: - coveralls - cython - ephem + - netcdf4 - nose - numba - numpy @@ -27,4 +28,3 @@ dependencies: - pip: - nrel-pysam>=2.0 - pvfactors==1.0.1 - - netcdf4 From 7ad3f4ccbf6e9c708d4481d9686a7cc41120d171 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 10:53:28 -0700 Subject: [PATCH 16/22] fix linelength in what's new --- docs/sphinx/source/whatsnew/v0.7.2.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/sphinx/source/whatsnew/v0.7.2.rst b/docs/sphinx/source/whatsnew/v0.7.2.rst index 6533ceb324..701e4363d8 100644 --- a/docs/sphinx/source/whatsnew/v0.7.2.rst +++ b/docs/sphinx/source/whatsnew/v0.7.2.rst @@ -25,8 +25,9 @@ Bug fixes passing ``tz=datetime.timezone.utc`` (:pull:`879`) * Fix documentation homepage title to "pvlib python" based on first heading on the page. (:pull:`890`) (:issue:`888`) -* Implement `pytest-remotedata `_ to increase test suite speed. Requires - ``--remote-data`` pytest flag to execute data retrieval tests over a network. +* Implement `pytest-remotedata `_ + to increase test suite speed. Requires ``--remote-data`` pytest flag to + execute data retrieval tests over a network. Documentation ~~~~~~~~~~~~~ From 08fdfba2329745964db08b72457baeb2089797d1 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 10:56:50 -0700 Subject: [PATCH 17/22] add pytest-remotedata to Azure MacOS --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 93ccd7b3e4..6e1533a762 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -155,7 +155,7 @@ jobs: versionSpec: '$(python.version)' - script: | - pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures + pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata pip install -e . pytest pvlib --junitxml=junit/test-results.xml --cov=pvlib --cov-report=xml --cov-report=html displayName: 'Test with pytest' From e72a2eddf054e7216daf9f30b04f89ccb57a6f22 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 11:59:17 -0700 Subject: [PATCH 18/22] move --remote-data tests to conda_linux --- azure-pipelines.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6e1533a762..168ec2170a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -28,8 +28,7 @@ jobs: - script: | pip install pytest pytest-cov pytest-mock pytest-timeout pytest-azurepipelines pytest-rerunfailures pytest-remotedata pip install -e . - export NREL_API_KEY=$(nrelApiKey) - pytest pvlib --remote-data --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html + pytest pvlib --junitxml=junit/test-results.xml --cov=com --cov-report=xml --cov-report=html displayName: 'Test with pytest' - task: PublishTestResults@2 @@ -76,7 +75,8 @@ jobs: displayName: 'List installed dependencies' - script: | source activate test_env - pytest pvlib --junitxml=junit/test-results.xml --cov --cov-report=xml --cov-report=html + export NREL_API_KEY=$(nrelApiKey) + pytest pvlib --remote-data --junitxml=junit/test-results.xml --cov --cov-report=xml --cov-report=html displayName: 'pytest' # - script: | # source activate test_env From 3f9ef96e6b6485963651f9846cc09fa8d783c05a Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 12:00:10 -0700 Subject: [PATCH 19/22] add remote_data decorators to tests requiring network --- pvlib/tests/test_forecast.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pvlib/tests/test_forecast.py b/pvlib/tests/test_forecast.py index 43b8bd6308..cf5abf567d 100644 --- a/pvlib/tests/test_forecast.py +++ b/pvlib/tests/test_forecast.py @@ -59,6 +59,7 @@ def model(request): @requires_siphon +@pytest.mark.remote_data def test_process_data(model): for how in ['liujordan', 'clearsky_scaling']: if model.raw_data.empty: @@ -75,6 +76,7 @@ def test_process_data(model): @requires_siphon +@pytest.mark.remote_data def test_bad_kwarg_get_data(): # For more information on why you would want to pass an unknown keyword # argument, see Github issue #745. @@ -85,6 +87,7 @@ def test_bad_kwarg_get_data(): @requires_siphon +@pytest.mark.remote_data def test_bad_kwarg_get_processed_data(): # For more information on why you would want to pass an unknown keyword # argument, see Github issue #745. @@ -95,6 +98,7 @@ def test_bad_kwarg_get_processed_data(): @requires_siphon +@pytest.mark.remote_data def test_how_kwarg_get_processed_data(): amodel = NAM() data = amodel.get_processed_data(_latitude, _longitude, _start, _end, @@ -103,6 +107,7 @@ def test_how_kwarg_get_processed_data(): @requires_siphon +@pytest.mark.remote_data def test_vert_level(): amodel = NAM() vert_level = 5000 @@ -111,6 +116,7 @@ def test_vert_level(): @requires_siphon +@pytest.mark.remote_data def test_datetime(): amodel = NAM() start = datetime.now(tz=timezone.utc) @@ -119,6 +125,7 @@ def test_datetime(): @requires_siphon +@pytest.mark.remote_data def test_queryvariables(): amodel = GFS() new_variables = ['u-component_of_wind_height_above_ground'] From d8befa67627078710018c29bd4a6e64d22214969 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 13:21:49 -0700 Subject: [PATCH 20/22] only install pytest-remotedata from pip, explain --- ci/requirements-py35-min.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/requirements-py35-min.yml b/ci/requirements-py35-min.yml index d4113e42d8..f79844f160 100644 --- a/ci/requirements-py35-min.yml +++ b/ci/requirements-py35-min.yml @@ -8,7 +8,6 @@ dependencies: - pytest - pytest-cov - pytest-mock - - pytest-remotedata - pytest-timeout - python=3.5 - pytz @@ -17,4 +16,4 @@ dependencies: - numpy==1.12.0 - pandas==0.18.1 - pytest-rerunfailures # conda version is >3.6 - - pytest-remotedata # needs > 0.3.1 + - pytest-remotedata # conda package is 0.3.0, needs > 0.3.1 From bfbb2d36bcd926f6070b60bc558b36d31bbd66bc Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 15:03:13 -0700 Subject: [PATCH 21/22] fix tests directory name and url --- docs/sphinx/source/contributing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index f7932de97f..5e7ccd2c3a 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -262,7 +262,7 @@ Testing Developers **must** include comprehensive tests for any additions or modifications to pvlib. New unit test code should be placed in the corresponding test module in the -`pvlib/test `_ +`pvlib/tests `_ directory. A pull request will automatically run the tests for you on a variety of From 738ed9dff9d6ee4c1e5b9107cd0f0f60813679f5 Mon Sep 17 00:00:00 2001 From: Cameron Stark Date: Fri, 21 Feb 2020 15:04:00 -0700 Subject: [PATCH 22/22] document use of --remote-data flag in Contributing>Testing --- docs/sphinx/source/contributing.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/sphinx/source/contributing.rst b/docs/sphinx/source/contributing.rst index 5e7ccd2c3a..59125dbedf 100644 --- a/docs/sphinx/source/contributing.rst +++ b/docs/sphinx/source/contributing.rst @@ -298,6 +298,14 @@ location of a test failure. As described in :ref:`code-style`, pvlib code does not use ``print`` or ``logging`` calls, and this also applies to the test suite (with rare exceptions). +To include all network-dependent tests, include the ``--remote-data`` flag to +your ``pytest`` call: + +``pytest pvlib --remote-data`` + +And consider adding ``@pytest.mark.remote_data`` to any network dependent test +you submit for a PR. + pvlib-python contains 3 "layers" of code: functions, PVSystem/Location, and ModelChain. Contributors will need to add tests that correspond to the layers that they modify.