Use utils.yaml_load where possible

This commit is contained in:
Florian Bruhin 2018-10-24 08:38:45 +02:00
parent 94c8d1b83e
commit f5380ea681
2 changed files with 6 additions and 4 deletions

View File

@ -778,7 +778,7 @@ class QuteProc(testprocess.Process):
data = f.read()
self._log('\nCurrent session data:\n' + data)
return yaml.load(data)
return utils.yaml_load(data)
def get_content(self, plain=True):
"""Get the contents of the current page."""

View File

@ -24,10 +24,11 @@ import os.path
import textwrap
import attr
import yaml
import pytest
import bs4
from qutebrowser.utils import utils
def collect_tests():
basedir = os.path.dirname(__file__)
@ -58,12 +59,13 @@ def _parse_file(test_name):
with open(file_path, 'r', encoding='utf-8') as html:
soup = bs4.BeautifulSoup(html, 'html.parser')
comment = soup.find(text=lambda text: isinstance(text, bs4.Comment))
comment = str(soup.find(text=lambda text: isinstance(text, bs4.Comment)))
if comment is None:
raise InvalidFile(test_name, "no comment found")
data = yaml.load(comment)
data = utils.yaml_load(comment)
if not isinstance(data, dict):
raise InvalidFile(test_name, "expected yaml dict but got {}".format(
type(data).__name__))