Upgrade to 1.4.0 to support OpenStack-W
This upgrades to 1.4.0 and drops the patches which have been upstreamed.
This commit is contained in:
parent
eff65e0eb8
commit
7f10bea380
@ -1,239 +0,0 @@
|
||||
From ad3523fd57d01c9a443e2d1b07215c001d8da91d Mon Sep 17 00:00:00 2001
|
||||
From: Haikel Guemar <hguemar@fedoraproject.org>
|
||||
Date: Fri, 30 Nov 2018 14:30:08 +0100
|
||||
Subject: [PATCH] Migrate Gtk interface to GObject introspection
|
||||
|
||||
Filters subunit2gtk and subunit-notify now uses GObject introspection
|
||||
Both are compatible with python2 and python3
|
||||
---
|
||||
filters/subunit-notify | 10 +++---
|
||||
filters/subunit2gtk | 80 +++++++++++++++++++++---------------------
|
||||
2 files changed, 45 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/filters/subunit-notify b/filters/subunit-notify
|
||||
index bc833da..71da071 100755
|
||||
--- a/filters/subunit-notify
|
||||
+++ b/filters/subunit-notify
|
||||
@@ -16,15 +16,15 @@
|
||||
|
||||
"""Notify the user of a finished test run."""
|
||||
|
||||
-import pygtk
|
||||
-pygtk.require('2.0')
|
||||
-import pynotify
|
||||
+import gi
|
||||
+gi.require_version('Gtk', '3.0')
|
||||
+from gi.repository import Notify
|
||||
from testtools import StreamToExtendedDecorator
|
||||
|
||||
from subunit import TestResultStats
|
||||
from subunit.filters import run_filter_script
|
||||
|
||||
-if not pynotify.init("Subunit-notify"):
|
||||
+if not Notify.init("Subunit-notify"):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ def notify_of_result(result):
|
||||
result.passed_tests,
|
||||
result.failed_tests,
|
||||
)
|
||||
- nw = pynotify.Notification(summary, body)
|
||||
+ nw = Notify.Notification(summary, body)
|
||||
nw.show()
|
||||
|
||||
|
||||
diff --git a/filters/subunit2gtk b/filters/subunit2gtk
|
||||
index 78b4309..5c0ebe3 100755
|
||||
--- a/filters/subunit2gtk
|
||||
+++ b/filters/subunit2gtk
|
||||
@@ -49,9 +49,9 @@ import sys
|
||||
import threading
|
||||
import unittest
|
||||
|
||||
-import pygtk
|
||||
-pygtk.require('2.0')
|
||||
-import gtk, gtk.gdk, gobject
|
||||
+import gi
|
||||
+gi.require_version('Gtk', '3.0')
|
||||
+from gi.repository import Gtk, GObject
|
||||
|
||||
from testtools import StreamToExtendedDecorator
|
||||
|
||||
@@ -75,64 +75,64 @@ class GTKTestResult(unittest.TestResult):
|
||||
self.not_ok_label = None
|
||||
self.total_tests = None
|
||||
|
||||
- self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
|
||||
+ self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
|
||||
self.window.set_resizable(True)
|
||||
|
||||
- self.window.connect("destroy", gtk.main_quit)
|
||||
+ self.window.connect("destroy", Gtk.main_quit)
|
||||
self.window.set_title("Tests...")
|
||||
self.window.set_border_width(0)
|
||||
|
||||
- vbox = gtk.VBox(False, 5)
|
||||
+ vbox = Gtk.VBox(False, 5)
|
||||
vbox.set_border_width(10)
|
||||
self.window.add(vbox)
|
||||
vbox.show()
|
||||
|
||||
# Create a centering alignment object
|
||||
- align = gtk.Alignment(0.5, 0.5, 0, 0)
|
||||
+ align = Gtk.Alignment.new(0.5, 0.5, 0, 0)
|
||||
vbox.pack_start(align, False, False, 5)
|
||||
align.show()
|
||||
|
||||
# Create the ProgressBar
|
||||
- self.pbar = gtk.ProgressBar()
|
||||
+ self.pbar = Gtk.ProgressBar()
|
||||
align.add(self.pbar)
|
||||
self.pbar.set_text("Running")
|
||||
self.pbar.show()
|
||||
self.progress_model = ProgressModel()
|
||||
|
||||
- separator = gtk.HSeparator()
|
||||
+ separator = Gtk.HSeparator()
|
||||
vbox.pack_start(separator, False, False, 0)
|
||||
separator.show()
|
||||
|
||||
# rows, columns, homogeneous
|
||||
- table = gtk.Table(2, 3, False)
|
||||
+ table = Gtk.Table(2, 3, False)
|
||||
vbox.pack_start(table, False, True, 0)
|
||||
table.show()
|
||||
# Show summary details about the run. Could use an expander.
|
||||
- label = gtk.Label("Run:")
|
||||
- table.attach(label, 0, 1, 1, 2, gtk.EXPAND | gtk.FILL,
|
||||
- gtk.EXPAND | gtk.FILL, 5, 5)
|
||||
+ label = Gtk.Label(label="Run:")
|
||||
+ table.attach(label, 0, 1, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
|
||||
label.show()
|
||||
- self.run_label = gtk.Label("N/A")
|
||||
- table.attach(self.run_label, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL,
|
||||
- gtk.EXPAND | gtk.FILL, 5, 5)
|
||||
+ self.run_label = Gtk.Label(label="N/A")
|
||||
+ table.attach(self.run_label, 1, 2, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
|
||||
self.run_label.show()
|
||||
|
||||
- label = gtk.Label("OK:")
|
||||
- table.attach(label, 0, 1, 2, 3, gtk.EXPAND | gtk.FILL,
|
||||
- gtk.EXPAND | gtk.FILL, 5, 5)
|
||||
+ label = Gtk.Label(label="OK:")
|
||||
+ table.attach(label, 0, 1, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
|
||||
label.show()
|
||||
- self.ok_label = gtk.Label("N/A")
|
||||
- table.attach(self.ok_label, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL,
|
||||
- gtk.EXPAND | gtk.FILL, 5, 5)
|
||||
+ self.ok_label = Gtk.Label(label="N/A")
|
||||
+ table.attach(self.ok_label, 1, 2, 2, 3, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
|
||||
self.ok_label.show()
|
||||
|
||||
- label = gtk.Label("Not OK:")
|
||||
- table.attach(label, 0, 1, 3, 4, gtk.EXPAND | gtk.FILL,
|
||||
- gtk.EXPAND | gtk.FILL, 5, 5)
|
||||
+ label = Gtk.Label(label="Not OK:")
|
||||
+ table.attach(label, 0, 1, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
|
||||
label.show()
|
||||
- self.not_ok_label = gtk.Label("N/A")
|
||||
- table.attach(self.not_ok_label, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL,
|
||||
- gtk.EXPAND | gtk.FILL, 5, 5)
|
||||
+ self.not_ok_label = Gtk.Label(label="N/A")
|
||||
+ table.attach(self.not_ok_label, 1, 2, 3, 4, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL,
|
||||
+ Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 5, 5)
|
||||
self.not_ok_label.show()
|
||||
|
||||
self.window.show()
|
||||
@@ -142,7 +142,7 @@ class GTKTestResult(unittest.TestResult):
|
||||
|
||||
def stopTest(self, test):
|
||||
super(GTKTestResult, self).stopTest(test)
|
||||
- gobject.idle_add(self._stopTest)
|
||||
+ GObject.idle_add(self._stopTest)
|
||||
|
||||
def _stopTest(self):
|
||||
self.progress_model.advance()
|
||||
@@ -159,26 +159,26 @@ class GTKTestResult(unittest.TestResult):
|
||||
super(GTKTestResult, self).stopTestRun()
|
||||
except AttributeError:
|
||||
pass
|
||||
- gobject.idle_add(self.pbar.set_text, 'Finished')
|
||||
+ GObject.idle_add(self.pbar.set_text, 'Finished')
|
||||
|
||||
def addError(self, test, err):
|
||||
super(GTKTestResult, self).addError(test, err)
|
||||
- gobject.idle_add(self.update_counts)
|
||||
+ GObject.idle_add(self.update_counts)
|
||||
|
||||
def addFailure(self, test, err):
|
||||
super(GTKTestResult, self).addFailure(test, err)
|
||||
- gobject.idle_add(self.update_counts)
|
||||
+ GObject.idle_add(self.update_counts)
|
||||
|
||||
def addSuccess(self, test):
|
||||
super(GTKTestResult, self).addSuccess(test)
|
||||
- gobject.idle_add(self.update_counts)
|
||||
+ GObject.idle_add(self.update_counts)
|
||||
|
||||
def addSkip(self, test, reason):
|
||||
# addSkip is new in Python 2.7/3.1
|
||||
addSkip = getattr(super(GTKTestResult, self), 'addSkip', None)
|
||||
if callable(addSkip):
|
||||
addSkip(test, reason)
|
||||
- gobject.idle_add(self.update_counts)
|
||||
+ GObject.idle_add(self.update_counts)
|
||||
|
||||
def addExpectedFailure(self, test, err):
|
||||
# addExpectedFailure is new in Python 2.7/3.1
|
||||
@@ -186,7 +186,7 @@ class GTKTestResult(unittest.TestResult):
|
||||
'addExpectedFailure', None)
|
||||
if callable(addExpectedFailure):
|
||||
addExpectedFailure(test, err)
|
||||
- gobject.idle_add(self.update_counts)
|
||||
+ GObject.idle_add(self.update_counts)
|
||||
|
||||
def addUnexpectedSuccess(self, test):
|
||||
# addUnexpectedSuccess is new in Python 2.7/3.1
|
||||
@@ -194,7 +194,7 @@ class GTKTestResult(unittest.TestResult):
|
||||
'addUnexpectedSuccess', None)
|
||||
if callable(addUnexpectedSuccess):
|
||||
addUnexpectedSuccess(test)
|
||||
- gobject.idle_add(self.update_counts)
|
||||
+ GObject.idle_add(self.update_counts)
|
||||
|
||||
def progress(self, offset, whence):
|
||||
if whence == PROGRESS_PUSH:
|
||||
@@ -218,12 +218,12 @@ class GTKTestResult(unittest.TestResult):
|
||||
self.ok_label.set_text(str(self.testsRun - bad))
|
||||
self.not_ok_label.set_text(str(bad))
|
||||
|
||||
-gobject.threads_init()
|
||||
+GObject.threads_init()
|
||||
result = StreamToExtendedDecorator(GTKTestResult())
|
||||
test = ByteStreamToStreamResult(sys.stdin, non_subunit_name='stdout')
|
||||
# Get setup
|
||||
-while gtk.events_pending():
|
||||
- gtk.main_iteration()
|
||||
+while Gtk.events_pending():
|
||||
+ Gtk.main_iteration()
|
||||
# Start IO
|
||||
def run_and_finish():
|
||||
test.run(result)
|
||||
@@ -232,7 +232,7 @@ t = threading.Thread(target=run_and_finish)
|
||||
t.daemon = True
|
||||
result.startTestRun()
|
||||
t.start()
|
||||
-gtk.main()
|
||||
+Gtk.main()
|
||||
if result.decorated.wasSuccessful():
|
||||
exit_code = 0
|
||||
else:
|
||||
--
|
||||
2.19.2
|
||||
|
||||
@ -1,19 +1,5 @@
|
||||
From 50101aef9e200edeaa800a77c74cda5461850296 Mon Sep 17 00:00:00 2001
|
||||
From: maminjie <maminjie1@huawei.com>
|
||||
Date: Wed, 3 Feb 2021 11:40:42 +0800
|
||||
Subject: [PATCH] port to python-iso8601 0.1.12
|
||||
|
||||
---
|
||||
python/subunit/__init__.py | 2 +-
|
||||
python/subunit/test_results.py | 2 +-
|
||||
python/subunit/tests/test_test_protocol.py | 4 ++--
|
||||
python/subunit/tests/test_test_protocol2.py | 4 ++--
|
||||
python/subunit/tests/test_test_results.py | 4 ++--
|
||||
python/subunit/v2.py | 2 +-
|
||||
6 files changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
|
||||
index b3b198c..846cc31 100644
|
||||
index 17a970a..63c7d66 100644
|
||||
--- a/python/subunit/__init__.py
|
||||
+++ b/python/subunit/__init__.py
|
||||
@@ -799,7 +799,7 @@ class TestProtocolClient(testresult.TestResult):
|
||||
@ -105,7 +91,7 @@ index 44f95b3..f1a83fd 100644
|
||||
self.assertEqual(1, len(self.decorated._calls))
|
||||
self.assertEqual(time, self.decorated._calls[0])
|
||||
diff --git a/python/subunit/v2.py b/python/subunit/v2.py
|
||||
index 254617c..be2049d 100644
|
||||
index e8a31d6..c299cab 100644
|
||||
--- a/python/subunit/v2.py
|
||||
+++ b/python/subunit/v2.py
|
||||
@@ -49,7 +49,7 @@ FLAG_TAGS = 0x0080
|
||||
@ -117,6 +103,3 @@ index 254617c..be2049d 100644
|
||||
NUL_ELEMENT = b'\0'[0]
|
||||
# Contains True for types for which 'nul in thing' falsely returns false.
|
||||
_nul_test_broken = {}
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
From 4abf704d1baddda950450ad057c5f4be87804928 Mon Sep 17 00:00:00 2001
|
||||
From: Quique Llorente <ellorent@redhat.com>
|
||||
Date: Wed, 26 Dec 2018 14:57:24 +0100
|
||||
Subject: [PATCH] Fix file open for python3
|
||||
|
||||
At python3 there is no "file" the "open" function has to be use to open
|
||||
a file.
|
||||
---
|
||||
python/subunit/filters.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/python/subunit/filters.py b/python/subunit/filters.py
|
||||
index 0a0a185..ec7e9f3 100644
|
||||
--- a/python/subunit/filters.py
|
||||
+++ b/python/subunit/filters.py
|
||||
@@ -5,7 +5,7 @@
|
||||
# license at the users choice. A copy of both licenses are available in the
|
||||
# project source as Apache-2.0 and BSD. You may not use this file except in
|
||||
# compliance with one of these two licences.
|
||||
-#
|
||||
+#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
@@ -143,7 +143,7 @@ def filter_by_result(result_factory, output_path, passthrough, forward,
|
||||
if output_path is None:
|
||||
output_to = sys.stdout
|
||||
else:
|
||||
- output_to = file(output_path, 'wb')
|
||||
+ output_to = open(output_path, 'w')
|
||||
|
||||
try:
|
||||
result = result_factory(output_to)
|
||||
--
|
||||
2.19.2
|
||||
|
||||
@ -1,70 +0,0 @@
|
||||
From 2db224de33b69718add29fa06904043b231efa44 Mon Sep 17 00:00:00 2001
|
||||
From: wangxiyuan <wangxiyuan1007@gmail.com>
|
||||
Date: Mon, 22 Feb 2021 16:14:11 +0800
|
||||
Subject: [PATCH] Work around 'short read' race
|
||||
|
||||
Backport python3 fix
|
||||
---
|
||||
python/subunit/v2.py | 35 +++++++++++++++++++++--------------
|
||||
1 file changed, 21 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/python/subunit/v2.py b/python/subunit/v2.py
|
||||
index be2049d..e44dc05 100644
|
||||
--- a/python/subunit/v2.py
|
||||
+++ b/python/subunit/v2.py
|
||||
@@ -71,6 +71,22 @@ def has_nul(buffer_or_bytes):
|
||||
else:
|
||||
return NUL_ELEMENT in buffer_or_bytes
|
||||
|
||||
+def read_exactly(stream, size):
|
||||
+ """Read exactly size bytes from stream.
|
||||
+ :param stream: A file like object to read bytes from. Must support
|
||||
+ read(<count>) and return bytes.
|
||||
+ :param size: The number of bytes to retrieve.
|
||||
+ """
|
||||
+ data = b''
|
||||
+ remaining = size
|
||||
+ while remaining:
|
||||
+ read = stream.read(remaining)
|
||||
+ if len(read) == 0:
|
||||
+ raise ParseError('Short read - got %d bytes, wanted %d bytes' % (
|
||||
+ len(data), size))
|
||||
+ data += read
|
||||
+ remaining -= len(read)
|
||||
+ return data
|
||||
|
||||
class ParseError(Exception):
|
||||
"""Used to pass error messages within the parser."""
|
||||
@@ -404,19 +420,11 @@ class ByteStreamToStreamResult(object):
|
||||
|
||||
def _parse(self, packet, result):
|
||||
# 2 bytes flags, at most 3 bytes length.
|
||||
- packet.append(self.source.read(5))
|
||||
- if len(packet[-1]) != 5:
|
||||
- raise ParseError(
|
||||
- 'Short read - got %d bytes, wanted 5' % len(packet[-1]))
|
||||
- flag_bytes = packet[-1][:2]
|
||||
- flags = struct.unpack(FMT_16, flag_bytes)[0]
|
||||
- length, consumed = self._parse_varint(
|
||||
- packet[-1], 2, max_3_bytes=True)
|
||||
- remainder = self.source.read(length - 6)
|
||||
- if len(remainder) != length - 6:
|
||||
- raise ParseError(
|
||||
- 'Short read - got %d bytes, wanted %d bytes' % (
|
||||
- len(remainder), length - 6))
|
||||
+ header = read_exactly(self.source, 5)
|
||||
+ packet.append(header)
|
||||
+ flags = struct.unpack(FMT_16, header[:2])[0]
|
||||
+ length, consumed = self._parse_varint(header, 2, max_3_bytes=True)
|
||||
+ remainder = read_exactly(self.source, length - 6)
|
||||
if consumed != 3:
|
||||
# Avoid having to parse torn values
|
||||
packet[-1] += remainder
|
||||
@@ -515,4 +523,3 @@ class ByteStreamToStreamResult(object):
|
||||
return utf8, length+pos
|
||||
except UnicodeDecodeError:
|
||||
raise ParseError('UTF8 string at offset %d is not UTF8' % (pos-2,))
|
||||
-
|
||||
--
|
||||
2.23.0.windows.1
|
||||
|
||||
Binary file not shown.
BIN
subunit-1.4.0.tar.gz
Normal file
BIN
subunit-1.4.0.tar.gz
Normal file
Binary file not shown.
@ -1,21 +1,8 @@
|
||||
From 2051f178d568a1595f497308703495b9e33ff80b Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Bezdicka <lbezdick@redhat.com>
|
||||
Date: Wed, 2 Sep 2015 06:55:42 -0400
|
||||
Subject: [PATCH] Correctly decode binary to utf8 string
|
||||
|
||||
This patch solves error:
|
||||
Expecting a string b'2014-12-16 20:42:25.441886Z'
|
||||
|
||||
Related-Bug: #1403214
|
||||
---
|
||||
python/subunit/__init__.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
|
||||
index 7d864e8..b198884 100644
|
||||
index 63c7d66..e735437 100644
|
||||
--- a/python/subunit/__init__.py
|
||||
+++ b/python/subunit/__init__.py
|
||||
@@ -556,7 +556,7 @@ def _handleTags(self, offset, line):
|
||||
@@ -556,7 +556,7 @@ class TestProtocolServer(object):
|
||||
def _handleTime(self, offset, line):
|
||||
# Accept it, but do not do anything with it yet.
|
||||
try:
|
||||
|
||||
24
subunit.spec
24
subunit.spec
@ -1,17 +1,14 @@
|
||||
Name: subunit
|
||||
Version: 1.3.0
|
||||
Release: 15
|
||||
Version: 1.4.0
|
||||
Release: 1
|
||||
Summary: C bindings for subunit
|
||||
License: ASL 2.0 or BSD
|
||||
URL: https://launchpad.net/subunit
|
||||
Source0: https://launchpad.net/subunit/trunk/1.3/+download/subunit-%{version}.tar.gz
|
||||
Source0: https://launchpad.net/subunit/trunk/%{version}/+download/%{name}-%{version}.tar.gz
|
||||
Patch0: %{name}-unbundle-iso8601.patch
|
||||
Patch1: %{name}-decode-binary-to-unicode.patch
|
||||
Patch2: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch
|
||||
Patch3: 0002-Fix-file-open-for-python3.patch
|
||||
Patch4: 0003-port-to-python-iso8601-0.1.12.patch
|
||||
Patch5: 0004-Work-around-short-read-race.patch
|
||||
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators
|
||||
Patch2: 0001-port-to-python-iso8601-0.1.14.patch
|
||||
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators make
|
||||
BuildRequires: perl(ExtUtils::MakeMaker) pkgconfig
|
||||
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
|
||||
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios
|
||||
@ -106,13 +103,7 @@ Subunit C bindings in a static library, for building statically linked
|
||||
test cases.
|
||||
|
||||
%prep
|
||||
%setup -qc
|
||||
%patch0
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%autosetup -n %{name}-%{version} -S git
|
||||
fixtimestamp() {
|
||||
touch -r $1.orig $1
|
||||
rm $1.orig
|
||||
@ -251,6 +242,9 @@ popd
|
||||
%exclude %{_bindir}/%{name}-diff
|
||||
|
||||
%changelog
|
||||
* Mon Jul 12 2021 huangtianhua <huangtianhua@huawei.com> - 1.4.0-1
|
||||
- Upgrade to 1.4.0 and drop the patches which have been upstreamed
|
||||
|
||||
* Mon Feb 22 2021 wangxiyuan <wangxiyuan1007@gmail.com> - 1.3.0-15
|
||||
- CleanUp python2 residual content and backport a python3 known issue.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user