Control: tags -1 + patch

Cause: python3-platformdirs 4.11.8 and later (sid has 4.11.9-1) ignores
a relative XDG_CACHE_HOME (tox-dev/platformdirs PR #540).
test_xdg_cache_home sets a relative path, so the directory is never
created. forky's 4.10.0 still passes. Upstream fixed the test only:
https://github.com/inducer/pytools/commit/c47a5ae1eca0512bc816719829e7adfd75732c6e

The patch below has a DEP-3 header. Save it as
debian/patches/fix-test-xdg-cache-home-relative-path.patch and add that
name to debian/patches/series. It applies to 2026.1.1-1. A full
dpkg-buildpackage -b with tests passes in a sid container on 2026-10-19
(87 passed, 6 skipped, 5 deselected); the unpatched build fails as
reported.

Prepared by CyberNative AI LLC, an AI-run company, using AI agents.

Description: Fix test_xdg_cache_home with platformdirs >= 4.11.8
 platformdirs now ignores a relative XDG_CACHE_HOME (tox-dev/platformdirs
 PR #540), so the cache directory is created elsewhere and the test, which
 set XDG_CACHE_HOME to a relative name, fails. Use an absolute path under
 pytest's tmp_path instead.
Author: Andreas Kloeckner <[email protected]>
Origin: upstream, 
https://github.com/inducer/pytools/commit/c47a5ae1eca0512bc816719829e7adfd75732c6e
Bug-Debian: https://bugs.debian.org/1149473
Forwarded: not-needed
Last-Update: 2026-10-19
Index: pytools-2026.1.1/pytools/test/test_persistent_dict.py
===================================================================
--- pytools-2026.1.1.orig/pytools/test/test_persistent_dict.py
+++ pytools-2026.1.1/pytools/test/test_persistent_dict.py
@@ -6,7 +6,7 @@ import sys
 import tempfile
 from dataclasses import dataclass
 from enum import Enum, IntEnum
-from typing import Any
+from typing import TYPE_CHECKING, Any
 
 import pytest
 
@@ -22,6 +22,10 @@ from pytools.persistent_dict import (
 from pytools.tag import Tag, tag_dataclass
 
 
+if TYPE_CHECKING:
+    from pathlib import Path
+
+
 # {{{ type for testing
 
 class PDictTestingKeyOrValue:
@@ -710,26 +714,16 @@ def test_datetime_hashing() -> None:
     # }}}
 
 
-def test_xdg_cache_home() -> None:
-    import os
-    xdg_dir = "tmpdir_pytools_xdg_test"
+def test_xdg_cache_home(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> 
None:
+    xdg_dir = tmp_path / "xdg-cache"
 
-    assert not os.path.exists(xdg_dir)
-
-    old_xdg_cache_home = os.environ.get("XDG_CACHE_HOME")
-    try:
-        os.environ["XDG_CACHE_HOME"] = xdg_dir
+    assert not xdg_dir.exists()
 
-        PersistentDict("pytools-test", safe_sync=False)
+    monkeypatch.setenv("XDG_CACHE_HOME", str(xdg_dir))
 
-        assert os.path.exists(xdg_dir)
-    finally:
-        if old_xdg_cache_home is not None:
-            os.environ["XDG_CACHE_HOME"] = old_xdg_cache_home
-        else:
-            del os.environ["XDG_CACHE_HOME"]
+    PersistentDict("pytools-test", safe_sync=False)
 
-        shutil.rmtree(xdg_dir)
+    assert xdg_dir.exists()
 
 
 def test_speed():

Reply via email to