From 79b3f26de8e0e6724735a7e3782307aacedfc17b Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 28 Jul 2016 07:19:09 +0200 Subject: [PATCH] Decode HTML in test_filescheme Otherwise we get a BytesWarning inside BeautifulSoup --- tests/unit/browser/webkit/network/test_filescheme.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/browser/webkit/network/test_filescheme.py b/tests/unit/browser/webkit/network/test_filescheme.py index 9d5f46c31..c18da6934 100644 --- a/tests/unit/browser/webkit/network/test_filescheme.py +++ b/tests/unit/browser/webkit/network/test_filescheme.py @@ -116,7 +116,7 @@ class TestDirbrowserHtml: def parser(self): """Provide a function to get a parsed dirbrowser document.""" def parse(path): - html = filescheme.dirbrowser_html(path) + html = filescheme.dirbrowser_html(path).decode('utf-8') soup = bs4.BeautifulSoup(html, 'html.parser') print(soup.prettify()) container = soup('div', id='dirbrowserContainer')[0] @@ -143,7 +143,7 @@ class TestDirbrowserHtml: return parse def test_basic(self): - html = filescheme.dirbrowser_html(os.getcwd()) + html = filescheme.dirbrowser_html(os.getcwd()).decode('utf-8') soup = bs4.BeautifulSoup(html, 'html.parser') print(soup.prettify()) container = soup.div @@ -157,7 +157,7 @@ class TestDirbrowserHtml: monkeypatch.setattr('qutebrowser.utils.jinja.utils.resource_filename', lambda name: '/test path/foo.svg') - html = filescheme.dirbrowser_html(os.getcwd()) + html = filescheme.dirbrowser_html(os.getcwd()).decode('utf-8') soup = bs4.BeautifulSoup(html, 'html.parser') print(soup.prettify()) @@ -229,7 +229,7 @@ class TestDirbrowserHtml: m = mocker.patch('qutebrowser.browser.webkit.network.filescheme.' 'os.listdir') m.side_effect = OSError('Error message') - html = filescheme.dirbrowser_html('') + html = filescheme.dirbrowser_html('').decode('utf-8') soup = bs4.BeautifulSoup(html, 'html.parser') print(soup.prettify()) error_msg = soup('p', id='error-message-text')[0].string