From 7ceeb665b0f3a54b1d092791d504691ce328a236 Mon Sep 17 00:00:00 2001 From: Thomas Aarholt Date: Tue, 2 Apr 2024 16:50:45 +0200 Subject: [PATCH] remove unused xdg cache --- src/patito/xdg.py | 25 ------------------------- tests/test_xdg.py | 22 ---------------------- 2 files changed, 47 deletions(-) delete mode 100644 src/patito/xdg.py delete mode 100644 tests/test_xdg.py diff --git a/src/patito/xdg.py b/src/patito/xdg.py deleted file mode 100644 index 828385f..0000000 --- a/src/patito/xdg.py +++ /dev/null @@ -1,25 +0,0 @@ -"""Module implementing the XDG directory standard.""" - -import os -from pathlib import Path -from typing import Optional - - -def cache_home(application: Optional[str] = None) -> Path: - """Return path to directory containing user-specific non-essential data files. - - Args: - ---- - application: An optional name of an application for which to return an - application-specific cache directory for. - - Returns: - ------- - A path object pointing to a directory to store cache files. - - """ - path = Path(os.environ.get("XDG_CACHE_HOME", "~/.cache")).resolve() - if application: - path = path / application - path.mkdir(exist_ok=True, parents=True) - return path diff --git a/tests/test_xdg.py b/tests/test_xdg.py deleted file mode 100644 index 15363b7..0000000 --- a/tests/test_xdg.py +++ /dev/null @@ -1,22 +0,0 @@ -"""Tests for the patito.xdg module.""" - -import os -from pathlib import Path - -from patito import xdg - - -def test_xdg_cache_home(monkeypatch, tmpdir): - """It should yield the correct cache directory according to the standard.""" - xdg_cache_home = tmpdir / ".cache" - os.environ["XDG_CACHE_HOME"] = str(xdg_cache_home) - - assert xdg.cache_home() == xdg_cache_home - assert xdg_cache_home.isdir() - - assert xdg.cache_home(application="patito") == xdg_cache_home / "patito" - assert (xdg_cache_home / "patito").isdir() - - del os.environ["XDG_CACHE_HOME"] - assert xdg.cache_home() == Path("~/.cache").resolve() - assert xdg.cache_home(application="patito") == Path("~/.cache/patito").resolve()