Skip to content

Commit

Permalink
Merge 2e0da77 into 8f39c48
Browse files Browse the repository at this point in the history
  • Loading branch information
p-snft committed Oct 13, 2020
2 parents 8f39c48 + 2e0da77 commit 66fe005
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
omit = test/*
feedinlib/open_FRED.py
source = feedinlib
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: python

matrix:
include:
- python: 3.6
- python: 3.7
- python: 3.8

install:
- pip install .[dev]
- pip install coveralls pytest-cov

# command to run tests
script:
- coverage run --rcfile=.coveragerc --source feedinlib -m py.test
- coverage report

after_success:
- coveralls

4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def read(fname):
"geopandas",
"numpy >= 1.7.0",
"oedialect >= 0.0.6.dev0",
"open_FRED-cli",
"pvlib >= 0.7.0",
"tables",
"windpowerlib >= 0.2.0",
Expand All @@ -39,6 +38,9 @@ def read(fname):
"pytest",
"sphinx_rtd_theme",
],
"data-sources": [
"open_FRED-cli",
],
"examples": ["jupyter",
"matplotlib",
"descartes"],
Expand Down
3 changes: 3 additions & 0 deletions test/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import subprocess
import tempfile
import nbformat
import pytest


class TestExamples:
Expand Down Expand Up @@ -35,13 +36,15 @@ def test_load_era5_ipynb(self):
'load_era5_weather_data.ipynb'))
assert errors == []

@pytest.mark.skip(reason="Requires open_FRED, which depends on oemof <0.4.")
def test_pvlib_ipynb(self):
parent_dirname = os.path.dirname(os.path.dirname(__file__))
nb, errors = self._notebook_run(
os.path.join(parent_dirname, 'example',
'run_pvlib_model.ipynb'))
assert errors == []

@pytest.mark.skip(reason="Requires open_FRED, which depends on oemof <0.4.")
def test_windpowerlib_turbine_ipynb(self):
parent_dirname = os.path.dirname(os.path.dirname(__file__))
nb, errors = self._notebook_run(
Expand Down
12 changes: 6 additions & 6 deletions test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def pvlib_pv_system(self):
"""
return {'module_name': 'Yingli_YL210__2008__E__',
'inverter_name':
'ABB__MICRO_0_25_I_OUTD_US_208_208V__CEC_2014_',
'ABB__MICRO_0_25_I_OUTD_US_208__208V_',
'azimuth': 180,
'tilt': 30,
'albedo': 0.2}
Expand Down Expand Up @@ -121,7 +121,7 @@ def test_powerplant_requirements(self, pvlib_pv_system, pvlib_weather):
test_module = Photovoltaic(**pvlib_pv_system)
feedin = test_module.feedin(weather=pvlib_weather,
model=Pvlib, location=(52, 13))
assert 143.28844 == pytest.approx(feedin.values[0], 1e-5)
assert 143.39361 == pytest.approx(feedin.values[0], 1e-5)

def test_powerplant_requirements_2(self, pvlib_pv_system, pvlib_weather):
"""
Expand All @@ -142,10 +142,10 @@ def test_pv_feedin_scaling(self, pvlib_pv_system, pvlib_weather):
test_module = Photovoltaic(**pvlib_pv_system)
feedin = test_module.feedin(
weather=pvlib_weather, location=(52, 13), scaling='peak_power')
assert 0.67462 == pytest.approx(feedin.values[0], 1e-5)
assert 0.67511 == pytest.approx(feedin.values[0], 1e-5)
feedin = test_module.feedin(
weather=pvlib_weather, location=(52, 13), scaling='area')
assert 84.28732 == pytest.approx(feedin.values[0], 1e-5)
assert 84.34918 == pytest.approx(feedin.values[0], 1e-5)

def test_wind_feedin_scaling(
self, windpowerlib_turbine, windpowerlib_weather):
Expand Down Expand Up @@ -174,7 +174,7 @@ def test_pvlib_feedin(self, pvlib_pv_system, pvlib_weather):
test_module = Photovoltaic(**pvlib_pv_system)
feedin = test_module.feedin(weather=pvlib_weather,
location=(52, 13))
assert 143.28844 == pytest.approx(feedin.values[0], 1e-5)
assert 143.39361 == pytest.approx(feedin.values[0], 1e-5)
assert test_copy == pvlib_pv_system

def test_pvlib_feedin_with_surface_type(
Expand All @@ -187,7 +187,7 @@ def test_pvlib_feedin_with_surface_type(
pvlib_pv_system['surface_type'] = 'grass'
test_module = Photovoltaic(**pvlib_pv_system)
feedin = test_module.feedin(weather=pvlib_weather, location=(52, 13))
assert 143.28844 == pytest.approx(feedin.values[0], 1e-5)
assert 143.39361 == pytest.approx(feedin.values[0], 1e-5)

def test_pvlib_feedin_with_optional_pp_parameter(
self, pvlib_pv_system, pvlib_weather):
Expand Down

0 comments on commit 66fe005

Please sign in to comment.