do not fail on macOS due to different dirs from platformdirs

This commit is contained in:
Thomas Waldmann 2023-02-03 22:20:53 +01:00
parent 8379ecefaa
commit 437b5fa859
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -45,7 +45,7 @@ from ..helpers import eval_escapes
from ..helpers import safe_unlink from ..helpers import safe_unlink
from ..helpers import text_to_json, binary_to_json from ..helpers import text_to_json, binary_to_json
from ..helpers.passphrase import Passphrase, PasswordRetriesExceeded from ..helpers.passphrase import Passphrase, PasswordRetriesExceeded
from ..platform import is_cygwin, is_win32 from ..platform import is_cygwin, is_win32, is_darwin
from . import BaseTestCase, FakeInputs, are_hardlinks_supported from . import BaseTestCase, FakeInputs, are_hardlinks_supported
@ -620,13 +620,15 @@ def test_get_config_dir(monkeypatch):
def test_get_config_dir_compat(monkeypatch): def test_get_config_dir_compat(monkeypatch):
"""test that it works the same for legacy and for non-legacy implementation""" """test that it works the same for legacy and for non-legacy implementation"""
monkeypatch.delenv("BORG_CONFIG_DIR", raising=False) if not is_darwin:
monkeypatch.delenv("XDG_CONFIG_HOME", raising=False) monkeypatch.delenv("BORG_CONFIG_DIR", raising=False)
assert get_config_dir(legacy=False) == get_config_dir(legacy=True) monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
# TODO fails on macOS: assert '/Users/tw/Library/Preferences/borg' == '/Users/tw/.config/borg' # fails on macOS: assert '/Users/tw/Library/Preferences/borg' == '/Users/tw/.config/borg'
monkeypatch.setenv("XDG_CONFIG_HOME", "/var/tmp/.config1") assert get_config_dir(legacy=False) == get_config_dir(legacy=True)
assert get_config_dir(legacy=False) == get_config_dir(legacy=True) if not is_darwin:
# TODO fails on macOS: assert '/Users/tw/Library/Preferences/borg' == '/var/tmp/.config1/borg' monkeypatch.setenv("XDG_CONFIG_HOME", "/var/tmp/.config1")
# fails on macOS: assert '/Users/tw/Library/Preferences/borg' == '/var/tmp/.config1/borg'
assert get_config_dir(legacy=False) == get_config_dir(legacy=True)
monkeypatch.setenv("BORG_CONFIG_DIR", "/var/tmp/.config2") monkeypatch.setenv("BORG_CONFIG_DIR", "/var/tmp/.config2")
assert get_config_dir(legacy=False) == get_config_dir(legacy=True) assert get_config_dir(legacy=False) == get_config_dir(legacy=True)