Fix using a relative path with --basedir
This commit is contained in:
parent
5af93a2a8e
commit
4a5b5c496f
@ -44,6 +44,8 @@ Fixed
|
||||
- When hinting input fields (`:t`), also consider input elements without a type.
|
||||
- Fixed crash when opening an invalid URL with a percent-encoded and a real @ in it
|
||||
- Fixed default `;o` and `;O` bindings
|
||||
- Fixed local storage not working (and possible other bugs) when using a
|
||||
relative path with `--basedir`.
|
||||
|
||||
v0.8.1
|
||||
------
|
||||
|
@ -168,7 +168,7 @@ def _from_args(typ, args):
|
||||
suffix = basedir_suffix[typ]
|
||||
except KeyError: # pragma: no cover
|
||||
return (False, None)
|
||||
return (True, os.path.join(basedir, suffix))
|
||||
return (True, os.path.abspath(os.path.join(basedir, suffix)))
|
||||
|
||||
try:
|
||||
argname = typ_to_argparse_arg[typ]
|
||||
|
@ -225,6 +225,15 @@ class TestArguments:
|
||||
func = getattr(standarddir, typ)
|
||||
assert func() == expected
|
||||
|
||||
def test_basedir_relative(self, tmpdir):
|
||||
"""Test --basedir with a relative path."""
|
||||
basedir = (tmpdir / 'basedir')
|
||||
basedir.ensure(dir=True)
|
||||
with tmpdir.as_cwd():
|
||||
args = types.SimpleNamespace(basedir='basedir')
|
||||
standarddir.init(args)
|
||||
assert standarddir.config() == str(basedir / 'config')
|
||||
|
||||
|
||||
class TestInitCacheDirTag:
|
||||
|
||||
@ -311,6 +320,7 @@ class TestCreatingDir:
|
||||
m.sep = os.sep
|
||||
m.path.join = os.path.join
|
||||
m.path.exists.return_value = False
|
||||
m.path.abspath = lambda x: x
|
||||
|
||||
args = types.SimpleNamespace(basedir=str(tmpdir))
|
||||
standarddir.init(args)
|
||||
|
Loading…
Reference in New Issue
Block a user