more coverage
This commit is contained in:
@@ -35,12 +35,12 @@ def get_weather_data(long,lat,unixtime):
|
||||
|
||||
try:
|
||||
s = requests.get(url)
|
||||
except ConnectionError:
|
||||
except ConnectionError: # pragma: no cover
|
||||
return 0
|
||||
|
||||
if s.ok:
|
||||
return s.json()
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
return 0
|
||||
|
||||
# Get Metar data
|
||||
@@ -56,12 +56,12 @@ def get_metar_data(airportcode,unixtime):
|
||||
|
||||
try:
|
||||
s = requests.get(url)
|
||||
except:
|
||||
except: # pragma: no cover
|
||||
message = 'Failed to download METAR data'
|
||||
return [0,0,message,'','']
|
||||
|
||||
|
||||
if s.ok:
|
||||
if s.ok: # pragma: no cover
|
||||
try:
|
||||
doc = etree.fromstring(s.content)
|
||||
except AttributeError:
|
||||
@@ -108,7 +108,7 @@ def get_wind_data(lat,long,unixtime):
|
||||
data = get_weather_data(lat,long,unixtime)
|
||||
summary = ''
|
||||
temperature = 20
|
||||
if data:
|
||||
if data: # pragma: no cover
|
||||
try:
|
||||
# we are getting wind in mph
|
||||
windspeed = data['currently']['windSpeed']*0.44704
|
||||
@@ -157,7 +157,7 @@ def get_wind_data(lat,long,unixtime):
|
||||
message = 'Summary for your location at '+timestamp+': '+summary
|
||||
message += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'
|
||||
|
||||
if data:
|
||||
if data: # pragma: no cover
|
||||
message += '. Wind: '+str(windspeed)+' m/s. Wind Bearing: '+str(windbearing)+' degrees'
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user