Skip to content

Commit 3ab10f5

Browse files
committed
Increase robustness
1 parent 1d8c97d commit 3ab10f5

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Diff for: Scripts/checkcurrentweather.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ def get_weather(lat,lon,apikey,**kwargs):
2626
'''get current conditions in specified location, e.g.,
2727
lat = 42.2775 N, lon = 71.3468 W is Natick, MA, US
2828
get_current_weather('42.2775','-71.3468',key,units='metric')'''
29-
29+
30+
# Initialize json_data
31+
json_data = {'Feedback': 'nothing'}
32+
3033
# Set a default of imperial units
3134
info = {'units':'imperial'}
3235
for key, value in kwargs.items():
@@ -45,6 +48,9 @@ def get_weather(lat,lon,apikey,**kwargs):
4548
def parse_current_json(json_data):
4649
'''parse and extract json data from the current weather data'''
4750

51+
# Initialize weather_info
52+
weather_info = {'Feedback': 'nothing'}
53+
4854
try:
4955
# select data of interest from dictionary
5056
weather_info = json_data['main']

Diff for: Scripts/checkweather.py

+7
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ def get_weather(lat,lon,apikey,**kwargs):
2727
lat = 42.2775 N, lon = 71.3468 W is Natick, MA, US
2828
get_current_weather('42.2775','-71.3468',key,units='metric')'''
2929

30+
# Initialize json_data
31+
json_data = {'Feedback': 'nothing'}
32+
3033
# Set a default of imperial units
3134
info = {'units':'imperial'}
3235
for key, value in kwargs.items():
@@ -44,6 +47,8 @@ def get_weather(lat,lon,apikey,**kwargs):
4447

4548
def parse_current_json(json_data):
4649
'''parse and extract json data from the current weather data'''
50+
# Initialize weather_info
51+
weather_info = {'Feedback': 'nothing'}
4752

4853
try:
4954
# select data of interest from dictionary
@@ -73,6 +78,8 @@ def parse_forecast(json_data):
7378

7479
import array
7580

81+
weather_info = {'Feedback': 'nothing'}
82+
7683
try:
7784
timezone = json_data['timezone']
7885
data = json_data['hourly']

Diff for: SoftwareTests/SmokeTests.m

+4
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function SimpleSmokeTest(testCase,Filename)
114114
end
115115

116116
% Log the opened figures to the test reports
117+
try
117118
Figures = findall(groot,'Type','figure');
118119
Figures = flipud(Figures);
119120
if ~isempty(Figures)
@@ -122,6 +123,9 @@ function SimpleSmokeTest(testCase,Filename)
122123
log(testCase,1,FigDiag);
123124
end
124125
end
126+
catch ME
127+
disp("Failed to capture figures")
128+
end
125129
close all
126130

127131
end

0 commit comments

Comments
 (0)