Use utils.yaml_load where possible
This commit is contained in:
parent
94c8d1b83e
commit
f5380ea681
@ -778,7 +778,7 @@ class QuteProc(testprocess.Process):
|
|||||||
data = f.read()
|
data = f.read()
|
||||||
|
|
||||||
self._log('\nCurrent session data:\n' + data)
|
self._log('\nCurrent session data:\n' + data)
|
||||||
return yaml.load(data)
|
return utils.yaml_load(data)
|
||||||
|
|
||||||
def get_content(self, plain=True):
|
def get_content(self, plain=True):
|
||||||
"""Get the contents of the current page."""
|
"""Get the contents of the current page."""
|
||||||
|
@ -24,10 +24,11 @@ import os.path
|
|||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
import yaml
|
|
||||||
import pytest
|
import pytest
|
||||||
import bs4
|
import bs4
|
||||||
|
|
||||||
|
from qutebrowser.utils import utils
|
||||||
|
|
||||||
|
|
||||||
def collect_tests():
|
def collect_tests():
|
||||||
basedir = os.path.dirname(__file__)
|
basedir = os.path.dirname(__file__)
|
||||||
@ -58,12 +59,13 @@ def _parse_file(test_name):
|
|||||||
with open(file_path, 'r', encoding='utf-8') as html:
|
with open(file_path, 'r', encoding='utf-8') as html:
|
||||||
soup = bs4.BeautifulSoup(html, 'html.parser')
|
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:
|
if comment is None:
|
||||||
raise InvalidFile(test_name, "no comment found")
|
raise InvalidFile(test_name, "no comment found")
|
||||||
|
|
||||||
data = yaml.load(comment)
|
data = utils.yaml_load(comment)
|
||||||
|
|
||||||
if not isinstance(data, dict):
|
if not isinstance(data, dict):
|
||||||
raise InvalidFile(test_name, "expected yaml dict but got {}".format(
|
raise InvalidFile(test_name, "expected yaml dict but got {}".format(
|
||||||
type(data).__name__))
|
type(data).__name__))
|
||||||
|
Loading…
Reference in New Issue
Block a user