- Add python38-exception-test.patch to fix test failures under Python 3.8

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:flask/python-Flask?expand=0&rev=7
This commit is contained in:
Steve Kowalik 2019-11-08 05:41:19 +00:00 committed by Git OBS Bridge
parent 0d17b977e6
commit 1a30d9abb8
3 changed files with 49 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Fri Nov 8 05:29:38 UTC 2019 - Steve Kowalik <steven.kowalik@suse.com>
- Add python38-exception-test.patch to fix test failures under Python 3.8
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jul 19 12:22:54 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com> Fri Jul 19 12:22:54 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -26,6 +26,7 @@ License: BSD-3-Clause
Group: Development/Languages/Python Group: Development/Languages/Python
URL: http://github.com/mitsuhiko/flask/ URL: http://github.com/mitsuhiko/flask/
Source: https://files.pythonhosted.org/packages/source/F/Flask/Flask-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/F/Flask/Flask-%{version}.tar.gz
Patch0: python38-exception-test.patch
BuildRequires: %{python_module Jinja2 >= 2.4} BuildRequires: %{python_module Jinja2 >= 2.4}
BuildRequires: %{python_module Werkzeug >= 0.15} BuildRequires: %{python_module Werkzeug >= 0.15}
BuildRequires: %{python_module click >= 5.1} BuildRequires: %{python_module click >= 5.1}
@ -60,6 +61,7 @@ reference for python-Flask.
%prep %prep
%setup -q -n Flask-%{version} %setup -q -n Flask-%{version}
%autopatch -p1
%build %build
%python_build %python_build

View File

@ -0,0 +1,42 @@
From c367a86cc5be70da4928b276d0218f98df6e854d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fernanda=20Guimar=C3=A3es?= <fernandaguimaraes28@gmail.com>
Date: Mon, 28 Oct 2019 21:37:25 -0300
Subject: [PATCH] Test test_send_from_directory_bad_request no longer fails in
Python 3.8.
---
tests/test_helpers.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tests/test_helpers.py b/tests/test_helpers.py
index 78a562213..21735af12 100644
--- a/tests/test_helpers.py
+++ b/tests/test_helpers.py
@@ -11,6 +11,7 @@
import datetime
import io
import os
+import sys
import uuid
import pytest
@@ -780,12 +781,17 @@ def test_send_from_directory_pathlike(self, app, req_ctx):
assert rv.data.strip() == b"Hello Subdomain"
rv.close()
- def test_send_from_directory_bad_request(self, app, req_ctx):
+ def test_send_from_directory_null_character(self, app, req_ctx):
app.root_path = os.path.join(
os.path.dirname(__file__), "test_apps", "subdomaintestmodule"
)
- with pytest.raises(BadRequest):
+ if sys.version_info >= (3, 8):
+ exception = NotFound
+ else:
+ exception = BadRequest
+
+ with pytest.raises(exception):
flask.send_from_directory("static", "bad\x00")