Skip to content

Commit a49b496

Browse files
committed
allow for missing spa files in tests
1 parent 50302c9 commit a49b496

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

pvlib/test/test_solarposition.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import pandas as pd
88

99
from nose.tools import raises, assert_almost_equals
10+
from nose.plugins.skip import SkipTest
1011
from pandas.util.testing import assert_frame_equal
1112

1213
from pvlib.location import Location
@@ -30,8 +31,10 @@
3031

3132
def test_spa_physical():
3233
times = pd.date_range(datetime.datetime(2003,10,17,12,30,30), periods=1, freq='D')
33-
ephem_data = solarposition.spa(times, golden_mst).ix[0]
34-
34+
try:
35+
ephem_data = solarposition.spa(times, golden_mst).ix[0]
36+
except ImportError:
37+
raise SkipTest
3538
assert_almost_equals(50.111622, ephem_data['zenith'], 6)
3639
assert_almost_equals(194.340241, ephem_data['azimuth'], 6)
3740
assert_almost_equals(39.888378, ephem_data['elevation'], 6)
@@ -40,17 +43,21 @@ def test_spa_physical():
4043

4144
def test_spa_physical_dst():
4245
times = pd.date_range(datetime.datetime(2003,10,17,13,30,30), periods=1, freq='D')
43-
ephem_data = solarposition.spa(times, golden).ix[0]
44-
46+
try:
47+
ephem_data = solarposition.spa(times, golden).ix[0]
48+
except ImportError:
49+
raise SkipTest
4550
assert_almost_equals(50.111622, ephem_data['zenith'], 6)
4651
assert_almost_equals(194.340241, ephem_data['azimuth'], 6)
4752
assert_almost_equals(39.888378, ephem_data['elevation'], 6)
4853

4954

5055

5156
def test_spa_localization():
52-
assert_frame_equal(solarposition.spa(times, tus), solarposition.spa(times_localized, tus))
53-
57+
try:
58+
assert_frame_equal(solarposition.spa(times, tus), solarposition.spa(times_localized, tus))
59+
except ImportError:
60+
raise SkipTest
5461

5562

5663
def test_pyephem_physical():

0 commit comments

Comments
 (0)