gentoo/dev-python/dulwich/files/dulwich-0.24.2-test-path.patch
Michał Górny a53c1c08f3
dev-python/dulwich: Enable py3.14
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2025-10-04 16:09:42 +02:00

50 lines
1.9 KiB
Diff

From 1643810cec254c9c7d78614c4ffedb8ac7cc77c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 4 Oct 2025 15:52:07 +0200
Subject: [PATCH] Fix BlackboxTestCase to respect Python venv path
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix BlackboxTestCase to include `sysconfig.get_path("scripts")`
in binary paths, which corresponds to the binary directory used
in the current virtual environment. This ensures that the tests use
the correct dulwich executables rather than the (possibly older) version
installed to `/usr/bin`.
The test previously attempted to reconstruct the `bin` path relatively
to the test file. However, that logic stopped working correctly when
tests were moved out of the package in
245331a60d743b7b73ba3a8b15e6f4648273369f. I suspect that the problem
may have went unnoticed for a time, since the tests are skipped when
the binaries can't be found. While it is technically possible to fix
the reconstruction logic to use the `dulwich` module path, using
`sysconfig` ensures we are using the correct path rather than guessing.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
tests/__init__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/__init__.py b/tests/__init__.py
index fb70aa5b32..d7cbf8a6ea 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -34,6 +34,7 @@
import shutil
import subprocess
import sys
+import sysconfig
import tempfile
# If Python itself provides an exception, use that
@@ -70,7 +71,7 @@ class BlackboxTestCase(TestCase):
# TODO(jelmer): Include more possible binary paths.
bin_directories: ClassVar[list[str]] = [
- os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "bin")),
+ sysconfig.get_path("scripts"),
"/usr/bin",
"/usr/local/bin",
]