flask-sqlalchemy
flask-sqlalchemy copied to clipboard
Stop using datetime.utcnow() in tests
datetime.utcnow() is deprecated for Python 3.12+, and raises a warning. Since warnings are treated as errors, this results in test failures. Since utcnow calls are done by the SQLAlchemy mapping machinery, we need to use a callable.
Fixes #1303
Checklist:
- [x] Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
- [x] Add or update relevant docs, in the docs folder and in code.
- [x] Add an entry in
CHANGES.rstsummarizing the change and linking to the issue. - [x] Add
.. versionchanged::entries in any relevant code docs. - [x] Run
pre-commithooks and fix any issues. - [x] Run
pytestandtox, no tests failed.
I have addressed both comments, thanks!
@davidism Thanks, I've reverted that bit.
Sorry, completely forgot about this PR and ended up fixing it myself when doing some updates. Thanks for working on it!