-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Support latest flask, sqlalchemy, flask-sqlalchemy and wtforms #2328
Conversation
======= 4 failed, 77 passed, 6 xfailed, 10 warnings, 62 errors in 22.46s ======= |
Failed tests because of Flask-SQLAlchemy version lower than 3.0.1 - they fixed |
42a30e0
to
c3ee6bd
Compare
I had missed that MarkupSafe was still restricted and that was limiting Flask-SQLAlchemy to 2.5.1. Removed that restriction, and the monoengine ones - only the necessary azure-storage-blob restriction is left here now. After merging in master with the BaseView fix: ========== 13 failed, 130 passed, 6 xfailed, 17016 warnings in 39.83s ========== I undid the xfail from sqla/test_basic test_different_bind_joins and added a selection of patches from other PRs and: ========== 5 failed, 139 passed, 5 xfailed, 24725 warnings in 50.02s =========== And one of those failures should be easy:
just needs changing to the new sqlalchemy 2 style. |
9ee431b
to
62d0f7b
Compare
I think I'm getting there. The one I definitely don't think I can fix is
it does appear to be WTForms 3 related but I don't have the Flask skills to debug. |
========== 1 failed, 143 passed, 5 xfailed, 24992 warnings in 39.42s =========== That's as far as I think I can get. Last failure, as above, WTForms 3 related: flask_admin/tests/sqla/test_inlineform.py:307: AssertionError def test_inline_form_base_class():
...
# Create
data = {
'name': 'emptyEmail',
'emails- '',
}
rv = client.post('/admin/user/new/', data=data)
assert rv.status_code ==
assert User.query.count() ==
> assert b'success!' in rv.data, rv.data
E AssertionError: b'
E <!DOCTYPE html> |
Resolved the test_inlineform failure, Now we have a bunch of new failures... |
0948af6
to
ddf6024
Compare
Just as it was nearly there a new release of SQLAlchemy, 2.0.2, came out which breaks Flask-Admin. Commit added to fix that. More in the commit message, but the solution here does mean dropping SQLAlchemy 1.3 and therefore also SQLAlchemy-Utils 0.36. I think that is the cleanest way of doing it, but maybe there are other opinions. |
Probably worth making it clear then that this PR only covers tests and flask_admin itself, not the examples. Because of Flask-BabelEx or Flask-MongoEngine the examples will be at most Flask < 3. examples/sqla/requirements.txt as per Step 3 of the linked instructions could be updated (plus the ones in all the subdirectories checked). |
https://build.opensuse.org/request/show/1120478 by user mcalabkova + anag+factory - Add few patches to fix tests (from gh#pallets-eco/flask-admin#2328): * model-from-model.patch * reverse-relation-for-model.patch * bytes-not-str.patch
"AssertionError: The setup method 'register_blueprint' can no longer be called on the application. It has already handled its first request, any changes will not be applied consistently. Make sure all imports, decorators, functions, etc. needed to set up the application are done before running it."
FAILED tests/test_model.py::test_export_csv - AssertionError: assert 'Col1,Col2\r\..._3,col2_3\r\n' == 'Col1,Col2\r\...,–utf8_2–\r\n'
sqlalchemy.exc.UnboundExecutionError: Bind key 'other' is not in 'SQLALCHEMY_BINDS' config.
> assert model.test == '' E AssertionError: assert None == '' E + where None = <Model test WTForms 3 changed StringField data default value.
> db.engine.execute('CREATE EXTENSION IF NOT EXISTS citext') E AttributeError: 'Engine' object has no attribute 'execute'
SQLAlchemy 2.0.2 removed the invocation of registry.configure() from Mapper.iterate_properties causing this problem. sqlalchemy.orm.registry.configure() was added in 1.4.0b2. Observed as test failures in: flask_admin/tests/sqla/test_basic.py flask_admin/tests/sqla/test_form_rules.py flask_admin/tests/sqla/test_inlineform.py
LegacyAPIWarning: The Query.get() method is considered legacy as of the 1.x series of SQLAlchemy and becomes a legacy construct in 2.0. The method is now available as Session.get() (deprecated since: 2.0)
E sqlalchemy_utils.exceptions.ImproperlyConfigured: 'babel' package is required in order to use CurrencyType. .tox/py/lib/python3.9/site-packages/sqlalchemy_utils/types/currency.py:55: ImproperlyConfigured
assert rv.location.startswith(expected) > assert 'url=http%3A%2F%2Flocalhost%2Fadmin%2Fmodel2view%2F' in rv.location E AssertionError: assert 'url=http%3A%2F%2Flocalhost%2Fadmin%2Fmodel2view%2F' in '/admin/model1/edit/?id=1&url=http://localhost/admin/model2view/' E + where '/admin/model1/edit/?id=1&url=http://localhost/admin/model2view/' = <WrapperTestResponse streamed [302 FOUND]>.location flask_admin/tests/sqla/test_basic.py:2466: AssertionError
I am going to close this as outdated as we've just updated the testing framework for flask-admin after it was incorporated into the pallets-eco project. I do think we need to address the testing situation to have better variant testing on some key dependencies, however that may be best to look at from a fresh slate now. Please don't take this as discouragement from helping tighten this up, but as this PR is fairly stale now I think a reboot would be best. |
For information on the test failures with the latest versions of these key dependencies and a tracker for some of the fixes from other PRs.