Fix GBytes test (gnome#690837)

This commit is contained in:
Dan Horák 2012-12-28 22:43:08 +01:00
parent 3014733a5e
commit 4382f556f5
2 changed files with 43 additions and 1 deletions

View File

@ -0,0 +1,34 @@
From 05711e815f5dbb840f10c9f42defb748116617c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
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

View File

@ -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 <dan[at]danny.cz> - 3.7.3-2
- Fix GBytes test (gnome#690837)
* Thu Dec 20 2012 Kalev Lember <kalevlember@gmail.com> - 3.7.3-1
- Update to 3.7.3
- Drop upstreamed patches; rebase the ignore-more-pep8-errors patch