Skip to content

Commit

Permalink
Merge pull request #650 from alphagov/bg-upgrade-flask
Browse files Browse the repository at this point in the history
Update to latest v1 Flask
  • Loading branch information
bjgill authored Jun 1, 2021
2 parents d51af88 + cfade31 commit ad330a0
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 32 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Digital marketplace utils changelog

Records breaking changes from major version bumps
Records breaking changes from major version bumps.

## 59.0.0

### Breaking changes

Upgrade to Flask 1.1. This has some known
[breaking changes](https://flask.palletsprojects.com/en/2.0.x/changes/#version-1-1-0).

## 58.0.0

Expand Down
2 changes: 1 addition & 1 deletion dmutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from .flask_init import init_app


__version__ = '58.1.0'
__version__ = '59.0.0'
43 changes: 21 additions & 22 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ blinker==1.4
# via gds-metrics
boto3==1.17.78
# via
# digitalmarketplace-utils
# moto
# sanitized-package
botocore==1.20.78
# via
# boto3
Expand All @@ -32,11 +32,11 @@ chardet==4.0.0
click==7.1.2
# via flask
contextlib2==0.6.0.post1
# via sanitized-package
# via digitalmarketplace-utils
cryptography==3.4.7
# via
# digitalmarketplace-utils
# moto
# sanitized-package
defusedxml==0.7.1
# via odfpy
digitalmarketplace-test-utils==2.8.2
Expand All @@ -46,31 +46,31 @@ docopt==0.6.2
flake8==3.9.2
# via -r requirements-dev.in
flask-gzip==0.2
# via sanitized-package
# via digitalmarketplace-utils
flask-login==0.5.0
# via sanitized-package
# via digitalmarketplace-utils
flask-session==0.3.2
# via sanitized-package
# via digitalmarketplace-utils
flask-wtf==0.14.3
# via sanitized-package
flask==1.0.4
# via digitalmarketplace-utils
flask==1.1.4
# via
# digitalmarketplace-utils
# flask-gzip
# flask-login
# flask-session
# flask-wtf
# gds-metrics
# sanitized-package
fleep==1.0.1
# via sanitized-package
# via digitalmarketplace-utils
freezegun==1.1.0
# via -r requirements-dev.in
future==0.18.2
# via notifications-python-client
gds-metrics==0.2.4
# via sanitized-package
# via digitalmarketplace-utils
govuk-country-register==0.5.0
# via sanitized-package
# via digitalmarketplace-utils
hypothesis==6.13.4
# via -r requirements-dev.in
idna==2.8
Expand All @@ -95,7 +95,7 @@ jmespath==0.10.0
# boto3
# botocore
mailchimp3==3.0.14
# via sanitized-package
# via digitalmarketplace-utils
markupsafe==1.1.1
# via
# jinja2
Expand All @@ -116,9 +116,9 @@ mypy-extensions==0.4.3
mypy==0.812
# via -r requirements-dev.in
notifications-python-client==5.7.1
# via sanitized-package
# via digitalmarketplace-utils
odfpy==1.4.1
# via sanitized-package
# via digitalmarketplace-utils
packaging==20.9
# via pytest
pluggy==0.13.1
Expand All @@ -145,23 +145,23 @@ python-dateutil==2.8.1
# freezegun
# moto
python-json-logger==0.1.11
# via sanitized-package
# via digitalmarketplace-utils
pytz==2021.1
# via
# digitalmarketplace-utils
# moto
# sanitized-package
redis==3.5.3
# via sanitized-package
# via digitalmarketplace-utils
requests-mock==1.9.2
# via -r requirements-dev.in
requests==2.25.1
# via
# digitalmarketplace-utils
# mailchimp3
# moto
# notifications-python-client
# requests-mock
# responses
# sanitized-package
responses==0.13.3
# via moto
s3transfer==0.4.2
Expand All @@ -186,7 +186,7 @@ typing-extensions==3.7.4.3
# importlib-metadata
# mypy
unicodecsv==0.14.1
# via sanitized-package
# via digitalmarketplace-utils
urllib3==1.26.4
# via
# botocore
Expand All @@ -196,9 +196,8 @@ werkzeug==1.0.1
# via
# flask
# moto
# sanitized-package
workdays==1.4
# via sanitized-package
# via digitalmarketplace-utils
wtforms==2.3.3
# via flask-wtf
xmltodict==0.12.0
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
include_package_data=True,
install_requires=[
'Flask-WTF>=0.14.2',
'Flask<1.1.0,>=1.0.2',
'Flask~=1.0',
'Flask-gzip>=0.2',
'Flask-Login>=0.2.11',
'Flask-Session>=0.3.2',
Expand All @@ -43,7 +43,6 @@
'python-json-logger>=0.1.11,<3.0.0',
'pytz',
'unicodecsv>=0.14.1',
'Werkzeug>=0.16,<1.1.0',
'workdays>=1.4',
],
python_requires="~=3.6",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_init_app_only_adds_handlers_to_defined_loggers(app):
and isinstance(v.handlers[0], logging.StreamHandler)
}

assert loggers == {'flask.app', 'dmutils', 'dmapiclient', 'flask_wtf.csrf', 'urllib3.util.retry'}
assert loggers == {'conftest', 'dmutils', 'dmapiclient', 'flask_wtf.csrf', 'urllib3.util.retry'}


def test_urllib3_retry_logger_not_configured_for_search_api(app):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ def _default_and_no_exception(log_context):
'error': "{name}: {street} - {duration_process}s",
},
{
'success': AnyStringMatching(r"flask\.app\.foobar: (\{.*\}|eccles) - [0-9eE.-]+s"),
'error': AnyStringMatching(r"flask\.app\.foobar: (\{.*\}|eccles) - [0-9eE.-]+s"),
'success': AnyStringMatching(r"conftest\.foobar: (\{.*\}|eccles) - [0-9eE.-]+s"),
'error': AnyStringMatching(r"conftest\.foobar: (\{.*\}|eccles) - [0-9eE.-]+s"),
},
),
),
Expand Down Expand Up @@ -375,7 +375,7 @@ def test_logged_duration_mock_logger(
if ("street" in str(message) and "street" not in (inject_context or {})) else ()
),
AnySupersetOf({
"name": "flask.app.foobar",
"name": "conftest.foobar",
"levelname": logging.getLevelName(log_level),
"message": _messages_expected[message][1].get('error' if raise_exception else 'success'),
"duration_real": RestrictedAny(
Expand Down Expand Up @@ -445,7 +445,7 @@ def test_logged_duration_mock_logger(
"key": "D#",
"duration_real": RestrictedAny(lambda value: 0.48 < value < 0.6),
"duration_process": RestrictedAny(lambda value: isinstance(value, Number)),
"name": "flask.app.foobar",
"name": "conftest.foobar",
}),),
),
(
Expand Down Expand Up @@ -483,7 +483,7 @@ def test_logged_duration_mock_logger(
),
"duration_real": RestrictedAny(lambda value: 0.18 < value < 0.35),
"duration_process": RestrictedAny(lambda value: isinstance(value, Number)),
"name": "flask.app.foobar",
"name": "conftest.foobar",
}),
),
),
Expand Down

0 comments on commit ad330a0

Please sign in to comment.