Fix exception type in test_retrieval (#7)

Using json.JSONDecodeError should replace using the 'message'
accessor of exceptions, which Python 3 removed.
This works as long as "simplejson" is not added as project
dependency, because "requests" gives preferential treatment to
simplejson, which ships its own version of JSONDecodeError.
This commit is contained in:
f4lco
2020-04-23 14:18:18 +02:00
parent 5d7eb5c4cb
commit c957fc5b5e
+4 -4
View File
@@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*-
import json
import logging
import os
import pytest
@@ -45,9 +46,8 @@ def test_retrieval(canteen):
try:
menu = download_menu(params)
except ValueError as e:
if e.message == 'No JSON object could be decoded':
pytest.xfail('JSON endpoint returned garbage (issue #6)')
raise e
except json.JSONDecodeError as e:
pytest.xfail('JSON endpoint returned garbage (issue #6)')
raise e # Appease PyCharm inspection - xfail always raises
feed.render_menu(menu)