Skip to content
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
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.6.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Testing
function per test. (:issue:`394`)
* Use pytest-mock to ensure that ModelChain DC model is set up correctly.
* Add Python 3.7 to build matrix
* Make test_forecast.py more robust. (:issue:`293`)


Contributors
Expand Down
3 changes: 1 addition & 2 deletions pvlib/test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
import platform

from pkg_resources import parse_version
Expand All @@ -7,7 +6,7 @@
import pytest


skip_windows = pytest.mark.skipif('win' in sys.platform,
skip_windows = pytest.mark.skipif(platform.system() == 'Windows',
reason='does not run on windows')

try:
Expand Down
21 changes: 18 additions & 3 deletions pvlib/test/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import inspect
from math import isnan
from pytz import timezone
import warnings

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -50,17 +51,31 @@
@pytest.fixture(scope='module', params=_modelclasses)
def model(request):
amodel = request.param()
amodel.raw_data = \
amodel.get_data(_latitude, _longitude, _start, _end)
try:
raw_data = amodel.get_data(_latitude, _longitude, _start, _end)
except Exception as e:
warnings.warn('Exception getting data for {}.\n'
'latitude, longitude, start, end = {} {} {} {}\n{}'
.format(amodel, _latitude, _longitude, _start, _end, e))
raw_data = pd.DataFrame() # raw_data.empty will be used later
amodel.raw_data = raw_data
return amodel


@requires_siphon
def test_process_data(model):
for how in ['liujordan', 'clearsky_scaling']:
if model.raw_data.empty:
warnings.warn('Could not test {} process_data with how={} '
'because raw_data was empty'.format(model, how))
continue
data = model.process_data(model.raw_data, how=how)
for variable in _nonnan_variables:
assert not data[variable].isnull().values.any()
try:
assert not data[variable].isnull().values.any()
except AssertionError:
warnings.warn('{}, {}, data contained null values'
.format(model, variable))


@requires_siphon
Expand Down