diff --git a/python-treq.changes b/python-treq.changes index e522ed0..69beb01 100644 --- a/python-treq.changes +++ b/python-treq.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Mar 7 11:33:03 UTC 2019 - Tomáš Chvátal + +- Add patch to fix testrun on python3.7: + * python37.patch +- Fix macro expansion to run the tests under python3 + ------------------------------------------------------------------- Mon Oct 22 07:25:25 UTC 2018 - Tomáš Chvátal diff --git a/python-treq.spec b/python-treq.spec index 023bff9..21b67b1 100644 --- a/python-treq.spec +++ b/python-treq.spec @@ -1,7 +1,7 @@ # # spec file for package python-treq # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,6 +25,7 @@ License: MIT Group: Development/Languages/Python URL: https://github.com/twisted/treq Source: https://files.pythonhosted.org/packages/source/t/treq/treq-%{version}.tar.gz +Patch0: python37.patch BuildRequires: %{python_module Twisted >= 16.4.0} BuildRequires: %{python_module attrs} BuildRequires: %{python_module httpbin} @@ -49,6 +50,7 @@ It provides a simple, higher level API for making HTTP requests when using Twist %prep %setup -q -n treq-%{version} +%patch0 -p1 %build %python_build @@ -59,7 +61,7 @@ It provides a simple, higher level API for making HTTP requests when using Twist %check export PYTHONDONTWRITEBYTECODE=1 -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} %{_bindir}/trial-%{python_bin_suffix} treq +%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} %{_bindir}/trial-%{$python_bin_suffix} treq %files %{python_files} %license LICENSE diff --git a/python37.patch b/python37.patch new file mode 100644 index 0000000..703a315 --- /dev/null +++ b/python37.patch @@ -0,0 +1,44 @@ +From d7e141113d00541c9183b243d0a2f66ded2f0536 Mon Sep 17 00:00:00 2001 +From: Chih-Hsuan Yen +Date: Wed, 25 Jul 2018 20:53:50 +0800 +Subject: [PATCH] Add Python 3.7 support and enable testing + +--- + src/treq/test/test_multipart.py | 17 ++++++++++++++--- + 4 files changed, 36 insertions(+), 5 deletions(-) + +diff --git a/src/treq/test/test_multipart.py b/src/treq/test/test_multipart.py +index 4aece22..e0d81a2 100644 +--- a/src/treq/test/test_multipart.py ++++ b/src/treq/test/test_multipart.py +@@ -3,6 +3,7 @@ + # See LICENSE for details. + + import cgi ++import sys + + from io import BytesIO + +@@ -594,9 +595,19 @@ def test_worksWithCgi(self): + ) + ) + +- form = cgi.parse_multipart(BytesIO(output), {"boundary": b"heyDavid"}) +- self.assertEqual(set([b'just a string\r\n', b'another string']), +- set(form['cfield'])) ++ form = cgi.parse_multipart(BytesIO(output), { ++ "boundary": b"heyDavid", ++ "CONTENT-LENGTH": str(len(output)), ++ }) ++ ++ # Since Python 3.7, the value for a non-file field is now a list ++ # of strings, not bytes. ++ if sys.version_info >= (3, 7): ++ self.assertEqual(set(['just a string\r\n', 'another string']), ++ set(form['cfield'])) ++ else: ++ self.assertEqual(set([b'just a string\r\n', b'another string']), ++ set(form['cfield'])) + + self.assertEqual(set([b'my lovely bytes2']), set(form['efield'])) + self.assertEqual(set([b'my lovely bytes219']), set(form['xfield']))