Compare commits
10 Commits
5fd0e5a245
...
7e7b18a430
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e7b18a430 | ||
|
|
511ffd1c18 | ||
|
|
63bb6657d7 | ||
|
|
7f10bea380 | ||
|
|
eff65e0eb8 | ||
|
|
0c58befa8d | ||
|
|
a06cbde093 | ||
|
|
501a10d33c | ||
|
|
6716636241 | ||
|
|
5b5e0d1f1f |
@ -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
|
|
||||||
|
|
||||||
105
0001-port-to-python-iso8601-0.1.14.patch
Normal file
105
0001-port-to-python-iso8601-0.1.14.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
|
||||||
|
index 17a970a..63c7d66 100644
|
||||||
|
--- a/python/subunit/__init__.py
|
||||||
|
+++ b/python/subunit/__init__.py
|
||||||
|
@@ -799,7 +799,7 @@ class TestProtocolClient(testresult.TestResult):
|
||||||
|
|
||||||
|
":param datetime: A datetime.datetime object.
|
||||||
|
"""
|
||||||
|
- time = a_datetime.astimezone(iso8601.Utc())
|
||||||
|
+ time = a_datetime.astimezone(iso8601.UTC)
|
||||||
|
self._stream.write(_b("time: %04d-%02d-%02d %02d:%02d:%02d.%06dZ\n" % (
|
||||||
|
time.year, time.month, time.day, time.hour, time.minute,
|
||||||
|
time.second, time.microsecond)))
|
||||||
|
diff --git a/python/subunit/test_results.py b/python/subunit/test_results.py
|
||||||
|
index 53c3dad..3cda44a 100644
|
||||||
|
--- a/python/subunit/test_results.py
|
||||||
|
+++ b/python/subunit/test_results.py
|
||||||
|
@@ -196,7 +196,7 @@ class AutoTimingTestResultDecorator(HookedTestResultDecorator):
|
||||||
|
time = self._time
|
||||||
|
if time is not None:
|
||||||
|
return
|
||||||
|
- time = datetime.datetime.utcnow().replace(tzinfo=iso8601.Utc())
|
||||||
|
+ time = datetime.datetime.utcnow().replace(tzinfo=iso8601.UTC)
|
||||||
|
self.decorated.time(time)
|
||||||
|
|
||||||
|
def progress(self, offset, whence):
|
||||||
|
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
|
||||||
|
index 7427b12..7692489 100644
|
||||||
|
--- a/python/subunit/tests/test_test_protocol.py
|
||||||
|
+++ b/python/subunit/tests/test_test_protocol.py
|
||||||
|
@@ -993,7 +993,7 @@ class TestTestProtocolServerStreamTime(unittest.TestCase):
|
||||||
|
self.assertEqual(_b(""), self.stream.getvalue())
|
||||||
|
self.assertEqual([
|
||||||
|
('time', datetime.datetime(2001, 12, 12, 12, 59, 59, 0,
|
||||||
|
- iso8601.Utc()))
|
||||||
|
+ iso8601.UTC))
|
||||||
|
], self.result._events)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1368,7 +1368,7 @@ class TestTestProtocolClient(TestCase):
|
||||||
|
def test_time(self):
|
||||||
|
# Calling time() outputs a time signal immediately.
|
||||||
|
self.protocol.time(
|
||||||
|
- datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc()))
|
||||||
|
+ datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC))
|
||||||
|
self.assertEqual(
|
||||||
|
_b("time: 2009-10-11 12:13:14.000015Z\n"),
|
||||||
|
self.io.getvalue())
|
||||||
|
diff --git a/python/subunit/tests/test_test_protocol2.py b/python/subunit/tests/test_test_protocol2.py
|
||||||
|
index bbf510e..f970ed6 100644
|
||||||
|
--- a/python/subunit/tests/test_test_protocol2.py
|
||||||
|
+++ b/python/subunit/tests/test_test_protocol2.py
|
||||||
|
@@ -218,7 +218,7 @@ class TestStreamResultToBytes(TestCase):
|
||||||
|
|
||||||
|
def test_timestamp(self):
|
||||||
|
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
|
||||||
|
- iso8601.Utc())
|
||||||
|
+ iso8601.UTC)
|
||||||
|
result, output = self._make_result()
|
||||||
|
result.status(test_id="bar", test_status='success', timestamp=timestamp)
|
||||||
|
self.assertEqual(CONSTANT_TIMESTAMP, output.getvalue())
|
||||||
|
@@ -382,7 +382,7 @@ class TestByteStreamToStreamResult(TestCase):
|
||||||
|
|
||||||
|
def test_timestamp(self):
|
||||||
|
timestamp = datetime.datetime(2001, 12, 12, 12, 59, 59, 45,
|
||||||
|
- iso8601.Utc())
|
||||||
|
+ iso8601.UTC)
|
||||||
|
self.check_event(CONSTANT_TIMESTAMP,
|
||||||
|
'success', test_id='bar', timestamp=timestamp)
|
||||||
|
|
||||||
|
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
|
||||||
|
index 44f95b3..f1a83fd 100644
|
||||||
|
--- a/python/subunit/tests/test_test_results.py
|
||||||
|
+++ b/python/subunit/tests/test_test_results.py
|
||||||
|
@@ -178,7 +178,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
|
||||||
|
def test_calling_time_inhibits_automatic_time(self):
|
||||||
|
# Calling time() outputs a time signal immediately and prevents
|
||||||
|
# automatically adding one when other methods are called.
|
||||||
|
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
|
||||||
|
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
|
||||||
|
self.result.time(time)
|
||||||
|
self.result.startTest(self)
|
||||||
|
self.result.stopTest(self)
|
||||||
|
@@ -186,7 +186,7 @@ class TestAutoTimingTestResultDecorator(unittest.TestCase):
|
||||||
|
self.assertEqual(time, self.decorated._calls[0])
|
||||||
|
|
||||||
|
def test_calling_time_None_enables_automatic_time(self):
|
||||||
|
- time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.Utc())
|
||||||
|
+ time = datetime.datetime(2009,10,11,12,13,14,15, iso8601.UTC)
|
||||||
|
self.result.time(time)
|
||||||
|
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 e8a31d6..c299cab 100644
|
||||||
|
--- a/python/subunit/v2.py
|
||||||
|
+++ b/python/subunit/v2.py
|
||||||
|
@@ -49,7 +49,7 @@ FLAG_TAGS = 0x0080
|
||||||
|
FLAG_MIME_TYPE = 0x0020
|
||||||
|
FLAG_EOF = 0x0010
|
||||||
|
FLAG_FILE_CONTENT = 0x0040
|
||||||
|
-EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.Utc())
|
||||||
|
+EPOCH = datetime.datetime.utcfromtimestamp(0).replace(tzinfo=iso8601.UTC)
|
||||||
|
NUL_ELEMENT = b'\0'[0]
|
||||||
|
# Contains True for types for which 'nul in thing' falsely returns false.
|
||||||
|
_nul_test_broken = {}
|
||||||
@ -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
|
|
||||||
|
|
||||||
469
Fix-tests-with-testtools-2.5.0.patch
Normal file
469
Fix-tests-with-testtools-2.5.0.patch
Normal file
@ -0,0 +1,469 @@
|
|||||||
|
From 64970adcf1a324443d2a3bfa3b152d90561906af Mon Sep 17 00:00:00 2001
|
||||||
|
From: starlet-dx <15929766099@163.com>
|
||||||
|
Date: Thu, 7 Jul 2022 17:27:16 +0800
|
||||||
|
Subject: [PATCH 1/1] Fix tests with testtools 2.5.0
|
||||||
|
|
||||||
|
---
|
||||||
|
python/subunit/__init__.py | 8 +-
|
||||||
|
python/subunit/details.py | 6 +-
|
||||||
|
python/subunit/tests/__init__.py | 1 +
|
||||||
|
python/subunit/tests/test_chunked.py | 6 +-
|
||||||
|
python/subunit/tests/test_details.py | 6 +-
|
||||||
|
python/subunit/tests/test_subunit_filter.py | 6 +-
|
||||||
|
python/subunit/tests/test_subunit_stats.py | 6 +-
|
||||||
|
python/subunit/tests/test_test_protocol.py | 211 ++++++++++++--------
|
||||||
|
python/subunit/tests/test_test_results.py | 5 +-
|
||||||
|
9 files changed, 165 insertions(+), 90 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/python/subunit/__init__.py b/python/subunit/__init__.py
|
||||||
|
index 17a970a..f9321e0 100644
|
||||||
|
--- a/python/subunit/__init__.py
|
||||||
|
+++ b/python/subunit/__init__.py
|
||||||
|
@@ -129,7 +129,11 @@ except ImportError:
|
||||||
|
from extras import safe_hasattr
|
||||||
|
from testtools import content, content_type, ExtendedToOriginalDecorator
|
||||||
|
from testtools.content import TracebackContent
|
||||||
|
-from testtools.compat import _b, _u, BytesIO, StringIO
|
||||||
|
+from testtools.compat import _b, _u
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import BytesIO, StringIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import BytesIO, StringIO
|
||||||
|
try:
|
||||||
|
from testtools.testresult.real import _StringException
|
||||||
|
RemoteException = _StringException
|
||||||
|
@@ -817,7 +821,7 @@ class TestProtocolClient(testresult.TestResult):
|
||||||
|
if parameters:
|
||||||
|
self._stream.write(_b(";"))
|
||||||
|
param_strs = []
|
||||||
|
- for param, value in parameters.items():
|
||||||
|
+ for param, value in sorted(parameters.items()):
|
||||||
|
param_strs.append("%s=%s" % (param, value))
|
||||||
|
self._stream.write(_b(",".join(param_strs)))
|
||||||
|
self._stream.write(_b("\n%s\n" % name))
|
||||||
|
diff --git a/python/subunit/details.py b/python/subunit/details.py
|
||||||
|
index 9e5e005..5105580 100644
|
||||||
|
--- a/python/subunit/details.py
|
||||||
|
+++ b/python/subunit/details.py
|
||||||
|
@@ -17,7 +17,11 @@
|
||||||
|
"""Handlers for outcome details."""
|
||||||
|
|
||||||
|
from testtools import content, content_type
|
||||||
|
-from testtools.compat import _b, BytesIO
|
||||||
|
+from testtools.compat import _b
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import BytesIO, StringIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import BytesIO, StringIO
|
||||||
|
|
||||||
|
from subunit import chunked
|
||||||
|
|
||||||
|
diff --git a/python/subunit/tests/__init__.py b/python/subunit/tests/__init__.py
|
||||||
|
index c6599f7..4c8b2ae 100644
|
||||||
|
--- a/python/subunit/tests/__init__.py
|
||||||
|
+++ b/python/subunit/tests/__init__.py
|
||||||
|
@@ -23,6 +23,7 @@ from testscenarios import generate_scenarios
|
||||||
|
# Before the test module imports to avoid circularity.
|
||||||
|
# For testing: different pythons have different str() implementations.
|
||||||
|
_remote_exception_repr = "testtools.testresult.real._StringException"
|
||||||
|
+_remote_exception_repr_chunked = "34\r\n" + _remote_exception_repr + ": boo qux\n0\r\n"
|
||||||
|
_remote_exception_str = "Traceback (most recent call last):\ntesttools.testresult.real._StringException"
|
||||||
|
_remote_exception_str_chunked = "57\r\n" + _remote_exception_str + ": boo qux\n0\r\n"
|
||||||
|
|
||||||
|
diff --git a/python/subunit/tests/test_chunked.py b/python/subunit/tests/test_chunked.py
|
||||||
|
index 5100b32..46cf150 100644
|
||||||
|
--- a/python/subunit/tests/test_chunked.py
|
||||||
|
+++ b/python/subunit/tests/test_chunked.py
|
||||||
|
@@ -17,7 +17,11 @@
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
-from testtools.compat import _b, BytesIO
|
||||||
|
+from testtools.compat import _b
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import BytesIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import BytesIO
|
||||||
|
|
||||||
|
import subunit.chunked
|
||||||
|
|
||||||
|
diff --git a/python/subunit/tests/test_details.py b/python/subunit/tests/test_details.py
|
||||||
|
index 8605c5a..f3c70d2 100644
|
||||||
|
--- a/python/subunit/tests/test_details.py
|
||||||
|
+++ b/python/subunit/tests/test_details.py
|
||||||
|
@@ -16,7 +16,11 @@
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
-from testtools.compat import _b, StringIO
|
||||||
|
+from testtools.compat import _b
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import StringIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import StringIO
|
||||||
|
|
||||||
|
import subunit.tests
|
||||||
|
from subunit import content, content_type, details
|
||||||
|
diff --git a/python/subunit/tests/test_subunit_filter.py b/python/subunit/tests/test_subunit_filter.py
|
||||||
|
index 95aea36..baef3f6 100644
|
||||||
|
--- a/python/subunit/tests/test_subunit_filter.py
|
||||||
|
+++ b/python/subunit/tests/test_subunit_filter.py
|
||||||
|
@@ -24,7 +24,11 @@ from subunit import iso8601
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from testtools import TestCase
|
||||||
|
-from testtools.compat import _b, BytesIO
|
||||||
|
+from testtools.compat import _b
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import BytesIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import BytesIO
|
||||||
|
from testtools.testresult.doubles import ExtendedTestResult, StreamResult
|
||||||
|
|
||||||
|
import subunit
|
||||||
|
diff --git a/python/subunit/tests/test_subunit_stats.py b/python/subunit/tests/test_subunit_stats.py
|
||||||
|
index 7c5e42d..9faf24d 100644
|
||||||
|
--- a/python/subunit/tests/test_subunit_stats.py
|
||||||
|
+++ b/python/subunit/tests/test_subunit_stats.py
|
||||||
|
@@ -18,7 +18,11 @@
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
-from testtools.compat import _b, BytesIO, StringIO
|
||||||
|
+from testtools.compat import _b
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import BytesIO, StringIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import BytesIO, StringIO
|
||||||
|
|
||||||
|
import subunit
|
||||||
|
|
||||||
|
diff --git a/python/subunit/tests/test_test_protocol.py b/python/subunit/tests/test_test_protocol.py
|
||||||
|
index 7427b12..70e3564 100644
|
||||||
|
--- a/python/subunit/tests/test_test_protocol.py
|
||||||
|
+++ b/python/subunit/tests/test_test_protocol.py
|
||||||
|
@@ -16,13 +16,17 @@
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
import io
|
||||||
|
-import unittest2 as unittest
|
||||||
|
import os
|
||||||
|
-import sys
|
||||||
|
import tempfile
|
||||||
|
+import unittest
|
||||||
|
|
||||||
|
+import six
|
||||||
|
from testtools import PlaceHolder, skipIf, TestCase, TestResult
|
||||||
|
-from testtools.compat import _b, _u, BytesIO
|
||||||
|
+from testtools.compat import _b, _u
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import BytesIO, StringIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import BytesIO, StringIO
|
||||||
|
from testtools.content import Content, TracebackContent, text_content
|
||||||
|
from testtools.content_type import ContentType
|
||||||
|
try:
|
||||||
|
@@ -37,18 +41,19 @@ except ImportError:
|
||||||
|
Python27TestResult,
|
||||||
|
ExtendedTestResult,
|
||||||
|
)
|
||||||
|
-from testtools.matchers import Contains
|
||||||
|
+from testtools.matchers import Contains, Equals, MatchesAny
|
||||||
|
|
||||||
|
import subunit
|
||||||
|
from subunit.tests import (
|
||||||
|
_remote_exception_repr,
|
||||||
|
+ _remote_exception_repr_chunked,
|
||||||
|
_remote_exception_str,
|
||||||
|
_remote_exception_str_chunked,
|
||||||
|
)
|
||||||
|
import subunit.iso8601 as iso8601
|
||||||
|
|
||||||
|
|
||||||
|
-tb_prelude = "Traceback (most recent call last):\n"
|
||||||
|
+tb_prelude = "Traceback (most recent call last):\n"
|
||||||
|
|
||||||
|
|
||||||
|
def details_to_str(details):
|
||||||
|
@@ -60,7 +65,7 @@ class TestHelpers(TestCase):
|
||||||
|
fd, file_path = tempfile.mkstemp()
|
||||||
|
self.addCleanup(os.remove, file_path)
|
||||||
|
fake_file = os.fdopen(fd, 'r')
|
||||||
|
- if sys.version_info > (3, 0):
|
||||||
|
+ if six.PY3:
|
||||||
|
self.assertEqual(fake_file.buffer,
|
||||||
|
subunit._unwrap_text(fake_file))
|
||||||
|
else:
|
||||||
|
@@ -70,7 +75,7 @@ class TestHelpers(TestCase):
|
||||||
|
fd, file_path = tempfile.mkstemp()
|
||||||
|
self.addCleanup(os.remove, file_path)
|
||||||
|
fake_file = os.fdopen(fd, 'w')
|
||||||
|
- if sys.version_info > (3, 0):
|
||||||
|
+ if six.PY3:
|
||||||
|
self.assertEqual(fake_file.buffer,
|
||||||
|
subunit._unwrap_text(fake_file))
|
||||||
|
else:
|
||||||
|
@@ -152,13 +157,20 @@ class TestTestProtocolServerPipe(unittest.TestCase):
|
||||||
|
protocol.readFrom(pipe)
|
||||||
|
bing = subunit.RemotedTestCase("bing crosby")
|
||||||
|
an_error = subunit.RemotedTestCase("an error")
|
||||||
|
- self.assertEqual(
|
||||||
|
- client.errors,
|
||||||
|
- [(an_error, tb_prelude + _remote_exception_repr + '\n')])
|
||||||
|
- self.assertEqual(
|
||||||
|
- client.failures,
|
||||||
|
- [(bing, tb_prelude + _remote_exception_repr + ": "
|
||||||
|
- + details_to_str({'traceback': text_content(traceback)}) + "\n")])
|
||||||
|
+ if six.PY3:
|
||||||
|
+ self.assertEqual(client.errors,
|
||||||
|
+ [(an_error, _remote_exception_repr + '\n')])
|
||||||
|
+ self.assertEqual(
|
||||||
|
+ client.failures,
|
||||||
|
+ [(bing, _remote_exception_repr + ": "
|
||||||
|
+ + details_to_str({'traceback': text_content(traceback)}) + "\n")])
|
||||||
|
+ else:
|
||||||
|
+ self.assertEqual(client.errors,
|
||||||
|
+ [(an_error, '_StringException\n')])
|
||||||
|
+ self.assertEqual(
|
||||||
|
+ client.failures,
|
||||||
|
+ [(bing, "_StringException: "
|
||||||
|
+ + details_to_str({'traceback': text_content(traceback)}) + "\n")])
|
||||||
|
self.assertEqual(client.testsRun, 3)
|
||||||
|
|
||||||
|
def test_non_test_characters_forwarded_immediately(self):
|
||||||
|
@@ -1012,9 +1024,14 @@ class TestRemotedTestCase(unittest.TestCase):
|
||||||
|
"'A test description'>", "%r" % test)
|
||||||
|
result = unittest.TestResult()
|
||||||
|
test.run(result)
|
||||||
|
- self.assertEqual([(test, tb_prelude + _remote_exception_repr + ": "
|
||||||
|
- "Cannot run RemotedTestCases.\n\n")],
|
||||||
|
- result.errors)
|
||||||
|
+ if six.PY3:
|
||||||
|
+ self.assertEqual([(test, _remote_exception_repr + ': ' +
|
||||||
|
+ "Cannot run RemotedTestCases.\n\n")],
|
||||||
|
+ result.errors)
|
||||||
|
+ else:
|
||||||
|
+ self.assertEqual([(test, "_StringException: " +
|
||||||
|
+ "Cannot run RemotedTestCases.\n\n")],
|
||||||
|
+ result.errors)
|
||||||
|
self.assertEqual(1, result.testsRun)
|
||||||
|
another_test = subunit.RemotedTestCase("A test description")
|
||||||
|
self.assertEqual(test, another_test)
|
||||||
|
@@ -1178,6 +1195,11 @@ class TestIsolatedTestSuite(TestCase):
|
||||||
|
self.assertEqual(self.SampleTestToIsolate.TEST, False)
|
||||||
|
|
||||||
|
|
||||||
|
+# A number of these tests produce different output depending on the
|
||||||
|
+# testtools version. testtools < 2.5.0 used traceback2, which incorrectly
|
||||||
|
+# included the traceback header even for an exception with no traceback.
|
||||||
|
+# testtools 2.5.0 switched to the Python 3 standard library's traceback
|
||||||
|
+# module, which fixes this bug. See https://bugs.python.org/issue24695.
|
||||||
|
class TestTestProtocolClient(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
@@ -1233,96 +1255,121 @@ class TestTestProtocolClient(TestCase):
|
||||||
|
"""Test addFailure on a TestProtocolClient."""
|
||||||
|
self.protocol.addFailure(
|
||||||
|
self.test, subunit.RemoteError(_u("boo qux")))
|
||||||
|
- self.assertEqual(
|
||||||
|
- self.io.getvalue(),
|
||||||
|
- _b(('failure: %s [\n' + _remote_exception_str + ': boo qux\n]\n')
|
||||||
|
- % self.test.id()))
|
||||||
|
+ self.assertThat(self.io.getvalue(), MatchesAny(
|
||||||
|
+ # testtools < 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ 'failure: %s [\n' +
|
||||||
|
+ _remote_exception_str + ': boo qux\n' +
|
||||||
|
+ ']\n') % self.test.id())),
|
||||||
|
+ # testtools >= 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ 'failure: %s [\n' +
|
||||||
|
+ _remote_exception_repr + ': boo qux\n' +
|
||||||
|
+ ']\n') % self.test.id()))))
|
||||||
|
|
||||||
|
def test_add_failure_details(self):
|
||||||
|
"""Test addFailure on a TestProtocolClient with details."""
|
||||||
|
self.protocol.addFailure(
|
||||||
|
self.test, details=self.sample_tb_details)
|
||||||
|
- self.assertThat([
|
||||||
|
- _b(("failure: %s [ multipart\n"
|
||||||
|
- "Content-Type: text/plain\n"
|
||||||
|
- "something\n"
|
||||||
|
- "F\r\nserialised\nform0\r\n"
|
||||||
|
- "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
- "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
- "]\n") % self.test.id()),
|
||||||
|
- _b(("failure: %s [ multipart\n"
|
||||||
|
- "Content-Type: text/plain\n"
|
||||||
|
- "something\n"
|
||||||
|
- "F\r\nserialised\nform0\r\n"
|
||||||
|
- "Content-Type: text/x-traceback;language=python,charset=utf8\n"
|
||||||
|
- "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
- "]\n") % self.test.id()),
|
||||||
|
- ],
|
||||||
|
- Contains(self.io.getvalue())),
|
||||||
|
+ self.assertThat(self.io.getvalue(), MatchesAny(
|
||||||
|
+ # testtools < 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ "failure: %s [ multipart\n"
|
||||||
|
+ "Content-Type: text/plain\n"
|
||||||
|
+ "something\n"
|
||||||
|
+ "F\r\nserialised\nform0\r\n"
|
||||||
|
+ "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
+ "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
+ "]\n") % self.test.id())),
|
||||||
|
+ # testtools >= 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ "failure: %s [ multipart\n"
|
||||||
|
+ "Content-Type: text/plain\n"
|
||||||
|
+ "something\n"
|
||||||
|
+ "F\r\nserialised\nform0\r\n"
|
||||||
|
+ "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
+ "traceback\n" + _remote_exception_repr_chunked +
|
||||||
|
+ "]\n") % self.test.id()))))
|
||||||
|
|
||||||
|
def test_add_error(self):
|
||||||
|
"""Test stopTest on a TestProtocolClient."""
|
||||||
|
self.protocol.addError(
|
||||||
|
self.test, subunit.RemoteError(_u("phwoar crikey")))
|
||||||
|
- self.assertEqual(
|
||||||
|
- self.io.getvalue(),
|
||||||
|
- _b(('error: %s [\n' +
|
||||||
|
- _remote_exception_str + ": phwoar crikey\n"
|
||||||
|
- "]\n") % self.test.id()))
|
||||||
|
+ self.assertThat(self.io.getvalue(), MatchesAny(
|
||||||
|
+ # testtools < 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ 'error: %s [\n' +
|
||||||
|
+ _remote_exception_str + ": phwoar crikey\n"
|
||||||
|
+ "]\n") % self.test.id())),
|
||||||
|
+ # testtools >= 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ 'error: %s [\n' +
|
||||||
|
+ _remote_exception_repr + ": phwoar crikey\n"
|
||||||
|
+ "]\n") % self.test.id()))))
|
||||||
|
|
||||||
|
def test_add_error_details(self):
|
||||||
|
"""Test stopTest on a TestProtocolClient with details."""
|
||||||
|
self.protocol.addError(
|
||||||
|
self.test, details=self.sample_tb_details)
|
||||||
|
- self.assertThat([
|
||||||
|
- _b(("error: %s [ multipart\n"
|
||||||
|
- "Content-Type: text/plain\n"
|
||||||
|
- "something\n"
|
||||||
|
- "F\r\nserialised\nform0\r\n"
|
||||||
|
- "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
- "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
- "]\n") % self.test.id()),
|
||||||
|
- _b(("error: %s [ multipart\n"
|
||||||
|
- "Content-Type: text/plain\n"
|
||||||
|
- "something\n"
|
||||||
|
- "F\r\nserialised\nform0\r\n"
|
||||||
|
- "Content-Type: text/x-traceback;language=python,charset=utf8\n"
|
||||||
|
- "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
- "]\n") % self.test.id()),
|
||||||
|
- ],
|
||||||
|
- Contains(self.io.getvalue())),
|
||||||
|
+ self.assertThat(self.io.getvalue(), MatchesAny(
|
||||||
|
+ # testtools < 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ "error: %s [ multipart\n"
|
||||||
|
+ "Content-Type: text/plain\n"
|
||||||
|
+ "something\n"
|
||||||
|
+ "F\r\nserialised\nform0\r\n"
|
||||||
|
+ "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
+ "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
+ "]\n") % self.test.id())),
|
||||||
|
+ # testtools >= 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ "error: %s [ multipart\n"
|
||||||
|
+ "Content-Type: text/plain\n"
|
||||||
|
+ "something\n"
|
||||||
|
+ "F\r\nserialised\nform0\r\n"
|
||||||
|
+ "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
+ "traceback\n" + _remote_exception_repr_chunked +
|
||||||
|
+ "]\n") % self.test.id()))))
|
||||||
|
|
||||||
|
def test_add_expected_failure(self):
|
||||||
|
"""Test addExpectedFailure on a TestProtocolClient."""
|
||||||
|
self.protocol.addExpectedFailure(
|
||||||
|
self.test, subunit.RemoteError(_u("phwoar crikey")))
|
||||||
|
- self.assertEqual(
|
||||||
|
- self.io.getvalue(),
|
||||||
|
- _b(('xfail: %s [\n' +
|
||||||
|
- _remote_exception_str + ": phwoar crikey\n"
|
||||||
|
- "]\n") % self.test.id()))
|
||||||
|
+ self.assertThat(self.io.getvalue(), MatchesAny(
|
||||||
|
+ # testtools < 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ 'xfail: %s [\n' +
|
||||||
|
+ _remote_exception_str + ": phwoar crikey\n"
|
||||||
|
+ "]\n") % self.test.id())),
|
||||||
|
+ # testtools >= 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ 'xfail: %s [\n' +
|
||||||
|
+ _remote_exception_repr + ": phwoar crikey\n"
|
||||||
|
+ "]\n") % self.test.id()))))
|
||||||
|
|
||||||
|
def test_add_expected_failure_details(self):
|
||||||
|
"""Test addExpectedFailure on a TestProtocolClient with details."""
|
||||||
|
self.protocol.addExpectedFailure(
|
||||||
|
self.test, details=self.sample_tb_details)
|
||||||
|
- self.assertThat([
|
||||||
|
- _b(("xfail: %s [ multipart\n"
|
||||||
|
- "Content-Type: text/plain\n"
|
||||||
|
- "something\n"
|
||||||
|
- "F\r\nserialised\nform0\r\n"
|
||||||
|
- "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
- "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
- "]\n") % self.test.id()),
|
||||||
|
- _b(("xfail: %s [ multipart\n"
|
||||||
|
- "Content-Type: text/plain\n"
|
||||||
|
- "something\n"
|
||||||
|
- "F\r\nserialised\nform0\r\n"
|
||||||
|
- "Content-Type: text/x-traceback;language=python,charset=utf8\n"
|
||||||
|
- "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
- "]\n") % self.test.id()),
|
||||||
|
- ],
|
||||||
|
- Contains(self.io.getvalue())),
|
||||||
|
+ self.assertThat(self.io.getvalue(), MatchesAny(
|
||||||
|
+ # testtools < 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ "xfail: %s [ multipart\n"
|
||||||
|
+ "Content-Type: text/plain\n"
|
||||||
|
+ "something\n"
|
||||||
|
+ "F\r\nserialised\nform0\r\n"
|
||||||
|
+ "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
+ "traceback\n" + _remote_exception_str_chunked +
|
||||||
|
+ "]\n") % self.test.id())),
|
||||||
|
+ # testtools >= 2.5.0
|
||||||
|
+ Equals(_b((
|
||||||
|
+ "xfail: %s [ multipart\n"
|
||||||
|
+ "Content-Type: text/plain\n"
|
||||||
|
+ "something\n"
|
||||||
|
+ "F\r\nserialised\nform0\r\n"
|
||||||
|
+ "Content-Type: text/x-traceback;charset=utf8,language=python\n"
|
||||||
|
+ "traceback\n" + _remote_exception_repr_chunked +
|
||||||
|
+ "]\n") % self.test.id()))))
|
||||||
|
|
||||||
|
def test_add_skip(self):
|
||||||
|
"""Test addSkip on a TestProtocolClient."""
|
||||||
|
diff --git a/python/subunit/tests/test_test_results.py b/python/subunit/tests/test_test_results.py
|
||||||
|
index 44f95b3..add30bb 100644
|
||||||
|
--- a/python/subunit/tests/test_test_results.py
|
||||||
|
+++ b/python/subunit/tests/test_test_results.py
|
||||||
|
@@ -20,7 +20,10 @@ import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from testtools import TestCase
|
||||||
|
-from testtools.compat import StringIO
|
||||||
|
+try:
|
||||||
|
+ from testtools.compat import StringIO
|
||||||
|
+except ImportError:
|
||||||
|
+ from io import StringIO
|
||||||
|
from testtools.content import (
|
||||||
|
text_content,
|
||||||
|
TracebackContent,
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
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
|
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
|
--- a/python/subunit/__init__.py
|
||||||
+++ b/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):
|
def _handleTime(self, offset, line):
|
||||||
# Accept it, but do not do anything with it yet.
|
# Accept it, but do not do anything with it yet.
|
||||||
try:
|
try:
|
||||||
|
|||||||
299
subunit.spec
299
subunit.spec
@ -1,156 +1,71 @@
|
|||||||
%if 0%{?fedora} || 0%{?rhel} >= 8
|
Name: subunit
|
||||||
%bcond_without python3
|
Version: 1.4.0
|
||||||
%else
|
Release: 2
|
||||||
%bcond_with python3
|
Summary: C bindings for subunit
|
||||||
%endif
|
License: ASL 2.0 or BSD
|
||||||
|
URL: https://launchpad.net/subunit
|
||||||
Name: subunit
|
Source0: https://launchpad.net/subunit/trunk/%{version}/+download/%{name}-%{version}.tar.gz
|
||||||
Version: 1.3.0
|
Patch0: %{name}-unbundle-iso8601.patch
|
||||||
Release: 12
|
Patch1: %{name}-decode-binary-to-unicode.patch
|
||||||
Summary: C bindings for subunit
|
Patch2: 0001-port-to-python-iso8601-0.1.14.patch
|
||||||
|
Patch3: Fix-tests-with-testtools-2.5.0.patch
|
||||||
%global majver %(cut -d. -f-2 <<< %{version})
|
BuildRequires: check-devel cppunit-devel gcc-c++ libtool perl-generators make
|
||||||
|
BuildRequires: perl(ExtUtils::MakeMaker) pkgconfig
|
||||||
License: ASL 2.0 or BSD
|
BuildRequires: python3-devel python3-docutils python3-extras python3-fixtures python3-iso8601
|
||||||
URL: https://launchpad.net/%{name}
|
BuildRequires: python3-hypothesis python3-setuptools python3-testscenarios
|
||||||
Source0: https://launchpad.net/%{name}/trunk/%{majver}/+download/%{name}-%{version}.tar.gz
|
BuildRequires: python3-testtools >= 1.8.0
|
||||||
# Fedora-specific patch: remove the bundled copy of python-iso8601.
|
|
||||||
Patch0: %{name}-unbundle-iso8601.patch
|
|
||||||
# Merged upsteam: https://github.com/testing-cabal/subunit/pull/10
|
|
||||||
Patch1: %{name}-decode-binary-to-unicode.patch
|
|
||||||
# Migrate Gtk interface to GObject introspection
|
|
||||||
# Upstream PR: https://github.com/testing-cabal/subunit/pull/34
|
|
||||||
Patch2: 0001-Migrate-Gtk-interface-to-GObject-introspection.patch
|
|
||||||
# Fix python3
|
|
||||||
# Upstream PR: https://github.com/testing-cabal/subunit/pull/36
|
|
||||||
Patch3: 0002-Fix-file-open-for-python3.patch
|
|
||||||
|
|
||||||
|
|
||||||
BuildRequires: check-devel
|
|
||||||
BuildRequires: cppunit-devel
|
|
||||||
BuildRequires: gcc-c++
|
|
||||||
BuildRequires: libtool
|
|
||||||
BuildRequires: perl-generators
|
|
||||||
BuildRequires: perl(ExtUtils::MakeMaker)
|
|
||||||
BuildRequires: pkgconfig
|
|
||||||
BuildRequires: python2-devel
|
|
||||||
BuildRequires: python2-hypothesis
|
|
||||||
BuildRequires: python2-docutils
|
|
||||||
BuildRequires: python2-extras
|
|
||||||
BuildRequires: python2-fixtures
|
|
||||||
BuildRequires: python2-iso8601
|
|
||||||
BuildRequires: python2-setuptools
|
|
||||||
BuildRequires: python2-testscenarios
|
|
||||||
BuildRequires: python2-testtools >= 1.8.0
|
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
BuildRequires: python3-devel
|
|
||||||
BuildRequires: python3-docutils
|
|
||||||
BuildRequires: python3-extras
|
|
||||||
BuildRequires: python3-fixtures
|
|
||||||
BuildRequires: python3-iso8601
|
|
||||||
BuildRequires: python3-hypothesis
|
|
||||||
BuildRequires: python3-setuptools
|
|
||||||
BuildRequires: python3-testscenarios
|
|
||||||
BuildRequires: python3-testtools >= 1.8.0
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Subunit C bindings. See the python-subunit package for test processing
|
Subunit C bindings. See the python-subunit package for test processing
|
||||||
functionality.
|
functionality.
|
||||||
|
|
||||||
%package devel
|
%package devel
|
||||||
Summary: Header files for developing C applications that use subunit
|
Summary: Header files for developing C applications that use subunit
|
||||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||||
|
|
||||||
%description devel
|
%description devel
|
||||||
Header files and libraries for developing C applications that use subunit.
|
Header files and libraries for developing C applications that use subunit.
|
||||||
|
|
||||||
%package cppunit
|
%package cppunit
|
||||||
Summary: Subunit integration into cppunit
|
Summary: Subunit integration into cppunit
|
||||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||||
|
|
||||||
%description cppunit
|
%description cppunit
|
||||||
Subunit integration into cppunit.
|
Subunit integration into cppunit.
|
||||||
|
|
||||||
%package cppunit-devel
|
%package cppunit-devel
|
||||||
Summary: Header files for applications that use cppunit and subunit
|
Summary: Header files for applications that use cppunit and subunit
|
||||||
Requires: %{name}-cppunit%{?_isa} = %{version}-%{release}
|
Requires: %{name}-cppunit%{?_isa} = %{version}-%{release}
|
||||||
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
|
Requires: %{name}-devel%{?_isa} = %{version}-%{release} cppunit-devel%{?_isa}
|
||||||
Requires: cppunit-devel%{?_isa}
|
|
||||||
|
|
||||||
%description cppunit-devel
|
%description cppunit-devel
|
||||||
Header files and libraries for developing applications that use cppunit
|
Header files and libraries for developing applications that use cppunit
|
||||||
and subunit.
|
and subunit.
|
||||||
|
|
||||||
%package perl
|
%package perl
|
||||||
Summary: Perl bindings for subunit
|
Summary: Perl bindings for subunit
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Requires: perl(:MODULE_COMPAT_%{perl_version})
|
Requires: perl(:MODULE_COMPAT_%{perl_version})
|
||||||
|
|
||||||
%description perl
|
%description perl
|
||||||
Subunit perl bindings. See the python-subunit package for test
|
Subunit perl bindings. See the python-subunit package for test
|
||||||
processing functionality.
|
processing functionality.
|
||||||
|
|
||||||
%package shell
|
%package shell
|
||||||
Summary: Shell bindings for subunit
|
Summary: Shell bindings for subunit
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
%description shell
|
%description shell
|
||||||
Subunit shell bindings. See the python-subunit package for test
|
Subunit shell bindings. See the python-subunit package for test
|
||||||
processing functionality.
|
processing functionality.
|
||||||
|
|
||||||
%package -n python2-%{name}
|
|
||||||
Summary: Streaming protocol for test results
|
|
||||||
BuildArch: noarch
|
|
||||||
Requires: python2-extras
|
|
||||||
Requires: python2-iso8601
|
|
||||||
Requires: python2-testtools >= 1.8.0
|
|
||||||
|
|
||||||
%{?python_provide:%python_provide python2-%{name}}
|
|
||||||
|
|
||||||
%description -n python2-%{name}
|
|
||||||
Subunit is a streaming protocol for test results. The protocol is a
|
|
||||||
binary encoding that is easily generated and parsed. By design all the
|
|
||||||
components of the protocol conceptually fit into the xUnit TestCase ->
|
|
||||||
TestResult interaction.
|
|
||||||
|
|
||||||
Subunit comes with command line filters to process a subunit stream and
|
|
||||||
language bindings for python, C, C++ and shell. Bindings are easy to
|
|
||||||
write for other languages.
|
|
||||||
|
|
||||||
A number of useful things can be done easily with subunit:
|
|
||||||
- Test aggregation: Tests run separately can be combined and then
|
|
||||||
reported/displayed together. For instance, tests from different
|
|
||||||
languages can be shown as a seamless whole.
|
|
||||||
- Test archiving: A test run may be recorded and replayed later.
|
|
||||||
- Test isolation: Tests that may crash or otherwise interact badly with
|
|
||||||
each other can be run separately and then aggregated, rather than
|
|
||||||
interfering with each other.
|
|
||||||
- Grid testing: subunit can act as the necessary serialization and
|
|
||||||
deserialization to get test runs on distributed machines to be
|
|
||||||
reported in real time.
|
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
%package -n python3-%{name}
|
%package -n python3-%{name}
|
||||||
Summary: Streaming protocol for test results
|
Summary: Streaming protocol for test results
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Requires: python3-extras
|
Requires: python3-extras python3-iso8601 python3-testtools >= 1.8.0
|
||||||
Requires: python3-iso8601
|
|
||||||
Requires: python3-testtools >= 1.8.0
|
|
||||||
|
|
||||||
%{?python_provide:%python_provide python3-%{name}}
|
%{?python_provide:%python_provide python3-%{name}}
|
||||||
|
|
||||||
%description -n python3-%{name}
|
%description -n python3-%{name}
|
||||||
Subunit is a streaming protocol for test results. The protocol is a
|
Subunit is a streaming protocol for test results. The protocol is a
|
||||||
binary encoding that is easily generated and parsed. By design all the
|
binary encoding that is easily generated and parsed. By design all the
|
||||||
components of the protocol conceptually fit into the xUnit TestCase ->
|
components of the protocol conceptually fit into the xUnit TestCase ->
|
||||||
TestResult interaction.
|
TestResult interaction.
|
||||||
|
|
||||||
Subunit comes with command line filters to process a subunit stream and
|
Subunit comes with command line filters to process a subunit stream and
|
||||||
language bindings for python, C, C++ and shell. Bindings are easy to
|
language bindings for python, C, C++ and shell. Bindings are easy to
|
||||||
write for other languages.
|
write for other languages.
|
||||||
|
|
||||||
A number of useful things can be done easily with subunit:
|
A number of useful things can be done easily with subunit:
|
||||||
- Test aggregation: Tests run separately can be combined and then
|
- Test aggregation: Tests run separately can be combined and then
|
||||||
reported/displayed together. For instance, tests from different
|
reported/displayed together. For instance, tests from different
|
||||||
@ -164,94 +79,50 @@ A number of useful things can be done easily with subunit:
|
|||||||
reported in real time.
|
reported in real time.
|
||||||
|
|
||||||
%package -n python3-%{name}-test
|
%package -n python3-%{name}-test
|
||||||
Summary: Test code for the python 3 subunit bindings
|
Summary: Test code for the python 3 subunit bindings
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
Requires: python3-%{name} = %{version}-%{release}
|
Requires: python3-%{name} = %{version}-%{release} %{name}-filters = %{version}-%{release}
|
||||||
Requires: %{name}-filters = %{version}-%{release}
|
|
||||||
|
|
||||||
%{?python_provide:%python_provide python3-%{name}-test}
|
%{?python_provide:%python_provide python3-%{name}-test}
|
||||||
|
Obsoletes: python3-%{name}-test < 1.3.0-9
|
||||||
# This can be removed when F29 reaches EOL
|
Provides: python3-%{name}-test = %{version}-%{release}
|
||||||
Obsoletes: python2-%{name}-test < 1.3.0-9
|
|
||||||
Provides: python2-%{name}-test = %{version}-%{release}
|
|
||||||
|
|
||||||
%description -n python3-%{name}-test
|
%description -n python3-%{name}-test
|
||||||
%{summary}.
|
%{summary}.
|
||||||
%endif
|
|
||||||
|
|
||||||
%package filters
|
%package filters
|
||||||
Summary: Command line filters for processing subunit streams
|
Summary: Command line filters for processing subunit streams
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if %{with python3}
|
Requires: python3-%{name} = %{version}-%{release} python3-gobject gtk3 >= 3.20
|
||||||
Requires: python3-%{name} = %{version}-%{release}
|
Requires: libnotify >= 0.7.7 python3-junitxml
|
||||||
Requires: python3-gobject
|
|
||||||
Requires: gtk3 >= 3.20
|
|
||||||
Requires: libnotify >= 0.7.7
|
|
||||||
Requires: python3-junitxml
|
|
||||||
%else
|
|
||||||
Requires: python2-%{name} = %{version}-%{release}
|
|
||||||
Requires: pygtk2
|
|
||||||
Requires: python2-junitxml
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%description filters
|
%description filters
|
||||||
Command line filters for processing subunit streams.
|
Command line filters for processing subunit streams.
|
||||||
|
|
||||||
%package static
|
%package static
|
||||||
Summary: Static C library for subunit
|
Summary: Static C library for subunit
|
||||||
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
|
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
|
||||||
|
|
||||||
%description static
|
%description static
|
||||||
Subunit C bindings in a static library, for building statically linked
|
Subunit C bindings in a static library, for building statically linked
|
||||||
test cases.
|
test cases.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -qc
|
%autosetup -n %{name}-%{version} -S git
|
||||||
%patch0
|
|
||||||
%patch1 -p1
|
|
||||||
%patch2 -p1
|
|
||||||
%patch3 -p1
|
|
||||||
|
|
||||||
fixtimestamp() {
|
fixtimestamp() {
|
||||||
touch -r $1.orig $1
|
touch -r $1.orig $1
|
||||||
rm $1.orig
|
rm $1.orig
|
||||||
}
|
}
|
||||||
|
|
||||||
# Help the dependency generator
|
|
||||||
for filt in filters/*; do
|
for filt in filters/*; do
|
||||||
sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new
|
sed 's,/usr/bin/env ,/usr/bin/,' $filt > ${filt}.new
|
||||||
%if %{with python3}
|
|
||||||
# Fix filters to use python3
|
|
||||||
sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new
|
sed -i 's,\(%{_bindir}/python\),\13,' ${filt}.new
|
||||||
%endif
|
|
||||||
chmod 0755 ${filt}.new
|
chmod 0755 ${filt}.new
|
||||||
touch -r $filt ${filt}.new
|
touch -r $filt ${filt}.new
|
||||||
mv -f ${filt}.new $filt
|
mv -f ${filt}.new $filt
|
||||||
done
|
done
|
||||||
|
|
||||||
# Fix underlinked library
|
|
||||||
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
|
sed "/^tests_LDADD/ilibcppunit_subunit_la_LIBADD = -lcppunit libsubunit.la\n" \
|
||||||
-i Makefile.am
|
-i Makefile.am
|
||||||
|
|
||||||
# Depend on python2, not just python
|
|
||||||
sed -i.orig 's,%{_bindir}/python,&2,' python/subunit/run.py
|
|
||||||
fixtimestamp python/subunit/run.py
|
|
||||||
|
|
||||||
# Do not use env
|
|
||||||
for fil in $(grep -Frl "%{_bindir}/env python"); do
|
for fil in $(grep -Frl "%{_bindir}/env python"); do
|
||||||
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
|
sed -i.orig 's,%{_bindir}/env python,%{_bindir}/python2,' $fil
|
||||||
fixtimestamp $fil
|
fixtimestamp $fil
|
||||||
done
|
done
|
||||||
|
|
||||||
# Replace bundled code with a symlink
|
|
||||||
ln -f -s %{python2_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
|
|
||||||
|
|
||||||
# Generate the configure script
|
|
||||||
autoreconf -fi
|
autoreconf -fi
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
# Prepare to build for python 3
|
|
||||||
cp -a ../%{name}-%{version} ../python3
|
cp -a ../%{name}-%{version} ../python3
|
||||||
mv ../python3 .
|
mv ../python3 .
|
||||||
pushd python3
|
pushd python3
|
||||||
@ -261,58 +132,35 @@ for fil in $(grep -Frl "%{_bindir}/python2"); do
|
|||||||
done
|
done
|
||||||
ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
|
ln -f -s %{python3_sitelib}/iso8601/iso8601.py python/subunit/iso8601.py
|
||||||
popd
|
popd
|
||||||
%endif
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
# Build for everything except python3
|
|
||||||
export INSTALLDIRS=perl
|
export INSTALLDIRS=perl
|
||||||
%configure --enable-shared --enable-static
|
%configure --enable-shared --enable-static
|
||||||
|
|
||||||
# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
|
|
||||||
# -Wl,--as-needed after all the libraries.
|
|
||||||
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
|
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
|
||||||
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
|
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
|
||||||
-e 's|CC=.g..|& -Wl,--as-needed|' \
|
-e 's|CC=.g..|& -Wl,--as-needed|' \
|
||||||
-i libtool
|
-i libtool
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
%py2_build
|
|
||||||
|
|
||||||
# Build for python3
|
|
||||||
%if %{with python3}
|
|
||||||
pushd python3
|
pushd python3
|
||||||
export INSTALLDIRS=perl
|
export INSTALLDIRS=perl
|
||||||
export PYTHON=%{_bindir}/python3
|
export PYTHON=%{_bindir}/python3
|
||||||
%configure --enable-shared --enable-static
|
%configure --enable-shared --enable-static
|
||||||
|
|
||||||
# Get rid of undesirable hardcoded rpaths; workaround libtool reordering
|
|
||||||
# -Wl,--as-needed after all the libraries.
|
|
||||||
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
|
sed -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
|
||||||
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
|
-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' \
|
||||||
-e 's|CC=.g..|& -Wl,--as-needed|' \
|
-e 's|CC=.g..|& -Wl,--as-needed|' \
|
||||||
-i libtool
|
-i libtool
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
%py3_build
|
%py3_build
|
||||||
popd
|
popd
|
||||||
%endif
|
|
||||||
|
|
||||||
%install
|
%install
|
||||||
# Install for python 2 first so that the python 3 install overwrites files
|
|
||||||
%py2_install
|
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
pushd python3
|
pushd python3
|
||||||
%py3_install
|
%py3_install
|
||||||
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
|
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/run.py
|
||||||
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
|
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
|
||||||
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
|
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
|
||||||
|
|
||||||
# Patch the test code to look for filters in _bindir
|
|
||||||
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
|
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
|
||||||
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
|
%{buildroot}%{python3_sitelib}/%{name}/tests/test_subunit_filter.py
|
||||||
|
|
||||||
# Replace bundled code with a symlink again
|
|
||||||
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
|
ln -f -s %{python3_sitelib}/iso8601/iso8601.py \
|
||||||
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
|
%{buildroot}%{python3_sitelib}/subunit/iso8601.py
|
||||||
for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
|
for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
|
||||||
@ -320,40 +168,16 @@ for fil in iso8601.cpython-37.opt-1.pyc iso8601.cpython-37.pyc; do
|
|||||||
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil
|
%{buildroot}%{python3_sitelib}/subunit/__pycache__/$fil
|
||||||
done
|
done
|
||||||
popd
|
popd
|
||||||
%endif
|
%make_install INSTALL="%{_bindir}/install -p"
|
||||||
|
|
||||||
# Patch the test code to look for filters in _bindir
|
|
||||||
sed -i "s|root, 'filters'|'/usr', 'bin'|" \
|
|
||||||
%{buildroot}%{python2_sitelib}/%{name}/tests/test_subunit_filter.py
|
|
||||||
|
|
||||||
# We set pkgpython_PYTHON for efficiency to disable automake python compilation
|
|
||||||
%make_install pkgpython_PYTHON='' INSTALL="%{_bindir}/install -p"
|
|
||||||
|
|
||||||
# Replace bundled code with a symlink again
|
|
||||||
for fil in iso8601.py iso8601.pyc iso8601.pyo; do
|
|
||||||
ln -f -s %{python2_sitelib}/iso8601/$fil \
|
|
||||||
%{buildroot}%{python2_sitelib}/subunit/$fil
|
|
||||||
done
|
|
||||||
|
|
||||||
# Install the shell interface
|
|
||||||
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
|
mkdir -p %{buildroot}%{_sysconfdir}/profile.d
|
||||||
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
|
cp -p shell/share/%{name}.sh %{buildroot}%{_sysconfdir}/profile.d
|
||||||
|
|
||||||
# Remove unwanted libtool files
|
|
||||||
rm -f %{buildroot}%{_libdir}/*.la
|
rm -f %{buildroot}%{_libdir}/*.la
|
||||||
|
|
||||||
# Fix perl installation
|
|
||||||
mkdir -p %{buildroot}%{perl_vendorlib}
|
mkdir -p %{buildroot}%{perl_vendorlib}
|
||||||
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
|
mv %{buildroot}%{perl_privlib}/Subunit* %{buildroot}%{perl_vendorlib}
|
||||||
rm -fr %{buildroot}%{perl_archlib}
|
rm -fr %{buildroot}%{perl_archlib}
|
||||||
|
|
||||||
# Fix permissions
|
|
||||||
chmod 0755 %{buildroot}%{python2_sitelib}/%{name}/run.py
|
|
||||||
chmod 0755 %{buildroot}%{_bindir}/subunit-diff
|
chmod 0755 %{buildroot}%{_bindir}/subunit-diff
|
||||||
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
|
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-script.py
|
||||||
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
|
chmod 0755 %{buildroot}%{python3_sitelib}/%{name}/tests/sample-two-script.py
|
||||||
|
|
||||||
# Fix timestamps
|
|
||||||
touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h
|
touch -r c/include/%{name}/child.h %{buildroot}%{_includedir}/%{name}/child.h
|
||||||
touch -r c++/SubunitTestProgressListener.h \
|
touch -r c++/SubunitTestProgressListener.h \
|
||||||
%{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h
|
%{buildroot}%{_includedir}/%{name}/SubunitTestProgressListener.h
|
||||||
@ -363,23 +187,11 @@ for fil in filters/*; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
%check
|
%check
|
||||||
# Run the tests for python2
|
|
||||||
export LD_LIBRARY_PATH=$PWD/.libs
|
|
||||||
export PYTHONPATH=$PWD/python/subunit:$PWD/python/subunit/tests
|
|
||||||
make check
|
|
||||||
# Make sure subunit.iso8601 is importable from buildroot
|
|
||||||
PYTHONPATH=%{buildroot}%{python2_sitelib} %{__python2} -c "import subunit.iso8601"
|
|
||||||
|
|
||||||
%if %{with python3} && 0%{?!disable_tests}
|
|
||||||
# Run the tests for python3
|
|
||||||
pushd python3
|
pushd python3
|
||||||
export PYTHON=%{__python3}
|
export PYTHON=%{__python3}
|
||||||
make check
|
make check
|
||||||
# Make sure subunit.iso8601 is importable from buildroot
|
|
||||||
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
|
PYTHONPATH=%{buildroot}%{python3_sitelib} %{__python3} -c "import subunit.iso8601"
|
||||||
popd
|
popd
|
||||||
%endif
|
|
||||||
|
|
||||||
%ldconfig_scriptlets
|
%ldconfig_scriptlets
|
||||||
%ldconfig_scriptlets cppunit
|
%ldconfig_scriptlets cppunit
|
||||||
|
|
||||||
@ -414,13 +226,6 @@ popd
|
|||||||
%license Apache-2.0 BSD COPYING
|
%license Apache-2.0 BSD COPYING
|
||||||
%config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh
|
%config(noreplace) %{_sysconfdir}/profile.d/%{name}.sh
|
||||||
|
|
||||||
%files -n python2-%{name}
|
|
||||||
%license Apache-2.0 BSD COPYING
|
|
||||||
%{python2_sitelib}/%{name}/
|
|
||||||
%{python2_sitelib}/python_%{name}-%{version}-*.egg-info
|
|
||||||
%exclude %{python2_sitelib}/%{name}/tests/
|
|
||||||
|
|
||||||
%if %{with python3}
|
|
||||||
%files -n python3-%{name}
|
%files -n python3-%{name}
|
||||||
%license Apache-2.0 BSD COPYING
|
%license Apache-2.0 BSD COPYING
|
||||||
%{python3_sitelib}/%{name}/
|
%{python3_sitelib}/%{name}/
|
||||||
@ -429,7 +234,6 @@ popd
|
|||||||
|
|
||||||
%files -n python3-%{name}-test
|
%files -n python3-%{name}-test
|
||||||
%{python3_sitelib}/%{name}/tests/
|
%{python3_sitelib}/%{name}/tests/
|
||||||
%endif
|
|
||||||
|
|
||||||
%files static
|
%files static
|
||||||
%{_libdir}/*.a
|
%{_libdir}/*.a
|
||||||
@ -439,6 +243,21 @@ popd
|
|||||||
%exclude %{_bindir}/%{name}-diff
|
%exclude %{_bindir}/%{name}-diff
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 07 2022 yaoxin <yaoxin30@h-partners.com> - 1.4.0-2
|
||||||
|
- Resolve the compilation fails, due to python-testtools update to 2.5.0
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
* Wed Feb 03 2021 maminjie <maminjie1@huawei.com> - 1.3.0-14
|
||||||
|
- Port to python-iso8601 0.1.12
|
||||||
|
|
||||||
|
* Tue Aug 11 2020 yanan li <liyanan032@huawei.com> - 1.3.0-13
|
||||||
|
- Remove python2-subunit subpackage
|
||||||
|
|
||||||
* Wed Jun 24 2020 sunguoshuai <sunguoshuai@huawei.com> - 1.3.0-12
|
* Wed Jun 24 2020 sunguoshuai <sunguoshuai@huawei.com> - 1.3.0-12
|
||||||
- Update to 1.3.0-12
|
- Update to 1.3.0-12
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user