From 89fe6aa84fc95f071c48ab78270dea6d8d9036a7 Mon Sep 17 00:00:00 2001 From: John Eckersberg Date: Tue, 30 Jun 2015 11:39:55 -0400 Subject: [PATCH] Add patch for broken assertion --- python-netaddr-fix-assertion-in-test.patch | 35 ++++++++++++++++++++++ python-netaddr.spec | 6 ++++ 2 files changed, 41 insertions(+) create mode 100644 python-netaddr-fix-assertion-in-test.patch diff --git a/python-netaddr-fix-assertion-in-test.patch b/python-netaddr-fix-assertion-in-test.patch new file mode 100644 index 0000000..f0912c6 --- /dev/null +++ b/python-netaddr-fix-assertion-in-test.patch @@ -0,0 +1,35 @@ +From 4b1f09a7e122f6b7af699242b58b5284c5eeab00 Mon Sep 17 00:00:00 2001 +From: John Eckersberg +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 + + diff --git a/python-netaddr.spec b/python-netaddr.spec index 5f5f3dd..ca3335a 100644 --- a/python-netaddr.spec +++ b/python-netaddr.spec @@ -12,6 +12,9 @@ URL: http://github.com/drkjam/netaddr Source0: https://pypi.python.org/packages/source/n/netaddr/netaddr-%{version}.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 BuildRequires: python2-devel BuildRequires: python-setuptools @@ -84,6 +87,8 @@ API documentation for the latest release is available here :- %prep %setup -q -a 1 -n netaddr-%{version} +%patch0 -p1 + # Make rpmlint happy, get rid of DOS line endings %{__sed} -i 's/\r//' netaddr/*.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 - 0.7.15-1 - New upstream release 0.7.15 - 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 - 0.7.14-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild