Fixing test dependencies and other test issues
This commit is contained in:
parent
fac0e44a7e
commit
95592770a7
@ -17,6 +17,7 @@ pytest-repeat
|
||||
pytest-rerunfailures
|
||||
pytest-travis-fold
|
||||
pytest-xvfb
|
||||
requests
|
||||
vulture
|
||||
|
||||
#@ ignore: Jinja2, MarkupSafe, colorama
|
||||
|
@ -1,4 +1,4 @@
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2017 Michal Siedlaczek <michal.siedlaczek@gmail.com>
|
||||
|
||||
@ -20,12 +20,13 @@
|
||||
"""Installing and configuring spell-checking for QtWebEngine."""
|
||||
|
||||
import os
|
||||
from urllib.parse import urljoin
|
||||
from urllib.request import urlretrieve
|
||||
from qutebrowser import basedir
|
||||
|
||||
from PyQt5.QtCore import QLibraryInfo
|
||||
|
||||
repository_url = 'https://redirector.gvt1.com/edgedl/chrome/dict'
|
||||
repository_url = 'https://redirector.gvt1.com/edgedl/chrome/dict/'
|
||||
|
||||
|
||||
class Language:
|
||||
|
||||
@ -77,8 +78,8 @@ class Language:
|
||||
|
||||
def get_dictionary_dir():
|
||||
"""Return the path to the QtWebEngine's dictionaries directory."""
|
||||
return QLibraryInfo.location(QLibraryInfo.DataPath) + \
|
||||
'/qtwebengine_dictionaries'
|
||||
return os.path.join(QLibraryInfo.location(QLibraryInfo.DataPath),
|
||||
'/qtwebengine_dictionaries')
|
||||
|
||||
|
||||
def get_language_list_file():
|
||||
@ -132,13 +133,14 @@ def install(languages):
|
||||
for lang in languages:
|
||||
try:
|
||||
print('Installing {}: {}'.format(lang.code, lang.name))
|
||||
lang_url = '{}/{}'.format(repository_url, lang.file)
|
||||
lang_url = urljoin(repository_url, lang.file)
|
||||
if not os.path.isdir(get_dictionary_dir()):
|
||||
print('WARN: {} does not exist, creating the directory'.format(
|
||||
get_dictionary_dir()))
|
||||
os.makedirs(get_dictionary_dir())
|
||||
print('Downloading {}'.format(lang_url))
|
||||
urlretrieve(lang_url, get_dictionary_dir() + '/' + lang.file)
|
||||
urlretrieve(lang_url,
|
||||
os.path.join(get_dictionary_dir(), lang.file))
|
||||
print('Done.')
|
||||
except PermissionError as e:
|
||||
print(e)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et
|
||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
||||
|
||||
# Copyright 2017 Michal Siedlaczek <michal.siedlaczek@gmail.com>
|
||||
|
||||
|
@ -19,9 +19,10 @@
|
||||
|
||||
|
||||
from os.path import basename
|
||||
from requests import head
|
||||
from urllib.parse import urljoin
|
||||
|
||||
import pytest
|
||||
from requests import head
|
||||
|
||||
from qutebrowser.browser.webengine import spell
|
||||
|
||||
@ -78,6 +79,6 @@ def test_install(tmpdir, mocker):
|
||||
|
||||
def test_available_langs():
|
||||
for lang in spell.get_available_languages():
|
||||
lang_url = '{}/{}'.format(spell.repository_url, lang.file)
|
||||
lang_url = urljoin(spell.repository_url, lang.file)
|
||||
response = head(lang_url)
|
||||
assert response.status_code == 302
|
||||
|
Loading…
Reference in New Issue
Block a user