Skip to content

avoid the conda/travis/pip/scipy mess with a simple skip #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 15, 2016
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
20 changes: 1 addition & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,8 @@ matrix:
env: CONDA_ENV=py27
- python: 3.4
env: CONDA_ENV=py34
addons:
apt:
packages:
- libatlas-dev
- libatlas-base-dev
- liblapack-dev
- gfortran
- libgmp-dev
- libmpfr-dev
- python: 3.5
env: CONDA_ENV=py35
addons:
apt:
packages:
- libatlas-dev
- libatlas-base-dev
- liblapack-dev
- gfortran
- libgmp-dev
- libmpfr-dev

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

script:
Expand Down
7 changes: 4 additions & 3 deletions ci/requirements-py34.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: test_env
dependencies:
- python=3.4
- numpy
- scipy
- pandas
- nose
- pytz
- ephem
#- numba
- numba
- pip:
- numpy
- pandas
- coveralls
7 changes: 4 additions & 3 deletions ci/requirements-py35.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: test_env
dependencies:
- python=3.5
- numpy
- scipy
- pandas
- nose
- pytz
- ephem
# - numba
- numba
- pip:
- numpy
- pandas
- coveralls
34 changes: 34 additions & 0 deletions pvlib/test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# the has/skip patterns closely follow the examples set by
# the xray/xarray project

import sys
import platform

try:
import unittest2 as unittest
except ImportError:
import unittest

try:
import scipy
has_scipy = True
except ImportError:
has_scipy = False

def requires_scipy(test):
return test if has_scipy else unittest.skip('requires scipy')(test)

def incompatible_conda_linux_py3(test):
"""
Test won't work in Python 3.x due to Anaconda issue.
"""
major = sys.version_info[0]
minor = sys.version_info[1]
system = platform.system()

if major == 3 and system == 'Linux':
out = unittest.skip('error on Linux Python 3 due to Anaconda')(test)
else:
out = test

return out
5 changes: 3 additions & 2 deletions pvlib/test/test_pvsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from nose.tools import assert_equals, assert_almost_equals
from pandas.util.testing import assert_series_equal, assert_frame_equal
from . import incompatible_conda_linux_py3

from pvlib import tmy
from pvlib import pvsystem
Expand Down Expand Up @@ -122,7 +123,7 @@ def test_calcparams_desoto():
EgRef=1.121,
dEgdT=-0.0002677)


@incompatible_conda_linux_py3
def test_i_from_v():
output = pvsystem.i_from_v(20, .1, .5, 40, 6e-7, 7)
assert_almost_equals(-299.746389916, output, 5)
Expand All @@ -140,7 +141,7 @@ def test_singlediode_series():
out = pvsystem.singlediode(cecmodule, IL, I0, Rs, Rsh, nNsVth)
assert isinstance(out, pd.DataFrame)


@incompatible_conda_linux_py3
def test_singlediode_series():
cecmodule = sam_data['cecmod'].Example_Module
out = pvsystem.singlediode(cecmodule, 7, 6e-7, .1, 20, .5)
Expand Down