1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2025-02-26 07:53:58 +00:00

add compatibility test: legacy vs. non-legacy platformdirs

This commit is contained in:
Thomas Waldmann 2023-02-03 18:22:51 +01:00
parent 6c7efbe128
commit d3d909ad31
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -607,6 +607,19 @@ def test_get_config_dir(monkeypatch):
assert get_config_dir() == "/var/tmp" assert get_config_dir() == "/var/tmp"
def test_get_config_dir_compat(monkeypatch):
"""test that it works the same for legacy and for non-legacy implementation"""
monkeypatch.delenv("BORG_CONFIG_DIR", raising=False)
monkeypatch.delenv("XDG_CONFIG_HOME", raising=False)
assert get_config_dir(legacy=False) == get_config_dir(legacy=True)
# TODO 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)
# TODO fails on macOS: assert '/Users/tw/Library/Preferences/borg' == '/var/tmp/.config1/borg'
monkeypatch.setenv("BORG_CONFIG_DIR", "/var/tmp/.config2")
assert get_config_dir(legacy=False) == get_config_dir(legacy=True)
def test_get_cache_dir(monkeypatch): def test_get_cache_dir(monkeypatch):
"""test that get_cache_dir respects environment""" """test that get_cache_dir respects environment"""
monkeypatch.delenv("BORG_CACHE_DIR", raising=False) monkeypatch.delenv("BORG_CACHE_DIR", raising=False)