From 4382f556f556d6ea92d8035715c89bee7da0abbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Fri, 28 Dec 2012 22:43:08 +0100 Subject: [PATCH] Fix GBytes test (gnome#690837) --- pygobject-3.7.3-test-gbytes-compare.patch | 34 +++++++++++++++++++++++ pygobject3.spec | 10 ++++++- 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 pygobject-3.7.3-test-gbytes-compare.patch diff --git a/pygobject-3.7.3-test-gbytes-compare.patch b/pygobject-3.7.3-test-gbytes-compare.patch new file mode 100644 index 0000000..afe93ea --- /dev/null +++ b/pygobject-3.7.3-test-gbytes-compare.patch @@ -0,0 +1,34 @@ +From 05711e815f5dbb840f10c9f42defb748116617c0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Dan=20Hor=C3=A1k?= +Date: Fri, 28 Dec 2012 22:12:32 +0100 +Subject: [PATCH] test for GBytes.compare must match definition + +The result of the compare method is defined as equal, less than or greater than zero +and the test must match to that. The underlaying memcmp() function can return other +values than -1, 0 and 1. For example on architectures where it is implemented directly +via a CPU instruction like on s390(x) where I can see -2 as a result instead of the +"expected" -1. +--- + tests/test_gi.py | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tests/test_gi.py b/tests/test_gi.py +index bb90b8a..8cb3496 100644 +--- a/tests/test_gi.py ++++ b/tests/test_gi.py +@@ -1053,9 +1053,9 @@ class TestGBytes(unittest.TestCase): + self.assertFalse(a1.equal(b)) + self.assertFalse(b.equal(a2)) + +- self.assertEqual(0, a1.compare(a2)) +- self.assertEqual(1, a1.compare(b)) +- self.assertEqual(-1, b.compare(a1)) ++ self.assertTrue(a1.compare(a2) == 0) ++ self.assertTrue(a1.compare(b) > 0) ++ self.assertTrue(b.compare(a1) < 0) + + + class TestGByteArray(unittest.TestCase): +-- +1.7.7.6 + diff --git a/pygobject3.spec b/pygobject3.spec index 0c66e45..304900f 100644 --- a/pygobject3.spec +++ b/pygobject3.spec @@ -22,7 +22,7 @@ Name: pygobject3 Version: 3.7.3 -Release: 1%{?dist} +Release: 2%{?dist} License: LGPLv2+ and MIT Group: Development/Languages Summary: Python 2 bindings for GObject Introspection @@ -69,6 +69,10 @@ Patch2: pygobject-3.3.4-known-failures.patch # Not yet sent upstream: Patch3: test-list-marshalling.patch +# Fix GBytes.compare test +# https://bugzilla.gnome.org/show_bug.cgi?id=690837 +Patch4: pygobject-3.7.3-test-gbytes-compare.patch + ### Build Dependencies ### BuildRequires: chrpath @@ -150,6 +154,7 @@ for use in Python 3 programs. %patch1 -p1 -b .ignore-more-pep8-errors %patch2 -p1 -b .known-failures %patch3 -p1 -b .test-list-marshalling +%patch4 -p1 -b .test-gbytes-compare %if 0%{?with_python3} rm -rf %{py3dir} @@ -263,6 +268,9 @@ xvfb-run make DESTDIR=$RPM_BUILD_ROOT check %{verbosity} %endif # with_python3 %changelog +* Fri Dec 28 2012 Dan HorĂ¡k - 3.7.3-2 +- Fix GBytes test (gnome#690837) + * Thu Dec 20 2012 Kalev Lember - 3.7.3-1 - Update to 3.7.3 - Drop upstreamed patches; rebase the ignore-more-pep8-errors patch