14
0
forked from pool/python-treq

- Add patch to fix testrun on python3.7:

* python37.patch
- Fix macro expansion to run the tests under python3

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-treq?expand=0&rev=9
This commit is contained in:
Tomáš Chvátal
2019-03-07 11:34:48 +00:00
committed by Git OBS Bridge
parent 28a862e9f5
commit 53dbed7863
3 changed files with 55 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Mar 7 11:33:03 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- 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 <tchvatal@suse.com> Mon Oct 22 07:25:25 UTC 2018 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -1,7 +1,7 @@
# #
# spec file for package python-treq # 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 # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -25,6 +25,7 @@ License: MIT
Group: Development/Languages/Python Group: Development/Languages/Python
URL: https://github.com/twisted/treq URL: https://github.com/twisted/treq
Source: https://files.pythonhosted.org/packages/source/t/treq/treq-%{version}.tar.gz 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 Twisted >= 16.4.0}
BuildRequires: %{python_module attrs} BuildRequires: %{python_module attrs}
BuildRequires: %{python_module httpbin} BuildRequires: %{python_module httpbin}
@@ -49,6 +50,7 @@ It provides a simple, higher level API for making HTTP requests when using Twist
%prep %prep
%setup -q -n treq-%{version} %setup -q -n treq-%{version}
%patch0 -p1
%build %build
%python_build %python_build
@@ -59,7 +61,7 @@ It provides a simple, higher level API for making HTTP requests when using Twist
%check %check
export PYTHONDONTWRITEBYTECODE=1 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} %files %{python_files}
%license LICENSE %license LICENSE

44
python37.patch Normal file
View File

@@ -0,0 +1,44 @@
From d7e141113d00541c9183b243d0a2f66ded2f0536 Mon Sep 17 00:00:00 2001
From: Chih-Hsuan Yen <yan12125@gmail.com>
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']))