From af970bd20f2d5c1d36abcb1f300a531c436b5655 Mon Sep 17 00:00:00 2001 From: Kristin Faner Date: Sat, 5 Oct 2019 17:11:08 -0500 Subject: [PATCH 1/2] fix typo in request context docs --- docs/reqcontext.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/reqcontext.rst b/docs/reqcontext.rst index 5dad6fbf..c6f43ce1 100644 --- a/docs/reqcontext.rst +++ b/docs/reqcontext.rst @@ -170,8 +170,8 @@ will not fail. During testing, it can be useful to defer popping the contexts after the request ends, so that their data can be accessed in the test function. -Using the :meth:`~Flask.test_client` as a ``with`` block to preserve the -contexts until the with block exits. +Use the :meth:`~Flask.test_client` as a ``with`` block to preserve the +contexts until the ``with`` block exits. .. code-block:: python From c367a86cc5be70da4928b276d0218f98df6e854d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernanda=20Guimar=C3=A3es?= Date: Mon, 28 Oct 2019 21:37:25 -0300 Subject: [PATCH 2/2] 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 78a56221..21735af1 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 @@ class TestSendfile(object): 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")