test.py: Show a *specific* error if the apiKey is not set, instead of causing a TypeError [ci skip]

This commit is contained in:
GLolol 2014-10-24 21:26:59 -07:00
parent 85f982b7de
commit f9fc58c95f

View File

@ -14,6 +14,11 @@ class WeatherTestCase(PluginTestCase):
def setUp(self): def setUp(self):
PluginTestCase.setUp(self) PluginTestCase.setUp(self)
apiKey = os.environ.get('apiKey') apiKey = os.environ.get('apiKey')
if not apiKey:
e = """The Wunderground API key has not been set.
please set this value correctly and try again:
'export apiKey=<key>' for bash users"""
raise Exception(e)
conf.supybot.plugins.Weather.apiKey.setValue(apiKey) conf.supybot.plugins.Weather.apiKey.setValue(apiKey)
def testWeather(self): def testWeather(self):