public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/hatch] epel10: Fix a couple of tests when no “python” in path
@ 2026-10-28 14:58 Benjamin A. Beasley
  0 siblings, 0 replies; only message in thread
From: Benjamin A. Beasley @ 2026-10-28 14:58 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/hatch
Branch : epel10
Commit : 5cd3302f7480579c3c9ad89cabd687cd2f8b648e
Author : Benjamin A. Beasley <code@musicinmybrain.net>
Date   : 2026-10-28T14:15:21+00:00
Stats  : +36/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/hatch/c/5cd3302f7480579c3c9ad89cabd687cd2f8b648e?branch=epel10

Log:
Fix a couple of tests when no “python” in path

---
diff --git a/hatch-1.15.1-unversioned-python.patch b/hatch-1.15.1-unversioned-python.patch
new file mode 100644
index 0000000..7dfce1b
--- /dev/null
+++ b/hatch-1.15.1-unversioned-python.patch
@@ -0,0 +1,25 @@
+diff -Naur a/tests/cli/run/test_run.py b/tests/cli/run/test_run.py
+--- a/tests/cli/run/test_run.py	2025-10-16 21:33:50.000000000 +0100
++++ b/tests/cli/run/test_run.py	2026-10-28 11:49:24.893183481 +0000
+@@ -1,4 +1,5 @@
+ import os
++import pathlib
+ import sys
+ 
+ import pytest
+@@ -710,7 +711,14 @@
+ 
+     project = Project(project_path)
+     config = dict(project.raw_config)
+-    config['tool']['hatch']['scripts'] = {'py': 'python -c {args}'}
++    # Try to handle testing on systems where there is no "python", only e.g.
++    # "python3". Ideally we would use the absolute path from sys.executable
++    # path, but then we are much more likely to have problems due to things
++    # like whitespace in the directory path, considering we are not attempting
++    # shell escaping. Even the executable name could have these issues, but
++    # this should be good enough for testing purposes.
++    py = pathlib.Path(sys.executable).name
++    config['tool']['hatch']['scripts'] = {'py': f'{py} -c {{args}}'}
+     project.save_config(config)
+ 
+     with project_path.as_cwd(env_vars={ConfigEnvVars.DATA: str(data_path)}):

diff --git a/hatch.spec b/hatch.spec
index fae1b9b..62c1b07 100644
--- a/hatch.spec
+++ b/hatch.spec
@@ -61,6 +61,17 @@ Source1700:     hatch-test.1
 # https://github.com/pypa/hatch/pull/1665
 Patch:          %{url}/pull/1665.patch
 
+# Fix a couple of tests when no “python” in path
+#
+# These CLI tests assume a “python” executable is available outside of a
+# virtualenv, which is not necessarily true (e.g. Fedora has only “python3” if
+# the `python-unversioned-command` package is not installed). Use the value of
+# `sys.executable` in the script configs for these tests instead.
+#
+# https://github.com/pypa/hatch/pull/2399
+# Backported to v1.15.1.
+Patch:          hatch-1.15.1-unversioned-python.patch
+
 BuildArch:      noarch
 
 %if %{with tests}

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-28 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 14:58 [rpms/hatch] epel10: Fix a couple of tests when no “python” in path Benjamin A. Beasley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox