mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 01:51:46 +04:00
Adhere to XDG specification for cache dir.
This commit is contained in:
parent
ef8347cf2d
commit
0120af56a7
9 changed files with 50 additions and 17 deletions
|
|
@ -29,7 +29,15 @@ def test_our_session_fixture_works():
|
|||
def test_get_default_directory_defaults_to_home():
|
||||
# Not we use the module level one which is not mocked
|
||||
ret = _get_default_directory()
|
||||
assert ret == os.path.join(os.path.expanduser('~'), '.pre-commit')
|
||||
assert ret == os.path.join(os.path.expanduser('~/.cache'), 'pre-commit')
|
||||
|
||||
|
||||
def test_adheres_to_xdg_specification():
|
||||
with mock.patch.dict(
|
||||
os.environ, {'XDG_CACHE_HOME': '/tmp/fakehome'},
|
||||
):
|
||||
ret = _get_default_directory()
|
||||
assert ret == os.path.join('/tmp/fakehome', 'pre-commit')
|
||||
|
||||
|
||||
def test_uses_environment_variable_when_present():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue