-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Test failures in tutorial with python3.12 #5556
Comments
For info, the tests with python3.11 are still green with the dirty patch. |
Trying to write aware datetime by converting the datetime inside the SQL request fails. For example, in posts = db.execute(
"SELECT p.id, title, body, datetime(p.created, 'localtime'), author_id, username"
" FROM post p JOIN user u ON p.author_id = u.id"
" ORDER BY datetime(p.created, 'localtime') DESC"
).fetchall() it fails because the key I think the right way is to use a convert function like in the first post (and in the documentation). However, it would be better to reuse the local time instead of forcing to UTC. |
I see you've been working on this issue, and I’d like to contribute if there's any part I can help with. Have you made any progress, or is there a specific task I can assist with? |
I think the next step is to write a PR with a convert function providing the local timezone. |
By adding a default converter in the
The |
|
I suggest you to send a PR so the maintainers can check it and accept it directly if they agree with the patch. |
The tests runned with
pytest
works with python3.11 and not in 3.12:How to reproduce:
In both cases, the webservice runs properly with
./venv3.1x/bin/flask --app flaskr run --debug
.However, running the tests show different results. In
venv3.11
, the 24 tests are green. Invenv3.12
virtualenv, there is 6 failures (and 18 green). The failures are due to aDeprecationWarning
which becomes an error:The full output is provided at the end of the bug report.
The
DeprecationWarning
is documented in the 3.12 release: 'default adapters and converters are now deprecated. Instead, use the Adapter and converter recipes and tailor them to your needs.' Copy-pasting blindly the recipes intests/conftest.py
,flaskr/__init__.py
andflaskr/db.py
does not fix the errors.The errors can be fixed by adding thoses lines in conftest.py:
It's probably not the best fix but it's a start.
Pytest output:
The text was updated successfully, but these errors were encountered: