14
0

Accepting request 1085164 from home:ojkastl_buildservice:Branch_devel_languages_python

add patch to replace hardcoded python3 executable name

OBS-URL: https://build.opensuse.org/request/show/1085164
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-subprocess-tee?expand=0&rev=16
This commit is contained in:
2023-05-09 22:35:22 +00:00
committed by Git OBS Bridge
parent bc6d5ce15d
commit fef9b28eeb
3 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
From 8dcde7134573acb506c7f34746573cbaeccf9b4d Mon Sep 17 00:00:00 2001
From: Johannes Kastl <kastl@b1-systems.de>
Date: Fri, 5 May 2023 20:11:37 +0200
Subject: [PATCH] test/test_unit.py: do not use python3, rather use
sys.executable to use the same python version this test is running with
Signed-off-by: Johannes Kastl <kastl@b1-systems.de>
---
test/test_unit.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/test_unit.py b/test/test_unit.py
index 1dd4d2f..652fce9 100644
--- a/test/test_unit.py
+++ b/test/test_unit.py
@@ -1,5 +1,6 @@
"""Unittests."""
import subprocess
+import sys
from typing import Dict
import pytest
@@ -30,7 +31,7 @@ def test_run_list() -> None:
# NOTICE: subprocess.run() does fail to capture any output when cmd is
# a list and you specific shell=True. Still, when not mentioning shell,
# it does work.
- cmd = ["python3", "--version"]
+ cmd = [sys.executable, "--version"]
old_result = subprocess.run(
cmd,
# shell=True,
@@ -47,7 +48,7 @@ def test_run_list() -> None:
def test_run_echo(capsys: CaptureFixture[str]) -> None:
"""Validate run call with echo dumps command."""
- cmd = ["python3", "--version"]
+ cmd = [sys.executable, "--version"]
old_result = subprocess.run(
cmd,
# shell=True,
--
2.40.1

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri May 5 18:13:11 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>
- add patch
0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch
to replace hardcoded python3 executable name
(see https://github.com/pycontribs/subprocess-tee/pull/107)
-------------------------------------------------------------------
Fri May 5 10:39:38 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>

View File

@@ -24,6 +24,7 @@ Summary: Captures the output of subprocesses in real-time
License: MIT
URL: https://github.com/pycontribs/subprocess-tee
Source: https://files.pythonhosted.org/packages/source/s/subprocess-tee/subprocess-tee-%{version}.tar.gz
Patch1: 0001-test-test_unit.py-do-not-use-python3-rather-use-sys..patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module rich}
@@ -50,6 +51,7 @@ to provide instant feedback (progress) related to what is happening.
%prep
%setup -q -n subprocess-tee-%{version}
%patch1 -p1
%build
%pyproject_wheel