From 3873fcd029c8d1cec0dad003266ee651c3688fe9328ce65d674cb02acd278300 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 19 Jan 2024 00:14:59 +0000 Subject: [PATCH] Accepting request 1139817 from home:bnavigator:branches:devel:languages:python - Add twisted-pr12054-testinvokationpy3.12.1.patch * Pull request gh#twisted/twisted#12054 fixes failing tests on python312 gh#twisted/twisted#12052 - Fix rpmlint errors OBS-URL: https://build.opensuse.org/request/show/1139817 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-Twisted?expand=0&rev=145 --- python-Twisted.changes | 8 ++ python-Twisted.rpmlintrc | 3 +- python-Twisted.spec | 21 +++-- twisted-pr12054-testinvokationpy3.12.1.patch | 83 ++++++++++++++++++++ 4 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 twisted-pr12054-testinvokationpy3.12.1.patch diff --git a/python-Twisted.changes b/python-Twisted.changes index 21ec24a..1382496 100644 --- a/python-Twisted.changes +++ b/python-Twisted.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Jan 18 21:33:05 UTC 2024 - Ben Greiner + +- Add twisted-pr12054-testinvokationpy3.12.1.patch + * Pull request gh#twisted/twisted#12054 fixes failing tests on + python312 gh#twisted/twisted#12052 +- Fix rpmlint errors + ------------------------------------------------------------------- Thu Nov 23 08:28:43 UTC 2023 - Markéta Machová diff --git a/python-Twisted.rpmlintrc b/python-Twisted.rpmlintrc index 5417623..9c21a91 100644 --- a/python-Twisted.rpmlintrc +++ b/python-Twisted.rpmlintrc @@ -1 +1,2 @@ -addFilter("E: python-tests-in-package.*/usr/lib/.*/site-packages/twisted.*/test") +# rpmlint is too stupid for the . in the name +addFilter("python-.*-require .*zope.interface") diff --git a/python-Twisted.spec b/python-Twisted.spec index 3e0c68f..edde216 100644 --- a/python-Twisted.spec +++ b/python-Twisted.spec @@ -1,7 +1,7 @@ # # spec file # -# 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 @@ -32,7 +32,7 @@ Version: 23.10.0 Release: 0 Summary: An asynchronous networking framework written in Python License: MIT -URL: https://twistedmatrix.com/ +URL: https://twisted.org Source0: https://files.pythonhosted.org/packages/source/t/twisted/twisted-%{version}.tar.gz Source99: python-Twisted.rpmlintrc Patch0: skip_MultiCast.patch @@ -42,8 +42,10 @@ Patch2: no-test_successResultOfWithFailureHasTraceback.patch # PATCH-FIX-UPSTREAM 1521_delegate_parseqs_stdlib_bpo42967.patch https://twistedmatrix.com/trac/ticket/10096 mcepl@suse.com # overcome incompatibility with the solution for bpo#42967. Patch3: 1521_delegate_parseqs_stdlib_bpo42967.patch -# We don't want to package yet another module, and it is easily skippable -Patch4: no-cython_test_exception_raiser.patch +# PATCH-FIX-UPSTREAM twisted-pr12054-testinvokationpy3.12.1.patch gh#twisted/twisted#12054 fixes gh#twisted/twisted#12052 +Patch4: twisted-pr12054-testinvokationpy3.12.1.patch +# PATCH-FIX-OPENSUSE We don't want to package yet another module, and it is easily skippable +Patch5: no-cython_test_exception_raiser.patch # PATCH-FIX-OPENSUSE remove-dependency-version-upper-bounds.patch boo#1190036 -- run with h2 >= 4.0.0 and priority >= 2.0 Patch6: remove-dependency-version-upper-bounds.patch BuildRequires: %{python_module hatch-fancy-pypi-readme} @@ -178,6 +180,8 @@ This metapackage is for the optional dependency all_non_platform %prep %autosetup -p1 -n twisted-%{version} sed -i '1{/env python/d}' src/twisted/mail/test/pop3testserver.py src/twisted/trial/test/scripttest.py +find src/twisted -name .gitignore -delete +find src/twisted -name '*.misc' -size 0 -delete %if ! %{with test} %build @@ -197,6 +201,11 @@ install -m0644 docs/*/man/*.1 %{buildroot}%{_mandir}/man1/ # Install man pages find docs -type f -print0 | xargs -0 chmod a-x # Fix doc-file dependency by removing x flags #sed -i "s/\r//" docs/core/howto/listings/udp/{MulticastClient,MulticastServer}.py %python_expand %fdupes %{buildroot}%{$python_sitelib} +%if 0%{?suse_version} > 1500 +mkdir -p %{buildroot}%{_docdir}/%{name}-doc +cp -r docs/* %{buildroot}%{_docdir}/%{name}-doc +%fdupes %{buildroot}%{_docdir}/%{name}-doc +%endif # Prepare for update-alternatives usage for p in twistd cftp ckeygen conch pyhtmlizer tkconch trial ; do @@ -288,8 +297,10 @@ done %if 0%{?suse_version} > 1500 %files -n %{name}-doc -%endif +%doc %{_docdir}/%{name}-doc +%else %doc docs/ +%endif %endif diff --git a/twisted-pr12054-testinvokationpy3.12.1.patch b/twisted-pr12054-testinvokationpy3.12.1.patch new file mode 100644 index 0000000..56b2f99 --- /dev/null +++ b/twisted-pr12054-testinvokationpy3.12.1.patch @@ -0,0 +1,83 @@ +From 3038382d8b01912358419cee96a56730499881e1 Mon Sep 17 00:00:00 2001 +From: Adi Roiban +Date: Mon, 18 Dec 2023 13:42:28 +0000 +Subject: [PATCH 1/4] Run with latest Python. + +--- + .github/workflows/test.yaml | 6 +++--- + src/twisted/newsfragments/12052.1.misc | 0 + 2 files changed, 3 insertions(+), 3 deletions(-) + create mode 100644 src/twisted/newsfragments/12052.1.misc + +Index: twisted-23.10.0/src/twisted/trial/reporter.py +=================================================================== +--- twisted-23.10.0.orig/src/twisted/trial/reporter.py ++++ twisted-23.10.0/src/twisted/trial/reporter.py +@@ -7,7 +7,7 @@ + """ + Defines classes that handle the results of tests. + """ +- ++from __future__ import annotations + + import os + import sys +@@ -16,7 +16,7 @@ import unittest as pyunit + import warnings + from collections import OrderedDict + from types import TracebackType +-from typing import TYPE_CHECKING, List, Tuple, Type, Union ++from typing import TYPE_CHECKING, List, Optional, Tuple, Type, Union + + from zope.interface import implementer + +@@ -87,6 +87,11 @@ class TestResult(pyunit.TestResult): + + @ivar successes: count the number of successes achieved by the test run. + @type successes: C{int} ++ ++ @ivar _startTime: The time when the current test was started. It defaults to ++ L{None}, which means that the test was skipped. ++ @ivar _lastTime: The duration of the current test run. It defaults to ++ L{None}, which means that the test was skipped. + """ + + # Used when no todo provided to addExpectedFailure or addUnexpectedSuccess. +@@ -96,6 +101,9 @@ class TestResult(pyunit.TestResult): + expectedFailures: List[Tuple[itrial.ITestCase, str, "Todo"]] # type: ignore[assignment] + unexpectedSuccesses: List[Tuple[itrial.ITestCase, str]] # type: ignore[assignment] + successes: int ++ _testStarted: Optional[int] ++ # The duration of the test. It is None until the test completes. ++ _lastTime: Optional[int] + + def __init__(self): + super().__init__() +@@ -104,6 +112,8 @@ class TestResult(pyunit.TestResult): + self.unexpectedSuccesses = [] + self.successes = 0 + self._timings = [] ++ self._testStarted = None ++ self._lastTime = None + + def __repr__(self) -> str: + return "<%s run=%d errors=%d failures=%d todos=%d dones=%d skips=%d>" % ( +@@ -146,7 +156,8 @@ class TestResult(pyunit.TestResult): + @type test: L{pyunit.TestCase} + """ + super().stopTest(test) +- self._lastTime = self._getTime() - self._testStarted ++ if self._testStarted is not None: ++ self._lastTime = self._getTime() - self._testStarted + + def addFailure(self, test, fail): + """ +Index: twisted-23.10.0/src/twisted/newsfragments/12052.removal +=================================================================== +--- /dev/null ++++ twisted-23.10.0/src/twisted/newsfragments/12052.removal +@@ -0,0 +1,4 @@ ++twisted.trial.reporter.TestRun.startTest() is no longer called for tests ++with skip annotation or skip attribute for Python 3.12.1 or newer. ++This is the result of upstream Python gh-106584 change. ++The behavior is not change in 3.12.0 or older.