enable and fix remaining bookmark tests

biplist module preferred for reading Safari bookmarks in
bookmarks/safari.py so install it for tox testing.
This commit is contained in:
Petr Dlouhý 2019-09-16 20:08:01 +01:00 committed by Chris Mayo
parent 736d2a786d
commit eaa7131523
4 changed files with 10 additions and 7 deletions

View file

@ -18,7 +18,9 @@
import os
import sys
import json
from xdg import xdg_config_home
from xdg.BaseDirectory import xdg_config_home
from .. import url as urlutil
# Windows filename encoding
@ -69,7 +71,7 @@ def parse_bookmark_data (data):
Return iterator for bookmarks of the form (url, name).
Bookmarks are not sorted.
"""
for url, name in parse_bookmark_json(json.loads(data)):
for url, name in parse_bookmark_json(json.loads(urlutil.decode_for_unquote(data))):
yield url, name

View file

@ -63,9 +63,9 @@ def parse_bookmark_data (data):
for line in data.splitlines():
lineno += 1
line = line.strip()
if line.startswith("NAME="):
if line.startswith(b"NAME="):
name = line[5:]
elif line.startswith("URL="):
elif line.startswith(b"URL="):
url = line[4:]
if url and name is not None:
yield (url, name, lineno)

View file

@ -28,17 +28,17 @@ class TestBookmarks (LinkCheckTest):
"""
@need_network
def _test_firefox_bookmarks (self):
def test_firefox_bookmarks (self):
# firefox 3 bookmark file parsing
self.file_test("places.sqlite")
@need_network
def _test_opera_bookmarks (self):
def test_opera_bookmarks (self):
# Opera bookmark file parsing
self.file_test("opera6.adr")
@need_network
def _test_chromium_bookmarks (self):
def test_chromium_bookmarks (self):
# Chromium and Google Chrome bookmark file parsing
self.file_test("Bookmarks")

View file

@ -10,6 +10,7 @@ deps =
pytest-xdist
pytest-cov
miniboa
biplist
commands =
py.test {posargs:--tb=short --cov=linkcheck tests}
setenv =