Skip to content

Commit 4da65ee

Browse files
committed
Merge pull request #109 from wholmgren/skip-on-py3
avoid the conda/travis/pip/scipy mess with a simple skip
2 parents 612e9ea + 1288512 commit 4da65ee

File tree

5 files changed

+46
-27
lines changed

5 files changed

+46
-27
lines changed

.travis.yml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,8 @@ matrix:
1414
env: CONDA_ENV=py27
1515
- python: 3.4
1616
env: CONDA_ENV=py34
17-
addons:
18-
apt:
19-
packages:
20-
- libatlas-dev
21-
- libatlas-base-dev
22-
- liblapack-dev
23-
- gfortran
24-
- libgmp-dev
25-
- libmpfr-dev
2617
- python: 3.5
2718
env: CONDA_ENV=py35
28-
addons:
29-
apt:
30-
packages:
31-
- libatlas-dev
32-
- libatlas-base-dev
33-
- liblapack-dev
34-
- gfortran
35-
- libgmp-dev
36-
- libmpfr-dev
3719

3820
addons:
3921
apt:
@@ -68,7 +50,7 @@ install:
6850
- echo $PATH
6951
- ls -l /home/travis/miniconda/envs/test_env/lib
7052
#- pip install . # use pip to automatically install anything not in the yml files (i.e. numpy/scipy/pandas for py3*)
71-
- pip install scipy # won't do anything if already installed
53+
#- pip install scipy # won't do anything if already installed
7254
- python setup.py install
7355

7456
script:

ci/requirements-py34.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: test_env
22
dependencies:
33
- python=3.4
4+
- numpy
5+
- scipy
6+
- pandas
47
- nose
58
- pytz
69
- ephem
7-
#- numba
10+
- numba
811
- pip:
9-
- numpy
10-
- pandas
1112
- coveralls

ci/requirements-py35.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: test_env
22
dependencies:
33
- python=3.5
4+
- numpy
5+
- scipy
6+
- pandas
47
- nose
58
- pytz
69
- ephem
7-
# - numba
10+
- numba
811
- pip:
9-
- numpy
10-
- pandas
1112
- coveralls

pvlib/test/__init__.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# the has/skip patterns closely follow the examples set by
2+
# the xray/xarray project
3+
4+
import sys
5+
import platform
6+
7+
try:
8+
import unittest2 as unittest
9+
except ImportError:
10+
import unittest
11+
12+
try:
13+
import scipy
14+
has_scipy = True
15+
except ImportError:
16+
has_scipy = False
17+
18+
def requires_scipy(test):
19+
return test if has_scipy else unittest.skip('requires scipy')(test)
20+
21+
def incompatible_conda_linux_py3(test):
22+
"""
23+
Test won't work in Python 3.x due to Anaconda issue.
24+
"""
25+
major = sys.version_info[0]
26+
minor = sys.version_info[1]
27+
system = platform.system()
28+
29+
if major == 3 and system == 'Linux':
30+
out = unittest.skip('error on Linux Python 3 due to Anaconda')(test)
31+
else:
32+
out = test
33+
34+
return out

pvlib/test/test_pvsystem.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from nose.tools import assert_equals, assert_almost_equals
1212
from pandas.util.testing import assert_series_equal, assert_frame_equal
13+
from . import incompatible_conda_linux_py3
1314

1415
from pvlib import tmy
1516
from pvlib import pvsystem
@@ -122,7 +123,7 @@ def test_calcparams_desoto():
122123
EgRef=1.121,
123124
dEgdT=-0.0002677)
124125

125-
126+
@incompatible_conda_linux_py3
126127
def test_i_from_v():
127128
output = pvsystem.i_from_v(20, .1, .5, 40, 6e-7, 7)
128129
assert_almost_equals(-299.746389916, output, 5)
@@ -140,7 +141,7 @@ def test_singlediode_series():
140141
out = pvsystem.singlediode(cecmodule, IL, I0, Rs, Rsh, nNsVth)
141142
assert isinstance(out, pd.DataFrame)
142143

143-
144+
@incompatible_conda_linux_py3
144145
def test_singlediode_series():
145146
cecmodule = sam_data['cecmod'].Example_Module
146147
out = pvsystem.singlediode(cecmodule, 7, 6e-7, .1, 20, .5)

0 commit comments

Comments
 (0)