From 5e33426d9301b22fe1bf78b47525475f0f288796 Mon Sep 17 00:00:00 2001 From: hht8 Date: Wed, 18 Aug 2021 15:17:42 +0800 Subject: [PATCH] Fix testsuite for werkzeug 1.x --- 0001-Fix-arguments-with-type-list-705.patch | 8 ++-- 0002-Support-aniso8601-3.0-in-tests.patch | 4 +- 0003-Fix-tests_api-list-traceback.patch | 4 +- Fix-testsuite-for-werkzeug-1.x.patch | 41 +++++++++++++++++++ python-flask-restful.remove_q0_testcase.patch | 4 +- python-flask-restful.spec | 8 +++- 6 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 Fix-testsuite-for-werkzeug-1.x.patch diff --git a/0001-Fix-arguments-with-type-list-705.patch b/0001-Fix-arguments-with-type-list-705.patch index 5f39816..91a4d2b 100644 --- a/0001-Fix-arguments-with-type-list-705.patch +++ b/0001-Fix-arguments-with-type-list-705.patch @@ -11,8 +11,8 @@ Closes #681 diff --git a/flask_restful/reqparse.py b/flask_restful/reqparse.py index 8fe142e..527bc94 100644 ---- flask_restful/reqparse.py -+++ flask_restful/reqparse.py +--- a/flask_restful/reqparse.py ++++ b/flask_restful/reqparse.py @@ -176,7 +176,7 @@ class Argument(object): values = source.getlist(name) else: @@ -24,8 +24,8 @@ index 8fe142e..527bc94 100644 for value in values: diff --git a/tests/test_reqparse.py b/tests/test_reqparse.py index ce9ce30..df18ead 100644 ---- tests/test_reqparse.py -+++ tests/test_reqparse.py +--- a/tests/test_reqparse.py ++++ b/tests/test_reqparse.py @@ -891,5 +891,30 @@ class ReqParseTestCase(unittest.TestCase): self.assertEquals(args['int1'], 1) self.assertEquals(args['int2'], 2) diff --git a/0002-Support-aniso8601-3.0-in-tests.patch b/0002-Support-aniso8601-3.0-in-tests.patch index 832bce9..ba75324 100644 --- a/0002-Support-aniso8601-3.0-in-tests.patch +++ b/0002-Support-aniso8601-3.0-in-tests.patch @@ -9,8 +9,8 @@ Subject: [PATCH] Support aniso8601 >3.0 in tests diff --git a/tests/test_inputs.py b/tests/test_inputs.py index 90a2fb0..6cb9e9b 100644 ---- tests/test_inputs.py -+++ tests/test_inputs.py +--- a/tests/test_inputs.py ++++ b/tests/test_inputs.py @@ -417,7 +417,7 @@ def test_bad_isointervals(): for bad_interval in bad_intervals: yield ( diff --git a/0003-Fix-tests_api-list-traceback.patch b/0003-Fix-tests_api-list-traceback.patch index b0a7893..5722847 100644 --- a/0003-Fix-tests_api-list-traceback.patch +++ b/0003-Fix-tests_api-list-traceback.patch @@ -14,8 +14,8 @@ Date: Tue Jun 26 12:06:37 2018 +0200 diff --git tests/test_api.py tests/test_api.py index 26447ae..f34b3f6 100644 ---- tests/test_api.py -+++ tests/test_api.py +--- a/tests/test_api.py ++++ b/tests/test_api.py @@ -784,7 +784,7 @@ class APITestCase(unittest.TestCase): allow = ', '.join(set(resp.headers.get_all('Allow'))) allow = set(method.strip() for method in allow.split(',')) diff --git a/Fix-testsuite-for-werkzeug-1.x.patch b/Fix-testsuite-for-werkzeug-1.x.patch new file mode 100644 index 0000000..32b0b7b --- /dev/null +++ b/Fix-testsuite-for-werkzeug-1.x.patch @@ -0,0 +1,41 @@ +From 73376a488907af3042b52678ac4c23f8a8911e5b Mon Sep 17 00:00:00 2001 +From: Anthony Sottile +Date: Fri, 7 Feb 2020 11:06:15 -0800 +Subject: [PATCH] Fix testsuite for werkzeug 1.x (#862) + +--- + tests/test_api.py | 4 +++- + tests/test_reqparse.py | 4 ++-- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/tests/test_api.py b/tests/test_api.py +index f7f8e661..6795d362 100644 +--- a/tests/test_api.py ++++ b/tests/test_api.py +@@ -445,7 +445,9 @@ def test_handle_non_api_error(self): + + resp = app.get("/foo") + self.assertEquals(resp.status_code, 404) +- self.assertEquals('text/html', resp.headers['Content-Type']) ++ # in newer versions of werkzeug this is `text/html; charset=utf8` ++ content_type, _, _ = resp.headers['Content-Type'].partition(';') ++ self.assertEquals('text/html', content_type) + + def test_non_api_error_404_catchall(self): + app = Flask(__name__) +diff --git a/tests/test_reqparse.py b/tests/test_reqparse.py +index 2f1fbedf..9776f17c 100644 +--- a/tests/test_reqparse.py ++++ b/tests/test_reqparse.py +@@ -2,9 +2,9 @@ + import unittest + from mock import Mock, patch + from flask import Flask +-from werkzeug import exceptions, MultiDict ++from werkzeug import exceptions + from werkzeug.wrappers import Request +-from werkzeug.datastructures import FileStorage ++from werkzeug.datastructures import FileStorage, MultiDict + from flask_restful.reqparse import Argument, RequestParser, Namespace + import six + import decimal diff --git a/python-flask-restful.remove_q0_testcase.patch b/python-flask-restful.remove_q0_testcase.patch index 1a50171..9de14ff 100644 --- a/python-flask-restful.remove_q0_testcase.patch +++ b/python-flask-restful.remove_q0_testcase.patch @@ -1,5 +1,5 @@ ---- tests/test_accept.py.orig 2015-11-13 12:06:18.914003153 +0100 -+++ tests/test_accept.py 2015-11-13 12:04:42.786435117 +0100 +--- a/tests/test_accept.py.orig 2015-11-13 12:06:18.914003153 +0100 ++++ b/tests/test_accept.py 2015-11-13 12:04:42.786435117 +0100 @@ -121,26 +121,6 @@ assert_equals(res.content_type, 'text/plain') diff --git a/python-flask-restful.spec b/python-flask-restful.spec index 7106d44..632848d 100644 --- a/python-flask-restful.spec +++ b/python-flask-restful.spec @@ -1,6 +1,6 @@ Name: python-flask-restful Version: 0.3.6 -Release: 11 +Release: 12 Summary: Framework for creating REST APIs License: BSD URL: https://www.github.com/flask-restful/flask-restful/ @@ -9,6 +9,7 @@ Patch0: python-flask-restful.remove_q0_testcase.patch Patch1: 0001-Fix-arguments-with-type-list-705.patch Patch2: 0002-Support-aniso8601-3.0-in-tests.patch Patch3: 0003-Fix-tests_api-list-traceback.patch +Patch4: Fix-testsuite-for-werkzeug-1.x.patch BuildArch: noarch BuildRequires: git gcc python3-setuptools python3-nose python3-mock python3-blinker @@ -27,7 +28,7 @@ Flask-RESTful is Python 3 extension for Flask that adds support for quickly building REST APIs. %prep -%autosetup -n flask-restful-%{version} -p0 +%autosetup -n flask-restful-%{version} -p1 rm -rf docs/_themes/.gitignore %build @@ -45,6 +46,9 @@ rm -rf docs/_themes/.gitignore %{python3_sitelib}/* %changelog +* Tue Aug 17 2021 huanghaitao - 0.3.6-12 +- Fix testsuit for wekzeug 1.x + * Tue May 18 2020 Buildteam - 0.3.6-11 - Remove redundant BuildRequires -- Gitee