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
+3 -3
View File
@@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
import json
import logging import logging
import os import os
import pytest import pytest
@@ -45,9 +46,8 @@ def test_retrieval(canteen):
try: try:
menu = download_menu(params) menu = download_menu(params)
except ValueError as e: except json.JSONDecodeError as e:
if e.message == 'No JSON object could be decoded':
pytest.xfail('JSON endpoint returned garbage (issue #6)') pytest.xfail('JSON endpoint returned garbage (issue #6)')
raise e raise e # Appease PyCharm inspection - xfail always raises
feed.render_menu(menu) feed.render_menu(menu)