diff --git a/README.md b/README.md index 340752ca7..74501784e 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ GOV.UK Notify admin application - https://www.notifications.service.gov.uk/ ### Python version -At the moment we run Python 3.6 in production. +At the moment we run Python 3.9 in production. ### NPM packages diff --git a/requirements.txt b/requirements.txt index 84e2947c5..879079b9d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.6 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile requirements.in @@ -43,8 +43,6 @@ cryptography==3.3.2 # via # -r requirements.in # fido2 -dataclasses==0.8 - # via werkzeug dnspython==1.16.0 # via eventlet docopt==0.6.2 @@ -90,10 +88,7 @@ humanize==3.12.0 idna==2.10 # via requests importlib-metadata==4.2.0 - # via - # -r requirements.in - # click - # humanize + # via -r requirements.in itsdangerous==1.1.0 # via # -r requirements.in @@ -215,8 +210,6 @@ statsd==3.3.0 # via notifications-utils texttable==1.6.3 # via pyexcel -typing-extensions==3.10.0.0 - # via importlib-metadata urllib3==1.26.5 # via # botocore diff --git a/runtime.txt b/runtime.txt index 62ce9c02a..305091cae 100644 --- a/runtime.txt +++ b/runtime.txt @@ -1 +1 @@ -python-3.6.x +python-3.9.x diff --git a/tests/app/test_template_previews.py b/tests/app/test_template_previews.py index 37554be34..1954c3c9d 100644 --- a/tests/app/test_template_previews.py +++ b/tests/app/test_template_previews.py @@ -5,6 +5,7 @@ from unittest.mock import Mock import pytest from notifications_utils.template import LetterPreviewTemplate +from app import load_service_before_request from app.template_previews import ( TemplatePreview, get_page_count_for_letter, @@ -58,6 +59,10 @@ def test_from_database_object_makes_request( expected_filename, mock_get_service_letter_template ): + # This test is calling `current_service` outside a Flask endpoint, so we need to make sure + # `service` is in the `_request_ctx_stack` to avoid an error + load_service_before_request() + resp = Mock(content='a', status_code='b', headers={'c': 'd'}) request_mock = mocker.patch('app.template_previews.requests.post', return_value=resp) mocker.patch('app.template_previews.current_service', letter_branding=letter_branding)