#1149473 pytools: FTBFS: E FileNotFoundError: [Errno 2] No such file or directory: 'tmpdir_pytools_xdg_test'

Package:
src:pytools
Source:
src:pytools
Submitter:
Santiago Vila
Date:
2026-10-20 06:35:03 UTC
Severity:
normal
Tags:
#1149473#5
Date:
2026-09-29 23:06:35 UTC
From:
To:
Dear maintainer:

During a rebuild of all packages in unstable, this package failed to build.

Below you will find the last part of the build log (probably the most
relevant part, but not necessarily). If required, the full build log
is available here:

https://people.debian.org/~sanvila/build-logs/202609/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you cannot reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and add an affects on src:pytools, so that this is still
visible in the BTS web page for this package.

Thanks.
--------------------------------------------------------------------------------
[...]
            # lstat()/open()/fstat() trick.
            assert func is os.lstat
            if orig_entry is None:
/usr/lib/python3.14/shutil.py:760: FileNotFoundError
=========================== short test summary info ============================
FAILED pytools/test/test_persistent_dict.py::test_xdg_cache_home - FileNotFou...
============ 1 failed, 86 passed, 6 skipped, 5 deselected in 29.68s ============
E: pybuild pybuild:485: test: plugin pyproject failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.14/build; python3.14 -m pytest -k 'not test_attrs_hashing and not test_class_hashing and not test_dataclass_hashing and not test_datetime_hashing and not test_hash_function'
Traceback (most recent call last):
  File "/usr/bin/pybuild", line 483, in main
    run(func, i, version, c)
    ~~~^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/pybuild", line 407, in run
    func(context, args)
    ~~~~^^^^^^^^^^^^^^^
  File "/usr/share/dh-python/dhpython/build/base.py", line 446, in wrapped_func
    raise Exception(msg)
Exception: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.14/build; python3.14 -m pytest -k 'not test_attrs_hashing and not test_class_hashing and not test_dataclass_hashing and not test_datetime_hashing and not test_hash_function'
	rm -fr -- /tmp/dh-xdg-rundir-ObW8q355
dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p 3.14 --test-pytest --parallel=1 returned exit code 13
make[1]: *** [debian/rules:37: override_dh_auto_test] Error 25
make[1]: Leaving directory '/<<PKGBUILDDIR>>'
make: *** [debian/rules:19: binary] Error 2
dpkg-buildpackage: error: debian/rules binary subprocess failed with exit status 2
--------------------------------------------------------------------------------

#1149473#10
Date:
2026-10-19 22:46:46 UTC
From:
To:
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 <inform@tiker.net>
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:
     # }}}