Fix minor standarddir migration issues
This commit is contained in:
parent
d1e69a75dd
commit
3dc67df180
@ -367,7 +367,7 @@ def _move_data(old, new):
|
|||||||
log.init.debug("Migrating data from {} to {}".format(old, new))
|
log.init.debug("Migrating data from {} to {}".format(old, new))
|
||||||
|
|
||||||
if os.path.exists(new):
|
if os.path.exists(new):
|
||||||
if os.listdir(new):
|
if not os.path.isdir(new) or os.listdir(new):
|
||||||
message.error("Failed to move data from {} as {} is non-empty!"
|
message.error("Failed to move data from {} as {} is non-empty!"
|
||||||
.format(old, new))
|
.format(old, new))
|
||||||
return False
|
return False
|
||||||
|
@ -57,6 +57,7 @@ def test_fake_mac_config(tmpdir, monkeypatch):
|
|||||||
# needs AppDataLocation
|
# needs AppDataLocation
|
||||||
@pytest.mark.qt55
|
@pytest.mark.qt55
|
||||||
@pytest.mark.parametrize('what', ['data', 'config'])
|
@pytest.mark.parametrize('what', ['data', 'config'])
|
||||||
|
@pytest.mark.not_mac
|
||||||
def test_fake_windows_data_config(tmpdir, monkeypatch, what):
|
def test_fake_windows_data_config(tmpdir, monkeypatch, what):
|
||||||
"""Make sure the config is correct on a fake Windows."""
|
"""Make sure the config is correct on a fake Windows."""
|
||||||
monkeypatch.setattr(os, 'name', 'nt')
|
monkeypatch.setattr(os, 'name', 'nt')
|
||||||
@ -158,8 +159,8 @@ class TestStandardDir:
|
|||||||
|
|
||||||
@pytest.mark.parametrize('func, elems, expected', [
|
@pytest.mark.parametrize('func, elems, expected', [
|
||||||
(standarddir.data, 2, ['Application Support', 'qute_test']),
|
(standarddir.data, 2, ['Application Support', 'qute_test']),
|
||||||
(standarddir.config, 1, ['qute_test']),
|
(lambda: standarddir.config(auto=True), 1, ['qute_test']),
|
||||||
(lambda: standarddir.config(auto=True), 0,
|
(standarddir.config, 0,
|
||||||
os.path.expanduser('~').split(os.sep) + ['.qutebrowser']),
|
os.path.expanduser('~').split(os.sep) + ['.qutebrowser']),
|
||||||
(standarddir.cache, 2, ['Caches', 'qute_test']),
|
(standarddir.cache, 2, ['Caches', 'qute_test']),
|
||||||
(standarddir.download, 1, ['Downloads']),
|
(standarddir.download, 1, ['Downloads']),
|
||||||
|
Loading…
Reference in New Issue
Block a user