forked from pool/python-pytest-xprocess
Compare commits
4 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| 33ad8e8b98 | |||
| 95cca5edb5 | |||
| d6786f7a00 | |||
| eb6eb9f92d |
46
fix-test_process_initialization.patch
Normal file
46
fix-test_process_initialization.patch
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
From 75d92c89ec86da5cfc99d711a2b80cd097e7c6fa Mon Sep 17 00:00:00 2001
|
||||||
|
From: U2FsdGVkX1 <U2FsdGVkX1@gmail.com>
|
||||||
|
Date: Fri, 22 Nov 2024 14:32:42 +0800
|
||||||
|
Subject: [PATCH 1/2] Add retry for request_response_cycle
|
||||||
|
(https://github.com/pytest-dev/pytest-xprocess/issues/154)
|
||||||
|
|
||||||
|
---
|
||||||
|
CHANGELOG.rst | 7 +++++++
|
||||||
|
tests/test_process_initialization.py | 18 +++++++++++++-----
|
||||||
|
2 files changed, 20 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
Index: pytest-xprocess-1.0.2/tests/test_process_initialization.py
|
||||||
|
===================================================================
|
||||||
|
--- pytest-xprocess-1.0.2.orig/tests/test_process_initialization.py
|
||||||
|
+++ pytest-xprocess-1.0.2/tests/test_process_initialization.py
|
||||||
|
@@ -1,5 +1,6 @@
|
||||||
|
import socket
|
||||||
|
import sys
|
||||||
|
+import time
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
@@ -12,11 +13,18 @@ server_path = Path(__file__).parent.join
|
||||||
|
def request_response_cycle(tcp_port, data):
|
||||||
|
"""test started server instance by sending
|
||||||
|
request and checking response"""
|
||||||
|
- with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||||
|
- sock.connect(("localhost", tcp_port))
|
||||||
|
- sock.sendall(bytes(data, "utf-8"))
|
||||||
|
- received = str(sock.recv(1024), "utf-8")
|
||||||
|
- return received == data.upper()
|
||||||
|
+ for attempt in range(4):
|
||||||
|
+ try:
|
||||||
|
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
||||||
|
+ sock.connect(("localhost", tcp_port))
|
||||||
|
+ sock.sendall(bytes(data, "utf-8"))
|
||||||
|
+ received = str(sock.recv(1024), "utf-8")
|
||||||
|
+ return received == data.upper()
|
||||||
|
+ except OSError as e:
|
||||||
|
+ if attempt < 3:
|
||||||
|
+ time.sleep(1)
|
||||||
|
+ else:
|
||||||
|
+ raise e
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("proc_name", ["s1", "s2", "s3"])
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Aug 7 10:03:28 UTC 2025 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
|
- Add upstream patch fix-test_process_initialization.patch
|
||||||
|
gh#pytest-dev/pytest-xprocess#157 to fix tests in slow machines
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 7 07:01:03 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
|
- Switch to pyproject macros.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jun 7 07:03:26 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
Fri Jun 7 07:03:26 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package python-pytest-xprocess
|
# spec file for package python-pytest-xprocess
|
||||||
#
|
#
|
||||||
# Copyright (c) 2024 SUSE LLC
|
# Copyright (c) 2025 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@@ -24,9 +24,14 @@ Summary: A pytest plugin for managing processes across test runs
|
|||||||
License: MIT
|
License: MIT
|
||||||
URL: https://github.com/pytest-dev/pytest-xprocess
|
URL: https://github.com/pytest-dev/pytest-xprocess
|
||||||
Source: https://files.pythonhosted.org/packages/source/p/pytest-xprocess/pytest-xprocess-%{version}.tar.gz
|
Source: https://files.pythonhosted.org/packages/source/p/pytest-xprocess/pytest-xprocess-%{version}.tar.gz
|
||||||
|
# PATCH-FIX-UPSTREAM fix-test_process_initialization.patch gh#pytest-dev/pytest-xprocess#157
|
||||||
|
# This patch fixes tests in slow machines
|
||||||
|
Patch0: fix-test_process_initialization.patch
|
||||||
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module psutil}
|
BuildRequires: %{python_module psutil}
|
||||||
BuildRequires: %{python_module pytest >= 2.8}
|
BuildRequires: %{python_module pytest >= 2.8}
|
||||||
BuildRequires: %{python_module setuptools_scm}
|
BuildRequires: %{python_module setuptools_scm}
|
||||||
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-psutil
|
Requires: python-psutil
|
||||||
@@ -41,15 +46,15 @@ during testing. You can also use it to start and pre-configure
|
|||||||
test-specific databases (i.e. Postgres, Couchdb).
|
test-specific databases (i.e. Postgres, Couchdb).
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n pytest-xprocess-%{version}
|
%autosetup -p1 -n pytest-xprocess-%{version}
|
||||||
rm -rvf tests/__pycache__
|
rm -rvf tests/__pycache__
|
||||||
chmod -x README.rst
|
chmod -x README.rst
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%python_build
|
%pyproject_wheel
|
||||||
|
|
||||||
%install
|
%install
|
||||||
%python_install
|
%pyproject_install
|
||||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||||
|
|
||||||
%check
|
%check
|
||||||
@@ -59,6 +64,6 @@ chmod -x README.rst
|
|||||||
%doc README.rst
|
%doc README.rst
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{python_sitelib}/xprocess
|
%{python_sitelib}/xprocess
|
||||||
%{python_sitelib}/pytest_xprocess-%{version}*-info
|
%{python_sitelib}/pytest_xprocess-%{version}.dist-info
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
Reference in New Issue
Block a user