Fix intents
This commit is contained in:
parent
b5eea81e2e
commit
f5d299d8c7
@ -820,9 +820,9 @@ class File(BaseType):
|
|||||||
value = os.path.expanduser(value)
|
value = os.path.expanduser(value)
|
||||||
try:
|
try:
|
||||||
if not os.path.isabs(value):
|
if not os.path.isabs(value):
|
||||||
if standarddir.config():
|
cfgdir = standarddir.config()
|
||||||
if os.path.isfile(
|
if cfgdir:
|
||||||
os.path.join(standarddir.config(), value)):
|
if os.path.isfile(os.path.join(cfgdir, value)):
|
||||||
return
|
return
|
||||||
raise configexc.ValidationError(value,
|
raise configexc.ValidationError(value,
|
||||||
"must be an absolute path!")
|
"must be an absolute path!")
|
||||||
|
@ -30,7 +30,7 @@ from PyQt5.QtGui import QColor, QFont
|
|||||||
from PyQt5.QtNetwork import QNetworkProxy
|
from PyQt5.QtNetwork import QNetworkProxy
|
||||||
|
|
||||||
from qutebrowser.config import configtypes, configexc
|
from qutebrowser.config import configtypes, configexc
|
||||||
from qutebrowser.utils import debug, utils, standarddir
|
from qutebrowser.utils import debug, utils
|
||||||
|
|
||||||
|
|
||||||
class Font(QFont):
|
class Font(QFont):
|
||||||
@ -1375,19 +1375,19 @@ class TestFile:
|
|||||||
|
|
||||||
def test_validate_exists_rel(self, os_path, monkeypatch):
|
def test_validate_exists_rel(self, os_path, monkeypatch):
|
||||||
"""Test validate with a relative path to an existing file."""
|
"""Test validate with a relative path to an existing file."""
|
||||||
monkeypatch.setattr('qutebrowser.config.configtypes.standarddir.config',
|
monkeypatch.setattr(
|
||||||
|
'qutebrowser.config.configtypes.standarddir.config',
|
||||||
lambda: '/home/foo/.config/')
|
lambda: '/home/foo/.config/')
|
||||||
os_path.expanduser.side_effect = lambda x: x
|
os_path.expanduser.side_effect = lambda x: x
|
||||||
os_path.isfile.return_value = True
|
os_path.isfile.return_value = True
|
||||||
os_path.isabs.return_value = False
|
os_path.isabs.return_value = False
|
||||||
self.t.validate('foobar')
|
self.t.validate('foobar')
|
||||||
os_path.join.assert_called_once_with('/home/foo/.config/',
|
os_path.join.assert_called_once_with('/home/foo/.config/', 'foobar')
|
||||||
'foobar')
|
|
||||||
|
|
||||||
def test_validate_rel_config_none(self, os_path, monkeypatch):
|
def test_validate_rel_config_none(self, os_path, monkeypatch):
|
||||||
"""Test with a relative path and standarddir.config returning None."""
|
"""Test with a relative path and standarddir.config returning None."""
|
||||||
monkeypatch.setattr('qutebrowser.config.configtypes.standarddir.config',
|
monkeypatch.setattr(
|
||||||
lambda: None)
|
'qutebrowser.config.configtypes.standarddir.config', lambda: None)
|
||||||
os_path.isabs.return_value = False
|
os_path.isabs.return_value = False
|
||||||
with pytest.raises(configexc.ValidationError):
|
with pytest.raises(configexc.ValidationError):
|
||||||
self.t.validate('foobar')
|
self.t.validate('foobar')
|
||||||
|
Loading…
Reference in New Issue
Block a user