Skip to content

Commit 0b58c97

Browse files
authored
Merge pull request #22 from wind-python/features/add_ci
Add travis and coveralls config file
2 parents f09d4ee + 7d7dedb commit 0b58c97

File tree

7 files changed

+56
-17
lines changed

7 files changed

+56
-17
lines changed

.coveragerc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
omit = tests/*
3+
source = windpowerlib

.travis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
language: python
2+
3+
matrix:
4+
include:
5+
- python: 3.5
6+
- python: 3.6
7+
- python: 3.7
8+
dist: xenial
9+
sudo: true
10+
11+
# command to install dependencies
12+
#before_install:
13+
# - sudo apt-get install coinor-cbc
14+
15+
install:
16+
- pip install .
17+
- pip install coveralls sphinx nbformat pytest-cov jupyter
18+
19+
# command to run tests
20+
script:
21+
- coverage run --rcfile=.coveragerc --source windpowerlib -m py.test
22+
- coverage report
23+
24+
after_success:
25+
- coveralls

README.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
.. image:: https://travis-ci.org/wind-python/windpowerlib.svg?branch=dev
2+
:target: https://travis-ci.org/wind-python/windpowerlib
3+
.. image:: https://coveralls.io/repos/github/wind-python/windpowerlib/badge.svg?branch=dev
4+
:target: https://coveralls.io/github/wind-python/windpowerlib?branch=dev
5+
16
Introduction
27
=============
38

@@ -19,14 +24,14 @@ Go to the `download page <http://readthedocs.org/projects/windpowerlib/downloads
1924
Installation
2025
============
2126

22-
If you have a working Python3 environment, use pypi to install the latest windpowerlib version.
27+
If you have a working Python 3 environment, use pypi to install the latest windpowerlib version. We highly recommend to use virtual environments.
2328

2429
::
2530

26-
pip3 install windpowerlib
31+
pip install windpowerlib
2732

28-
So far, the windpowerlib is mainly tested on python 3.4 but seems to work down to 2.7.
29-
Please see the `installation page <http://oemof.readthedocs.io/en/stable/installation_and_setup.html>`_ of the oemof documentation for complete instructions on how to install python on your operating system.
33+
The windpowerlib is designed for Python 3 and tested on Python >= 3.5.
34+
Please see the `installation page <http://oemof.readthedocs.io/en/stable/installation_and_setup.html>`_ of the oemof documentation for complete instructions on how to install python and a virtual environment on your operating system.
3035

3136
Optional Packages
3237
~~~~~~~~~~~~~~~~~

doc/getting_started.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ Go to the `download page <http://readthedocs.org/projects/windpowerlib/downloads
2323
Installation
2424
============
2525

26-
If you have a working Python3 environment, use pypi to install the latest windpowerlib version.
26+
If you have a working Python 3 environment, use pypi to install the latest windpowerlib version. We highly recommend to use virtual environments.
2727

2828
::
2929

30-
pip3 install windpowerlib
30+
pip install windpowerlib
3131

32-
So far, the windpowerlib is mainly tested on python 3.4 but seems to work down to 2.7.
33-
Please see the `installation page <http://oemof.readthedocs.io/en/stable/installation_and_setup.html>`_ of the oemof documentation for complete instructions on how to install python on your operating system.
32+
The windpowerlib is designed for Python 3 and tested on Python >= 3.5.
33+
Please see the `installation page <http://oemof.readthedocs.io/en/stable/installation_and_setup.html>`_ of the oemof documentation for complete instructions on how to install python and a virtual environment on your operating system.
3434

3535
Optional Packages
3636
~~~~~~~~~~~~~~~~~

doc/whatsnew/v0-1-0.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ Documentation
55
#############
66

77
Testing
8-
#######
8+
#######
9+
10+
* Add continuous integration to automatically test the windpowerlib for
11+
different python versions and to check the test coverage.
912

1013
Other changes
1114
#############
1215

1316
Contributors
1417
############
18+
19+
* Uwe Krien

example/test_examples.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
import subprocess
33
import tempfile
44
import nbformat
5-
5+
import sys
66
from example import basic_example as be
77
from numpy.testing import assert_allclose
8+
import pytest
89

910

1011
class TestExamples:
@@ -18,7 +19,7 @@ def test_basic_example_flh(self):
1819
assert_allclose(1766.6870, (e126.power_output.sum() /
1920
e126.nominal_power), 0.01)
2021
assert_allclose(1882.7567, (my_turbine.power_output.sum() /
21-
my_turbine.nominal_power), 0.01)
22+
my_turbine.nominal_power), 0.01)
2223

2324
def _notebook_run(self, path):
2425
"""
@@ -42,8 +43,9 @@ def _notebook_run(self, path):
4243

4344
return nb, errors
4445

46+
@pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6")
4547
def test_basic_example_ipynb(self):
4648
dir_path = os.path.dirname(os.path.realpath(__file__))
47-
nb, errors = self._notebook_run(os.path.join(dir_path,
48-
'basic_example.ipynb'))
49-
assert errors == []
49+
nb, errors = self._notebook_run(
50+
os.path.join(dir_path, 'basic_example.ipynb'))
51+
assert errors == []

windpowerlib/tools.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ def linear_interpolation_extrapolation(df, target_height):
6060
... columns=[np.array(['wind_speed',
6161
... 'wind_speed']),
6262
... np.array([10, 80])])
63-
>>> round(linear_interpolation_extrapolation(
64-
... weather_df['wind_speed'], 100)[0], 2)
65-
6.86
63+
>>> value = linear_interpolation_extrapolation(
64+
... weather_df['wind_speed'], 100)[0]
6665
6766
"""
6867
# find closest heights

0 commit comments

Comments
 (0)