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. Upstream fixed the test only:
https://github.com/inducer/pyopencl/commit/f223914286484ce3f7a5ed0560981928506d61e0
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 2025.1-2. On 2026-10-19 in
a sid container with pocl CPU, the unpatched test fails as reported and
the patched test passes against the built extension. We did not rerun
the full suite or autopkgtest. This mail is copied to #1148802, which
reports the same test failing in autopkgtest; autopkgtest runs this same
test/test_array.py.
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 instead.
Author: Alexandru Fikl <alexfikl@gmail.com>
Origin: upstream, https://github.com/inducer/pyopencl/commit/f223914286484ce3f7a5ed0560981928506d61e0
Bug-Debian: https://bugs.debian.org/1149461
Forwarded: not-needed
Last-Update: 2026-10-19
Index: pyopencl-2025.1/test/test_array.py
===================================================================
--- pyopencl-2025.1.orig/test/test_array.py
+++ pyopencl-2025.1/test/test_array.py
@@ -2346,8 +2346,8 @@ def test_logical_not(ctx_factory):
reason="XDG_CACHE_HOME is not used on Windows")
def test_xdg_cache_home(ctx_factory):
import os
+ import pathlib
import shutil
- from os.path import join
context = ctx_factory()
queue = cl.CommandQueue(context)
@@ -2355,13 +2355,13 @@ def test_xdg_cache_home(ctx_factory):
a = np.array([1, 2, 3, 4, 5]).astype(np.float32)
a_gpu = cl_array.to_device(queue, a)
- xdg_dir = "tmpdir_pyopencl_xdg_test"
+ xdg_dir = pathlib.Path("tmpdir_pyopencl_xdg_test").resolve()
# PyOpenCL uses pytools.PersistentDict for invoker caches,
# which is why xdg_dir will always exist. Therefore, check
# whether xdg_pyopencl_dir exists.
- xdg_pyopencl_dir = join(xdg_dir, "pyopencl")
- assert not os.path.exists(xdg_dir)
+ xdg_pyopencl_dir = xdg_dir / "pyopencl"
+ assert not xdg_dir.exists()
old_xdg_cache_home = None
old_characterize_has_src_build_cache = None
@@ -2373,12 +2373,12 @@ def test_xdg_cache_home(ctx_factory):
cl.characterize.has_src_build_cache = lambda dev: False
old_xdg_cache_home = os.getenv("XDG_CACHE_HOME")
- os.environ["XDG_CACHE_HOME"] = xdg_dir
+ os.environ["XDG_CACHE_HOME"] = str(xdg_dir)
result = pow(a_gpu, a_gpu).get()
assert (np.abs(a ** a - result) < 3e-3).all()
- assert os.path.exists(xdg_pyopencl_dir)
+ assert xdg_pyopencl_dir.exists()
finally:
cl.characterize.has_src_build_cache = \
old_characterize_has_src_build_cache