15
0
forked from pool/python-gevent

Accepting request 1169643 from devel:languages:python

OBS-URL: https://build.opensuse.org/request/show/1169643
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-gevent?expand=0&rev=50
This commit is contained in:
2024-04-23 16:55:07 +00:00
committed by Git OBS Bridge
8 changed files with 69 additions and 215 deletions

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d38bb2a80d2cb08becdf52ebb007770107adbf2f2a66bc8eaa750501b0ca006
size 4026844

3
gevent-24.2.1.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:33d71611b05a9198c24ff2209b77cb0988a8031c5fa419e7d699c81094ca4e74
size 4322696

View File

@@ -1,141 +0,0 @@
From 86ea07e273ed7938446688cef5492d48034b7ddb Mon Sep 17 00:00:00 2001
From: Jason Madden <jamadden@gmail.com>
Date: Wed, 13 Dec 2023 14:43:29 -0600
Subject: [PATCH] Compensate for Python 3.12.1 failing unittests of all tests
are skipped.
---
.github/workflows/ci.yml | 5 ++++-
src/gevent/testing/patched_tests_setup.py | 11 +++++++++++
src/gevent/testing/testrunner.py | 17 ++++++++++++++++-
src/gevent/testing/util.py | 3 ++-
4 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 64088705d..3574ed327 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -121,7 +121,10 @@ jobs:
- name: Set coverage status
# coverage is too slow on PyPy. We can't submit it from macOS (see that action),
# so don't bother taking the speed hit there either.
- if: ${{ !startsWith(matrix.python-version, 'pypy') && startsWith(runner.os, 'Linux') }}
+ # Coverage can't run the test_interpreters.py tests because greenlet can't
+ # run there and that's how coverage is configured. Right now, we only have that
+ # on Python 3.12, so take the quick way out and nix that version too.
+ if: ${{ !startsWith(matrix.python-version, 'pypy') && !startsWith(matrix.python-version, "3.12") && startsWith(runner.os, 'Linux') }}
run: |
echo G_USE_COV=--coverage >> $GITHUB_ENV
diff --git a/src/gevent/testing/patched_tests_setup.py b/src/gevent/testing/patched_tests_setup.py
index a95f826f9..89970ac36 100644
--- a/src/gevent/testing/patched_tests_setup.py
+++ b/src/gevent/testing/patched_tests_setup.py
@@ -34,6 +34,7 @@
from .sysinfo import WIN
from .sysinfo import OSX
+from .sysinfo import LINUX
from .sysinfo import LIBUV
from .sysinfo import CFFI_BACKEND
@@ -1252,6 +1253,16 @@ def test(*args, **kwargs):
'test_socket.BasicHyperVTest.testCreateHyperVSocketAddrVmIdNotValidUUIDFailure',
]
+ if LINUX and RUNNING_ON_CI:
+ disabled_tests += [
+ # These two try to forcibly close a socket, preventing some data
+ # from reaching its destination. That works OK on some platforms, but
+ # in this set of circumstances, because of the event loop, gevent is
+ # able to send that data.
+ 'test_ssl.TestPreHandshakeClose.test_preauth_data_to_tls_client',
+ 'test_ssl.TestPreHandshakeClose.test_preauth_data_to_tls_server',
+ ]
+
if TRAVIS:
disabled_tests += [
# These tests frequently break when we try to use newer Travis CI images,
diff --git a/src/gevent/testing/testrunner.py b/src/gevent/testing/testrunner.py
index ba6220648..37f5aee49 100644
--- a/src/gevent/testing/testrunner.py
+++ b/src/gevent/testing/testrunner.py
@@ -128,6 +128,8 @@ class Runner(object):
def __init__(self,
tests,
+ *,
+ allowed_return_codes,
configured_failing_tests=(),
failfast=False,
quiet=False,
@@ -135,6 +137,9 @@ def __init__(self,
worker_count=DEFAULT_NWORKERS,
second_chance=False):
"""
+ :keyword allowed_return_codes: Return codes other than
+ 0 that are counted as a success. Needed because some versions
+ of Python give ``unittest`` weird return codes.
:keyword quiet: Set to True or False to explicitly choose. Set to
`None` to use the default, which may come from the environment variable
``GEVENTTEST_QUIET``.
@@ -153,6 +158,7 @@ def __init__(self,
self._running_jobs = []
self._worker_count = min(len(tests), worker_count) or 1
+ self._allowed_return_codes = allowed_return_codes
def _run_one(self, cmd, **kwargs):
if self._quiet is not None:
@@ -807,7 +813,7 @@ def not_set(key):
def main():
- # pylint:disable=too-many-locals,too-many-statements
+ # pylint:disable=too-many-locals,too-many-statements,too-many-branches
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--ignore')
@@ -952,12 +958,21 @@ def main():
# XXX: Add a way to force these.
print("Not running tests on pypy with c-ares; not a supported configuration")
return
+
if options.package:
# Put this directory on the path so relative imports work.
package_dir = _dir_from_package_name(options.package)
os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', "") + os.pathsep + package_dir
+
+ allowed_return_codes = ()
+ if sys.version_info[:3] >= (3, 12, 1):
+ # unittest suddenly started failing with this return code
+ # if all tests in a module are skipped in 3.12.1.
+ allowed_return_codes += (5,)
+
runner = Runner(
tests,
+ allowed_return_codes=allowed_return_codes,
configured_failing_tests=FAILING_TESTS,
failfast=options.failfast,
quiet=options.quiet,
diff --git a/src/gevent/testing/util.py b/src/gevent/testing/util.py
index 11f5bfcb4..0ccd2035d 100644
--- a/src/gevent/testing/util.py
+++ b/src/gevent/testing/util.py
@@ -374,6 +374,7 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
quiet = kwargs.pop('quiet', QUIET)
verbose = not quiet
nested = kwargs.pop('nested', False)
+ allowed_return_codes = kwargs.pop('allowed_return_codes', ())
if buffer_output:
assert 'stdout' not in kwargs and 'stderr' not in kwargs, kwargs
kwargs['stderr'] = subprocess.STDOUT
@@ -394,7 +395,7 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
assert popen.timer is None
- failed = bool(result)
+ failed = bool(result) and result not in allowed_return_codes
if out:
out = out.strip()
out = out if isinstance(out, str) else out.decode('utf-8', 'ignore')

View File

@@ -1,64 +0,0 @@
From f69bc6b872b81a3dbc704c83147822fd7009995d Mon Sep 17 00:00:00 2001
From: Jason Madden <jamadden@gmail.com>
Date: Wed, 13 Dec 2023 15:01:10 -0600
Subject: [PATCH] No, really allow unittest on Py 3.12.1 to have skipped tests.
---
src/gevent/testing/testrunner.py | 1 +
src/gevent/testing/util.py | 14 ++++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/gevent/testing/testrunner.py b/src/gevent/testing/testrunner.py
index 37f5aee49..1704b77a3 100644
--- a/src/gevent/testing/testrunner.py
+++ b/src/gevent/testing/testrunner.py
@@ -161,6 +161,7 @@ def __init__(self,
self._allowed_return_codes = allowed_return_codes
def _run_one(self, cmd, **kwargs):
+ kwargs['allowed_return_codes'] = self._allowed_return_codes
if self._quiet is not None:
kwargs['quiet'] = self._quiet
result = util.run(cmd, **kwargs)
diff --git a/src/gevent/testing/util.py b/src/gevent/testing/util.py
index 0ccd2035d..fa67f0c39 100644
--- a/src/gevent/testing/util.py
+++ b/src/gevent/testing/util.py
@@ -260,7 +260,6 @@ class RunResult(object):
value of True; otherwise, a boolean value of false.
The integer value of this object is the command's exit code.
-
"""
def __init__(self,
@@ -394,7 +393,9 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
kill(popen)
assert popen.timer is None
-
+ # We don't want to treat return codes that are allowed as failures,
+ # but we do want to log those specially. That's why we retain the distinction
+ # between ``failed`` and ``result`` (failed takes the allowed codes into account).
failed = bool(result) and result not in allowed_return_codes
if out:
out = out.strip()
@@ -406,11 +407,16 @@ def run(command, **kwargs): # pylint:disable=too-many-locals
log('| %s\n%s', name, out)
status, run_count, skipped_count = _find_test_status(duration, out)
if result:
- log('! %s [code %s] %s', name, result, status, color='error')
+ log('! %s [code %s] %s', name, result, status,
+ color='error' if failed else 'suboptimal-behaviour')
elif not nested:
log('- %s %s', name, status)
+
+ # For everything outside this function, we need to pretend that
+ # allowed codes are actually successes.
return RunResult(
- command, kwargs, result,
+ command, kwargs,
+ 0 if result in allowed_return_codes else result,
output=out, error=err,
name=name,
run_count=run_count,

View File

@@ -1,9 +1,9 @@
Avoid colorization of test output in obs runners
Index: gevent-23.9.1/src/gevent/testing/util.py
Index: gevent-24.2.1/src/gevent/testing/util.py
===================================================================
--- gevent-23.9.1.orig/src/gevent/testing/util.py
+++ gevent-23.9.1/src/gevent/testing/util.py
--- gevent-24.2.1.orig/src/gevent/testing/util.py
+++ gevent-24.2.1/src/gevent/testing/util.py
@@ -98,6 +98,8 @@ def _color(what):
return _color_code(_colorscheme[what])

View File

@@ -0,0 +1,30 @@
Index: gevent-24.2.1/src/greentest/3.12/test_subprocess.py
===================================================================
--- gevent-24.2.1.orig/src/greentest/3.12/test_subprocess.py
+++ gevent-24.2.1/src/greentest/3.12/test_subprocess.py
@@ -3404,8 +3404,9 @@ class POSIXProcessTestCase(BaseTestCase)
atexit.register(exit_handler)
"""
_, out, err = assert_python_ok("-c", code)
- self.assertEqual(out, b'')
- self.assertIn(b"preexec_fn not supported at interpreter shutdown", err)
+ # https://github.com/python/cpython/issues/113964
+ # self.assertEqual(out, b'')
+ # self.assertIn(b"preexec_fn not supported at interpreter shutdown", err)
@unittest.skipUnless(mswindows, "Windows specific tests")
Index: gevent-24.2.1/src/greentest/3.12/test_threading.py
===================================================================
--- gevent-24.2.1.orig/src/greentest/3.12/test_threading.py
+++ gevent-24.2.1/src/greentest/3.12/test_threading.py
@@ -1137,7 +1137,8 @@ class ThreadTests(BaseTestCase):
"""
_, out, err = assert_python_ok("-c", code)
self.assertEqual(out, b'')
- self.assertIn(b"can't create new thread at interpreter shutdown", err)
+ # https://github.com/python/cpython/issues/113964
+ # self.assertIn(b"can't create new thread at interpreter shutdown", err)
class ThreadJoinOnShutdown(BaseTestCase):

View File

@@ -1,3 +1,31 @@
-------------------------------------------------------------------
Mon Apr 22 07:38:07 UTC 2024 - Daniel Garcia <daniel.garcia@suse.com>
- Add gh-113964-fix-tests-3.12.3.patch to tix tests with python 3.12.3
(bsc#1223128)
- Drop upstream patches:
* gevent-fix-unittest-returncode-py312-c1.patch
* gevent-fix-unittest-returncode-py312-c2.patch
- Update to version 24.2.1:
- Add support for Python patch releases 3.11.8 and 3.12.2, which
changed internal details of threading.
- Errors raised from subprocess.Popen may not have a filename set.
- SSLSocket.recv_into and SSLSocket.read no longer require the
buffer to implement len and now work with buffers whose size is
not 1.
- gh-108310: Fix CVE-2023-40217: Check for & avoid the ssl pre-close
flaw.
- Drop setuptools to a soft test dependency.
- Drop support for very old versions of CFFI.
- Update bundled c-ares from 1.19.1 to 1.26.0.
- Locks created by gevent, but acquired from multiple different
threads (not recommended), no longer spin to implement timeouts
and interruptible blocking. Instead, they use the native
functionality of the Python 3 lock. This may improve some
scenarios. See issue #2013.
-------------------------------------------------------------------
Wed Jan 10 22:40:39 UTC 2024 - Ben Greiner <code@bnavigator.de>

View File

@@ -26,7 +26,7 @@
%bcond_with colortest
%{?sle15_python_module_pythons}
Name: python-gevent
Version: 23.9.1
Version: 24.2.1
Release: 0
Summary: Python network library that uses greenlet and libevent
License: MIT
@@ -34,11 +34,12 @@ Group: Development/Languages/Python
URL: https://www.gevent.org/
Source0: https://github.com/gevent/gevent/archive/%{version}.tar.gz#/gevent-%{version}.tar.gz
Source100: %{name}-rpmlintrc
# PATCH-FIX-UPSTREAM gevent-fix-unittest-returncode-py312.patch gh#gevent/gevent#2012
Patch0: https://github.com/gevent/gevent/commit/86ea07e273ed7938446688cef5492d48034b7ddb.patch#/gevent-fix-unittest-returncode-py312-c1.patch
Patch1: https://github.com/gevent/gevent/commit/f69bc6b872b81a3dbc704c83147822fd7009995d.patch#/gevent-fix-unittest-returncode-py312-c2.patch
# PATCH-FEATURE-OPENSUSE gevent-opensuse-nocolor-tests.patch code@bnavigator.de -- Avoid colorization of test output in obs runners
Patch2: gevent-opensuse-nocolor-tests.patch
# PATCH-FIX-OPENSUSE gh-113964-fix-tests-3.12.3.patch
# Fix some tests that fails with python 3.12.3 in the current version,
# related to gh#python/cpython#113964
Patch3: gh-113964-fix-tests-3.12.3.patch
BuildRequires: %{python_module Cython >= 3.0.2}
BuildRequires: %{python_module cffi}
BuildRequires: %{python_module devel >= 3.8}