14
14
)
15
15
from .conftest import RERUNS , RERUNS_DELAY
16
16
17
+ from pvlib ._deprecation import pvlibDeprecationWarning
18
+
17
19
pytestmark = pytest .mark .skipif (not has_siphon , reason = 'requires siphon' )
18
20
19
21
52
54
@requires_siphon
53
55
@pytest .fixture (scope = 'module' , params = _modelclasses )
54
56
def model (request ):
55
- amodel = request .param ()
57
+ with pytest .warns (pvlibDeprecationWarning ):
58
+ amodel = request .param ()
56
59
try :
57
60
raw_data = amodel .get_data (_latitude , _longitude , _start , _end )
58
61
except Exception as e :
@@ -90,7 +93,8 @@ def test_process_data(model):
90
93
def test_bad_kwarg_get_data ():
91
94
# For more information on why you would want to pass an unknown keyword
92
95
# argument, see Github issue #745.
93
- amodel = NAM ()
96
+ with pytest .warns (pvlibDeprecationWarning ):
97
+ amodel = NAM ()
94
98
data = amodel .get_data (_latitude , _longitude , _start , _end ,
95
99
bad_kwarg = False )
96
100
assert not data .empty
@@ -103,7 +107,8 @@ def test_bad_kwarg_get_data():
103
107
def test_bad_kwarg_get_processed_data ():
104
108
# For more information on why you would want to pass an unknown keyword
105
109
# argument, see Github issue #745.
106
- amodel = NAM ()
110
+ with pytest .warns (pvlibDeprecationWarning ):
111
+ amodel = NAM ()
107
112
data = amodel .get_processed_data (_latitude , _longitude , _start , _end ,
108
113
bad_kwarg = False )
109
114
assert not data .empty
@@ -114,7 +119,8 @@ def test_bad_kwarg_get_processed_data():
114
119
@pytest .mark .remote_data
115
120
@pytest .mark .flaky (reruns = RERUNS , reruns_delay = RERUNS_DELAY )
116
121
def test_how_kwarg_get_processed_data ():
117
- amodel = NAM ()
122
+ with pytest .warns (pvlibDeprecationWarning ):
123
+ amodel = NAM ()
118
124
data = amodel .get_processed_data (_latitude , _longitude , _start , _end ,
119
125
how = 'clearsky_scaling' )
120
126
assert not data .empty
@@ -125,7 +131,8 @@ def test_how_kwarg_get_processed_data():
125
131
@pytest .mark .remote_data
126
132
@pytest .mark .flaky (reruns = RERUNS , reruns_delay = RERUNS_DELAY )
127
133
def test_vert_level ():
128
- amodel = NAM ()
134
+ with pytest .warns (pvlibDeprecationWarning ):
135
+ amodel = NAM ()
129
136
vert_level = 5000
130
137
amodel .get_processed_data (_latitude , _longitude , _start , _end ,
131
138
vert_level = vert_level )
@@ -136,7 +143,8 @@ def test_vert_level():
136
143
@pytest .mark .remote_data
137
144
@pytest .mark .flaky (reruns = RERUNS , reruns_delay = RERUNS_DELAY )
138
145
def test_datetime ():
139
- amodel = NAM ()
146
+ with pytest .warns (pvlibDeprecationWarning ):
147
+ amodel = NAM ()
140
148
start = datetime .now (tz = timezone .utc )
141
149
end = start + timedelta (days = 1 )
142
150
amodel .get_processed_data (_latitude , _longitude , start , end )
@@ -147,7 +155,8 @@ def test_datetime():
147
155
@pytest .mark .remote_data
148
156
@pytest .mark .flaky (reruns = RERUNS , reruns_delay = RERUNS_DELAY )
149
157
def test_queryvariables ():
150
- amodel = GFS ()
158
+ with pytest .warns (pvlibDeprecationWarning ):
159
+ amodel = GFS ()
151
160
new_variables = ['u-component_of_wind_height_above_ground' ]
152
161
data = amodel .get_data (_latitude , _longitude , _start , _end ,
153
162
query_variables = new_variables )
@@ -156,16 +165,19 @@ def test_queryvariables():
156
165
157
166
@requires_siphon
158
167
def test_latest ():
159
- GFS (set_type = 'latest' )
168
+ with pytest .warns (pvlibDeprecationWarning ):
169
+ GFS (set_type = 'latest' )
160
170
161
171
162
172
@requires_siphon
163
173
def test_full ():
164
- GFS (set_type = 'full' )
174
+ with pytest .warns (pvlibDeprecationWarning ):
175
+ GFS (set_type = 'full' )
165
176
166
177
167
178
def test_temp_convert ():
168
- amodel = GFS ()
179
+ with pytest .warns (pvlibDeprecationWarning ):
180
+ amodel = GFS ()
169
181
data = pd .DataFrame ({'temp_air' : [273.15 ]})
170
182
data ['temp_air' ] = amodel .kelvin_to_celsius (data ['temp_air' ])
171
183
@@ -183,27 +195,31 @@ def test_temp_convert():
183
195
184
196
185
197
def test_set_location ():
186
- amodel = GFS ()
198
+ with pytest .warns (pvlibDeprecationWarning ):
199
+ amodel = GFS ()
187
200
latitude , longitude = 32.2 , - 110.9
188
201
time = 'UTC'
189
202
amodel .set_location (time , latitude , longitude )
190
203
191
204
192
205
def test_set_query_time_range_tzfail ():
193
- amodel = GFS ()
206
+ with pytest .warns (pvlibDeprecationWarning ):
207
+ amodel = GFS ()
194
208
with pytest .raises (TypeError ):
195
209
amodel .set_query_time_range (datetime .now (), datetime .now ())
196
210
197
211
198
212
def test_cloud_cover_to_transmittance_linear ():
199
- amodel = GFS ()
213
+ with pytest .warns (pvlibDeprecationWarning ):
214
+ amodel = GFS ()
200
215
assert_allclose (amodel .cloud_cover_to_transmittance_linear (0 ), 0.75 )
201
216
assert_allclose (amodel .cloud_cover_to_transmittance_linear (100 ), 0.0 )
202
217
assert_allclose (amodel .cloud_cover_to_transmittance_linear (0 , 0.5 ), 0.5 )
203
218
204
219
205
220
def test_cloud_cover_to_ghi_linear ():
206
- amodel = GFS ()
221
+ with pytest .warns (pvlibDeprecationWarning ):
222
+ amodel = GFS ()
207
223
ghi_clear = 1000
208
224
offset = 25
209
225
out = amodel .cloud_cover_to_ghi_linear (0 , ghi_clear , offset = offset )
0 commit comments