Accepting request 1138131 from home:bnavigator:branches:devel:languages:python
- Clean obsolete old python and old distribution directives * Only 15.5+ with the sle15 python module and Tumbleweed have the required Python 3.8+ * Drop fix-no-return-in-nonvoid-function.patch - Update test suite execution * Use -u-network flag to disable network tests * Add gevent-opensuse-nocolor-tests.patch -- Avoid colorization of test output in obs runners * Add gevent-fix-unittest-returncode-py312-c1.patch and gevent-fix-unittest-returncode-py312-c2.patch gh#gevent/gevent#2012 OBS-URL: https://build.opensuse.org/request/show/1138131 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-gevent?expand=0&rev=107
This commit is contained in:
parent
97fc0bdfdf
commit
9117201a09
@ -1,23 +0,0 @@
|
||||
Index: gevent-21.1.2/deps/libev/ev_iouring.c
|
||||
===================================================================
|
||||
--- gevent-21.1.2.orig/deps/libev/ev_iouring.c
|
||||
+++ gevent-21.1.2/deps/libev/ev_iouring.c
|
||||
@@ -286,6 +286,9 @@ iouring_sqe_get (EV_P)
|
||||
return EV_SQES + (tail & EV_SQ_VAR (ring_mask));
|
||||
}
|
||||
|
||||
+#pragma GCC diagnostic push
|
||||
+#pragma GCC diagnostic ignored "-Wreturn-type"
|
||||
+
|
||||
inline_size
|
||||
struct io_uring_sqe *
|
||||
iouring_sqe_submit (EV_P_ struct io_uring_sqe *sqe)
|
||||
@@ -330,6 +333,8 @@ iouring_internal_destroy (EV_P)
|
||||
}
|
||||
}
|
||||
|
||||
+#pragma GCC diagnostic pop
|
||||
+
|
||||
ecb_cold
|
||||
static int
|
||||
iouring_internal_init (EV_P)
|
141
gevent-fix-unittest-returncode-py312-c1.patch
Normal file
141
gevent-fix-unittest-returncode-py312-c1.patch
Normal file
@ -0,0 +1,141 @@
|
||||
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')
|
64
gevent-fix-unittest-returncode-py312-c2.patch
Normal file
64
gevent-fix-unittest-returncode-py312-c2.patch
Normal file
@ -0,0 +1,64 @@
|
||||
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,
|
15
gevent-opensuse-nocolor-tests.patch
Normal file
15
gevent-opensuse-nocolor-tests.patch
Normal file
@ -0,0 +1,15 @@
|
||||
Avoid colorization of test output in obs runners
|
||||
|
||||
Index: gevent-23.9.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
|
||||
@@ -98,6 +98,8 @@ def _color(what):
|
||||
return _color_code(_colorscheme[what])
|
||||
|
||||
def _colorize(what, message, normal='normal'):
|
||||
+ if os.environ.get("TEST_NOCOLOR", False):
|
||||
+ return message
|
||||
return _color(what) + message + _color(normal)
|
||||
|
||||
def log(message, *args, **kwargs):
|
@ -1,2 +1,2 @@
|
||||
addFilter("zero-length .*tests/nullcert\.pem")
|
||||
addFilter("pem-certificate .*tests/.*\.pem")
|
||||
|
||||
|
@ -1,3 +1,18 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 10 22:40:39 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||
|
||||
- Clean obsolete old python and old distribution directives
|
||||
* Only 15.5+ with the sle15 python module and Tumbleweed have the
|
||||
required Python 3.8+
|
||||
* Drop fix-no-return-in-nonvoid-function.patch
|
||||
- Update test suite execution
|
||||
* Use -u-network flag to disable network tests
|
||||
* Add gevent-opensuse-nocolor-tests.patch -- Avoid colorization
|
||||
of test output in obs runners
|
||||
* Add gevent-fix-unittest-returncode-py312-c1.patch and
|
||||
gevent-fix-unittest-returncode-py312-c2.patch
|
||||
gh#gevent/gevent#2012
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Nov 27 15:53:52 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package python-gevent
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2024 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -16,13 +16,14 @@
|
||||
#
|
||||
|
||||
|
||||
%define modname gevent
|
||||
# on TW, gevent is able to use system libev, Leaps et.al. need the bundled version
|
||||
%if 0%{?suse_version} <= 1500
|
||||
%define use_bundled_libev 1
|
||||
%else
|
||||
%define use_bundled_libev 0
|
||||
%endif
|
||||
# get colored test output on local osc build
|
||||
%bcond_with colortest
|
||||
%{?sle15_python_module_pythons}
|
||||
Name: python-gevent
|
||||
Version: 23.9.1
|
||||
@ -31,13 +32,14 @@ Summary: Python network library that uses greenlet and libevent
|
||||
License: MIT
|
||||
Group: Development/Languages/Python
|
||||
URL: https://www.gevent.org/
|
||||
Source0: https://github.com/gevent/%{modname}/archive/%{version}.tar.gz#/%{modname}-%{version}.tar.gz
|
||||
Source0: https://github.com/gevent/gevent/archive/%{version}.tar.gz#/gevent-%{version}.tar.gz
|
||||
Source100: %{name}-rpmlintrc
|
||||
# gcc7 for 15.1 produces no-return-in-nonvoid-function, but the same compiler for 15.2 not
|
||||
# usually, as long as no return value is used, this shouldn't be treated as an error
|
||||
# let's selectively disable the warning around the offending code
|
||||
Patch0: fix-no-return-in-nonvoid-function.patch
|
||||
BuildRequires: %{python_module Cython}
|
||||
# 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
|
||||
BuildRequires: %{python_module Cython >= 3.0.2}
|
||||
BuildRequires: %{python_module cffi}
|
||||
BuildRequires: %{python_module devel >= 3.8}
|
||||
BuildRequires: %{python_module dnspython}
|
||||
@ -46,6 +48,7 @@ BuildRequires: %{python_module objgraph}
|
||||
BuildRequires: %{python_module pip}
|
||||
BuildRequires: %{python_module psutil}
|
||||
BuildRequires: %{python_module requests}
|
||||
BuildRequires: %{python_module testsuite}
|
||||
BuildRequires: %{python_module wheel}
|
||||
BuildRequires: %{python_module zope.event}
|
||||
BuildRequires: %{python_module zope.interface}
|
||||
@ -54,13 +57,11 @@ BuildRequires: fdupes
|
||||
BuildRequires: netcfg
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: python-rpm-macros
|
||||
BuildRequires: python3-testsuite
|
||||
BuildRequires: pkgconfig(libcares)
|
||||
BuildRequires: pkgconfig(libuv)
|
||||
Requires: python-cffi
|
||||
Requires: python-dnspython
|
||||
Requires: python-greenlet >= 3.0.0
|
||||
Requires: python-importlib-metadata
|
||||
Requires: python-requests
|
||||
Requires: python-zope.event
|
||||
Requires: python-zope.interface
|
||||
@ -103,10 +104,7 @@ Documentation and examples for %{name}.
|
||||
%endif
|
||||
|
||||
%prep
|
||||
%setup -q -n gevent-%{version}
|
||||
%if 0%{?sle_version} <= 150100 && 0%{?is_opensuse}
|
||||
%patch0 -p1
|
||||
%endif
|
||||
%autosetup -p1 -n gevent-%{version}
|
||||
sed -i -e '1s!bin/env python!bin/python!' examples/*.py
|
||||
sed -i -e '1{/bin.*python/d}' src/gevent/tests/*.py
|
||||
|
||||
@ -128,30 +126,22 @@ chmod +x %{buildroot}%{$python_sitearch}/gevent/testing/testrunner.py
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitearch}
|
||||
|
||||
%check
|
||||
%{python_expand #
|
||||
# create ignore list of tests, e.g. because they reach out to the net
|
||||
# https://www.gevent.org/development/running_tests.html
|
||||
#
|
||||
# create ignore list of tests, e.g. because they reach out to the net despite -u-network
|
||||
cat << EOF > skip_tests.txt
|
||||
test__core_stat.py
|
||||
%if 0%{?sle_version} <= 150200 && 0%{?is_opensuse}
|
||||
test__destroy_default_loop.py
|
||||
test__example_echoserver.py
|
||||
test_socket.py
|
||||
%endif
|
||||
test__examples.py
|
||||
# this one fails occasionally with: Address already in use: ('127.0.0.1', 16000)
|
||||
test__example_portforwarder.py
|
||||
# no dns resolver in obs
|
||||
test__getaddrinfo_import.py
|
||||
test__resolver_dnspython.py
|
||||
test__socket_dns.py
|
||||
test__issue1686.py
|
||||
# Flaky tests in s390x architecture
|
||||
%ifarch s390x
|
||||
test__util.py
|
||||
%endif
|
||||
EOF
|
||||
if [ %{$python_version_nodots} -lt 37 ]; then
|
||||
echo "test__threading_2.py" >> skip_tests.txt
|
||||
fi
|
||||
|
||||
export GEVENT_RESOLVER=thread
|
||||
# Setting the TRAVIS environment variable makes some different configuration
|
||||
# for tests that use the network so they don't fail on travis (or obs)
|
||||
@ -163,10 +153,14 @@ export LANG=en_US.UTF-8
|
||||
# Relax the crypto policies for the test-suite
|
||||
export OPENSSL_SYSTEM_CIPHERS_OVERRIDE=xyz_nonexistent_file
|
||||
export OPENSSL_CONF=''
|
||||
# don't bother with python2 tests
|
||||
if [ "${python_flavor}" != "python2" ]; then
|
||||
PYTHONPATH=%{buildroot}%{$python_sitearch} $python -m gevent.tests --ignore skip_tests.txt
|
||||
fi
|
||||
%{!?_with_colortest:export TEST_NOCOLOR=1}
|
||||
%{python_expand #
|
||||
export PYTHONPATH=%{buildroot}%{$python_sitearch}
|
||||
$python -m gevent.tests \
|
||||
--ignore skip_tests.txt \
|
||||
-u-network \
|
||||
--verbose \
|
||||
%{?jobs:--processes %jobs}
|
||||
}
|
||||
|
||||
%files %{python_files}
|
||||
|
Loading…
x
Reference in New Issue
Block a user