-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Limit Flask to <2.3 in the wake of 2.2 breaking our tests #25511
Conversation
ed3341d
to
2842ea8
Compare
Flask 2.2 added a few deprecations and made a few changes that made our tests stop working. Those were really test problems not real application problems (there were no breaking changes in 2.2): * new deprecation warnings produced * Flask app cannot be reused in multiple tests * The way how session lifetime is calculated makes test fail if freezegun is frozen using Pendulum datetime rather than the stdlib ones This is an early warning for the future as the deprecation warnings make us aware that Flask 2.3 is breaking. So this PR fixes the 2.2 compatibility but at the same time limits Flask to < 2.3 with appropriate information when the limit can be removed.
2842ea8
to
e8f5e68
Compare
@ashb @uranusjr -> I need a second look here. I think I solved the test problems introduced by Flask 2.2 - I tried to find a better way but actually it turned out that the only way I could make it work is by getting rid of Freezegun from two tests that failed on MySQL only. This is rather weird but it is fully reproducible. There were two problems:
I "fixed" it (or so I thought) by changing CURRENT_TIME to stdlib's datetime (does not matter if I used it naive or timezone aware ). And it seemed to work. Until I saw in https://github.com/apache/airflow/runs/7656424982?check_suite_focus=true#step:10:14266 that while Postgres/Sqlite were working, Two MySQL tests failed with:
I traced it down to this change in Flask (sessions.py): Flask 2.1.2:
Flask 2.2.0:
Seems that this one change from This is a little 🤯 , but apparently mixing Freezegun, Flask, Pendulum, Stdlib.datatime and MySQL SQLAlchemy is too much for Airflow to 🐻 🤣 I workarounded it with getting rid of the Freezegun from both tests (it's not really "nice" but seems to work fine). But if you have other ideas, I would love to hear them :D |
Yep. Seems that my "workarounds" worked :) |
Patch in this PR looks good to me.
Pendulum tries to be clever and returns a string form with a |
Yeah. Some clever absractions are just .... too clever :) |
BTW. I've opened an issue in Flask - maybe that is compelling enough case for them to revert that change (it should have no side-effects) |
Flask 2.2 added a few deprecations and made a few changes that made our tests stop working. Those were really test problems not real application problems (there were no breaking changes in 2.2): * new deprecation warnings produced * Flask app cannot be reused in multiple tests * The way how session lifetime is calculated makes test fail if freezegun is frozen using Pendulum datetime rather than the stdlib ones This is an early warning for the future as the deprecation warnings make us aware that Flask 2.3 is breaking. So this PR fixes the 2.2 compatibility but at the same time limits Flask to < 2.3 with appropriate information when the limit can be removed. (cherry picked from commit 42ea000)
Flask 2.2 added a few deprecations and made a few changes that
made our tests stop working. Those were really test problems not
real application problems (there were no breaking changes in 2.2):
if freezegun is frozen using Pendulum datetime rather than the
stdlib ones
This is an early warning for the future as the deprecation
warnings make us aware that Flask 2.3 is breaking. So this PR
fixes the 2.2 compatibility but at the same time limits Flask to
< 2.3 with appropriate information when the limit can be removed.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.