Skip to content

Commit 8b30e01

Browse files
committed
merge ci and appveyor changes in pvlib/master into fx-master
2 parents 3a907b6 + 35b6e7b commit 8b30e01

8 files changed

+183
-29
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:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pvlib-python
22
============
33

44
[![TravisCI](https://travis-ci.org/pvlib/pvlib-python.svg?branch=master)](https://travis-ci.org/pvlib/pvlib-python)
5+
[![Build status](https://ci.appveyor.com/api/projects/status/gr2eyhc84tvtkopk?svg=true)](https://ci.appveyor.com/project/wholmgren/pvlib-python-fv2to)
56
[![Coverage Status](https://img.shields.io/coveralls/pvlib/pvlib-python.svg)](https://coveralls.io/r/pvlib/pvlib-python)
67
[![Documentation Status](https://readthedocs.org/projects/pvlib-python/badge/?version=latest)](http://pvlib-python.readthedocs.org/en/latest/)
78
[![DOI](https://zenodo.org/badge/doi/10.5281/zenodo.20562.svg)](http://dx.doi.org/10.5281/zenodo.20562)

appveyor.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# CI on Windows via appveyor
2+
# This file was based on pandas' and xarray's appveyor.yml
3+
# This file was based on Olivier Grisel's python-appveyor-demo
4+
5+
environment:
6+
global:
7+
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
8+
# /E:ON and /V:ON options are not enabled in the batch script intepreter
9+
# See: http://stackoverflow.com/a/13751649/163740
10+
CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd"
11+
12+
matrix:
13+
- PYTHON: "C:\\Python27-conda32"
14+
PYTHON_VERSION: "2.7"
15+
PYTHON_ARCH: "32"
16+
17+
- PYTHON: "C:\\Python34-conda64"
18+
PYTHON_VERSION: "3.4"
19+
PYTHON_ARCH: "64"
20+
21+
install:
22+
# Install miniconda Python
23+
- "powershell ./ci/install_python.ps1"
24+
25+
# Prepend newly installed Python to the PATH of this build (this cannot be
26+
# done from inside the powershell script as it would require to restart
27+
# the parent CMD process).
28+
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
29+
30+
# Check that we have the expected version and architecture for Python
31+
- "python --version"
32+
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
33+
34+
# install xray and depenencies
35+
- "conda install --yes --quiet pip numpy scipy pandas nose pytz ephem numba"
36+
- "python setup.py install"
37+
38+
build: false
39+
40+
test_script:
41+
- "nosetests -v pvlib"

ci/install_python.ps1

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Sample script to install Python and pip under Windows
2+
# Authors: Olivier Grisel, Jonathan Helmus and Kyle Kastner
3+
# License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
4+
5+
$MINICONDA_URL = "http://repo.continuum.io/miniconda/"
6+
$BASE_URL = "https://www.python.org/ftp/python/"
7+
8+
9+
function DownloadMiniconda ($python_version, $platform_suffix) {
10+
$webclient = New-Object System.Net.WebClient
11+
if ($python_version -eq "3.4") {
12+
$filename = "Miniconda3-3.7.3-Windows-" + $platform_suffix + ".exe"
13+
} else {
14+
$filename = "Miniconda-3.7.3-Windows-" + $platform_suffix + ".exe"
15+
}
16+
$url = $MINICONDA_URL + $filename
17+
18+
$basedir = $pwd.Path + "\"
19+
$filepath = $basedir + $filename
20+
if (Test-Path $filename) {
21+
Write-Host "Reusing" $filepath
22+
return $filepath
23+
}
24+
25+
# Download and retry up to 3 times in case of network transient errors.
26+
Write-Host "Downloading" $filename "from" $url
27+
$retry_attempts = 2
28+
for($i=0; $i -lt $retry_attempts; $i++){
29+
try {
30+
$webclient.DownloadFile($url, $filepath)
31+
break
32+
}
33+
Catch [Exception]{
34+
Start-Sleep 1
35+
}
36+
}
37+
if (Test-Path $filepath) {
38+
Write-Host "File saved at" $filepath
39+
} else {
40+
# Retry once to get the error message if any at the last try
41+
$webclient.DownloadFile($url, $filepath)
42+
}
43+
return $filepath
44+
}
45+
46+
47+
function InstallMiniconda ($python_version, $architecture, $python_home) {
48+
Write-Host "Installing Python" $python_version "for" $architecture "bit architecture to" $python_home
49+
if (Test-Path $python_home) {
50+
Write-Host $python_home "already exists, skipping."
51+
return $false
52+
}
53+
if ($architecture -eq "32") {
54+
$platform_suffix = "x86"
55+
} else {
56+
$platform_suffix = "x86_64"
57+
}
58+
$filepath = DownloadMiniconda $python_version $platform_suffix
59+
Write-Host "Installing" $filepath "to" $python_home
60+
$install_log = $python_home + ".log"
61+
$args = "/S /D=$python_home"
62+
Write-Host $filepath $args
63+
Start-Process -FilePath $filepath -ArgumentList $args -Wait -Passthru
64+
if (Test-Path $python_home) {
65+
Write-Host "Python $python_version ($architecture) installation complete"
66+
} else {
67+
Write-Host "Failed to install Python in $python_home"
68+
Get-Content -Path $install_log
69+
Exit 1
70+
}
71+
}
72+
73+
74+
function InstallMinicondaPip ($python_home) {
75+
$pip_path = $python_home + "\Scripts\pip.exe"
76+
$conda_path = $python_home + "\Scripts\conda.exe"
77+
if (-not(Test-Path $pip_path)) {
78+
Write-Host "Installing pip..."
79+
$args = "install --yes pip"
80+
Write-Host $conda_path $args
81+
Start-Process -FilePath "$conda_path" -ArgumentList $args -Wait -Passthru
82+
} else {
83+
Write-Host "pip already installed."
84+
}
85+
}
86+
87+
88+
function main () {
89+
InstallMiniconda $env:PYTHON_VERSION $env:PYTHON_ARCH $env:PYTHON
90+
InstallMinicondaPip $env:PYTHON
91+
}
92+
93+
main

ci/requirements-py34.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ channels:
44
- http://conda.anaconda.org/Unidata
55
dependencies:
66
- python=3.4
7+
- numpy
8+
- scipy
9+
- pandas
710
- nose
811
- pytz
912
- ephem
10-
- siphon
11-
#- numba
13+
- numba
14+
- siphon
1215
- pip:
13-
- numpy
14-
- pandas
1516
- coveralls

ci/requirements-py35.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ channels:
44
- http://conda.anaconda.org/Unidata
55
dependencies:
66
- python=3.5
7+
- numpy
8+
- scipy
9+
- pandas
710
- nose
811
- pytz
912
- ephem
10-
- siphon
11-
# - numba
13+
- numba
14+
- siphon
1215
- pip:
13-
- numpy
14-
- pandas
1516
- 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)