Browse code

Fixed check command and added patch to fix test issues in python-netaddr package

Change-Id: I3fd69a1d8a07368f542355cd5cea7ee5825ce558
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3335
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Xiaolin Li <xiaolinl@vmware.com>

dthaluru authored on 2017/07/26 05:57:05
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,53 @@
0
+From 2ab73f10be7069c9412e853d2d0caf29bd624012 Mon Sep 17 00:00:00 2001
1
+From: David Moss <drkjam@gmail.com>
2
+Date: Mon, 16 Jan 2017 22:17:16 +0000
3
+Subject: [PATCH] - fixed broken tests in issue #149 (python 3 regression in
4
+ 0.7.19) - only affects test suite
5
+
6
+---
7
+ netaddr/tests/eui/test_ieee_parsers.py | 8 ++++----
8
+ 1 file changed, 4 insertions(+), 4 deletions(-)
9
+
10
+diff --git a/netaddr/tests/eui/test_ieee_parsers.py b/netaddr/tests/eui/test_ieee_parsers.py
11
+index 7877f09..81f1faa 100644
12
+--- a/netaddr/tests/eui/test_ieee_parsers.py
13
+@@ -12,7 +12,7 @@ SAMPLE_DIR = os.path.dirname(__file__)
14
+ def test_oui_parser_py2():
15
+     from cStringIO import StringIO
16
+     outfile = StringIO()
17
+-    with open(os.path.join(SAMPLE_DIR, 'sample_oui.txt')) as infile:
18
++    with open(os.path.join(SAMPLE_DIR, 'sample_oui.txt'), 'rb') as infile:
19
+         iab_parser = OUIIndexParser(infile)
20
+         iab_parser.attach(FileIndexer(outfile))
21
+         iab_parser.parse()
22
+@@ -23,7 +23,7 @@ def test_oui_parser_py2():
23
+ def test_iab_parser_py2():
24
+     from cStringIO import StringIO
25
+     outfile = StringIO()
26
+-    with open(os.path.join(SAMPLE_DIR, 'sample_iab.txt')) as infile:
27
++    with open(os.path.join(SAMPLE_DIR, 'sample_iab.txt'), 'rb') as infile:
28
+         iab_parser = IABIndexParser(infile)
29
+         iab_parser.attach(FileIndexer(outfile))
30
+         iab_parser.parse()
31
+@@ -34,7 +34,7 @@ def test_iab_parser_py2():
32
+ def test_oui_parser_py3():
33
+     from io import StringIO
34
+     outfile = StringIO()
35
+-    with open(os.path.join(SAMPLE_DIR, 'sample_oui.txt')) as infile:
36
++    with open(os.path.join(SAMPLE_DIR, 'sample_oui.txt'), 'rb') as infile:
37
+         iab_parser = OUIIndexParser(infile)
38
+         iab_parser.attach(FileIndexer(outfile))
39
+         iab_parser.parse()
40
+@@ -45,7 +45,7 @@ def test_oui_parser_py3():
41
+ def test_iab_parser_py3():
42
+     from io import StringIO
43
+     outfile = StringIO()
44
+-    with open(os.path.join(SAMPLE_DIR, 'sample_iab.txt')) as infile:
45
++    with open(os.path.join(SAMPLE_DIR, 'sample_iab.txt'), 'rb') as infile:
46
+         iab_parser = IABIndexParser(infile)
47
+         iab_parser.attach(FileIndexer(outfile))
48
+         iab_parser.parse()
49
+-- 
50
+2.9.3
51
+
... ...
@@ -3,17 +3,21 @@
3 3
 
4 4
 Name:           python-netaddr
5 5
 Version:        0.7.19
6
-Release:        4%{?dist}
6
+Release:        5%{?dist}
7 7
 Summary:        A network address manipulation library for Python
8 8
 License:        BSD
9 9
 Group:          Development/Languages/Python
10 10
 Url:            https://files.pythonhosted.org/packages/source/n/netaddr/netaddr-%{version}.tar.gz
11 11
 Source0:        netaddr-%{version}.tar.gz
12 12
 %define sha1    netaddr=00e0ce7d7ebc1d6e7943e884aa51ccb7becdc9ea
13
+Patch0:         0001-fixed-broken-tests-in-issue-149-python-3-regression.patch
13 14
 
14 15
 BuildRequires:  python2
15 16
 BuildRequires:  python2-libs
16 17
 BuildRequires:  python-setuptools
18
+%if %{with_check}
19
+BuildRequires:  python-pytest
20
+%endif
17 21
 
18 22
 Requires:       python2
19 23
 Requires:       python2-libs
... ...
@@ -29,11 +33,15 @@ BuildRequires:  python3-devel
29 29
 BuildRequires:  python3-libs
30 30
 BuildRequires:  python3-setuptools
31 31
 BuildRequires:  python3-xml
32
+%if %{with_check}
33
+BuildRequires:  python3-pytest
34
+%endif
32 35
 %description -n python3-netaddr
33 36
 Python 3 version.
34 37
 
35 38
 %prep
36 39
 %setup -n netaddr-%{version}
40
+%patch0 -p1
37 41
 rm -rf ../p3dir
38 42
 cp -a . ../p3dir
39 43
 
... ...
@@ -51,10 +59,9 @@ popd
51 51
 python2 setup.py install --prefix=%{_prefix} --root=%{buildroot}
52 52
 
53 53
 %check
54
-easy_install py
55
-python2 test_netadr.py
54
+PYTHONPATH=./ py.test2
56 55
 pushd ../p3dir
57
-python3 test_netadr.py
56
+LANG=en_US.UTF-8 PYTHONPATH=./ py.test3
58 57
 popd
59 58
 
60 59
 %files
... ...
@@ -68,6 +75,8 @@ popd
68 68
 %{python3_sitelib}/*
69 69
 
70 70
 %changelog
71
+*   Tue Jul 25 2017 Divya Thaluru <dthaluru@vmware.com> 0.7.19-5
72
+-   Fixed test command and added patch to fix test issues.
71 73
 *   Wed Jun 07 2017 Xiaolin Li <xiaolinl@vmware.com> 0.7.19-4
72 74
 -   Add python3-setuptools and python3-xml to python3 sub package Buildrequires.
73 75
 *   Thu Jun 01 2017 Dheeraj Shetty <dheerajs@vmware.com> 0.7.19-3