Add patch for broken assertion

This commit is contained in:
John Eckersberg 2015-06-30 11:39:55 -04:00
parent 551bb8e06e
commit 89fe6aa84f
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,35 @@
From 4b1f09a7e122f6b7af699242b58b5284c5eeab00 Mon Sep 17 00:00:00 2001
From: John Eckersberg <jeckersb@redhat.com>
Date: Tue, 30 Jun 2015 11:03:57 -0400
Subject: [PATCH] Fix bad pop() assumption in test
Do not assume that IPSet.pop will always return the same item. The
pop method is implemented via the popitem method on the underlying
_cidrs object, which is a dict.
dict.popitem is documented as:
Remove and return an arbitrary (key, value) pair from the dictionary.
So one cannot assert that the value popped from an IPSet will be a
specific item in the set.
Instead, assert that the item popped out of the set is present in the
other set.
---
test/ip/test_ip_sets.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/ip/test_ip_sets.py b/test/ip/test_ip_sets.py
index 3732a11..32589e1 100644
--- a/test/ip/test_ip_sets.py
+++ b/test/ip/test_ip_sets.py
@@ -34,7 +34,7 @@ def test_ipset_basic_api():
])
assert set1 == set2
- assert set2.pop() == IPNetwork('192.0.2.4/30')
+ assert set2.pop() in set1
assert set1 != set2

View File

@ -12,6 +12,9 @@ URL: http://github.com/drkjam/netaddr
Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz
Source1: netaddr-%{version}-tests.tar.gz Source1: netaddr-%{version}-tests.tar.gz
# https://github.com/drkjam/netaddr/pull/103
Patch0: python-netaddr-fix-assertion-in-test.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel BuildRequires: python2-devel
BuildRequires: python-setuptools BuildRequires: python-setuptools
@ -84,6 +87,8 @@ API documentation for the latest release is available here :-
%prep %prep
%setup -q -a 1 -n netaddr-%{version} %setup -q -a 1 -n netaddr-%{version}
%patch0 -p1
# Make rpmlint happy, get rid of DOS line endings # Make rpmlint happy, get rid of DOS line endings
%{__sed} -i 's/\r//' netaddr/*.py %{__sed} -i 's/\r//' netaddr/*.py
%{__sed} -i 's/\r//' netaddr/ip/*.py %{__sed} -i 's/\r//' netaddr/ip/*.py
@ -155,6 +160,7 @@ LANG=en_US.UTF-8 %{__python3} setup.py test
* Mon Jun 29 2015 John Eckersberg <eck@redhat.com> - 0.7.15-1 * Mon Jun 29 2015 John Eckersberg <eck@redhat.com> - 0.7.15-1
- New upstream release 0.7.15 - New upstream release 0.7.15
- Add separate source for tests, see https://github.com/drkjam/netaddr/issues/102 - Add separate source for tests, see https://github.com/drkjam/netaddr/issues/102
- Add patch for broken assertion, see https://github.com/drkjam/netaddr/pull/103
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.14-2 * Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.7.14-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild