From e349af7524819cd6982b7721f3b987ddfd7f8206 Mon Sep 17 00:00:00 2001 From: George Edward Bulmer Date: Tue, 13 Feb 2018 14:49:15 +0000 Subject: [PATCH] Fix testing with error pastebin_version() --- tests/unit/utils/test_version.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/utils/test_version.py b/tests/unit/utils/test_version.py index 84d89680c..cbe174b38 100644 --- a/tests/unit/utils/test_version.py +++ b/tests/unit/utils/test_version.py @@ -1001,7 +1001,7 @@ def test_pastebin_version(pbclient, monkeypatch): assert version.pastebin_url == "test" -def test_pastebin_version_error(pbclient, monkeypatch): +def test_pastebin_version_error(pbclient, caplog, monkeypatch): """Test version.pastebin_version() with errors.""" patches = { '_path_info': lambda: {'PATH DESC': 'PATH NAME'}, @@ -1012,8 +1012,8 @@ def test_pastebin_version_error(pbclient, monkeypatch): monkeypatch.setattr('qutebrowser.utils.version.' + name, val) version.pastebin_url = None - version.pastebin_version(pbclient) - try: - pbclient.error.emit("test") - except: - assert version.pastebin_url is None + with caplog.at_level(logging.ERROR): + version.pastebin_version(pbclient) + pbclient._client.error.emit("test") + assert version.pastebin_url is None + assert caplog.records[0].message == "Failed to pastebin version info: test"