From 4c22eb6bd0405aee4fdfc93432c7956c072f5d49 Mon Sep 17 00:00:00 2001 From: Michael Plunkett <5885605+michplunkett@users.noreply.github.com> Date: Fri, 19 Jul 2024 16:58:23 -0500 Subject: [PATCH] Update `Flask-WTF` to address test warnings (#1114) ## Fixes issue https://github.com/lucyparsons/OpenOversight/issues/1054 ## Description of Changes Addressed the below error by updating `Flask-WTF`: ```console ../../local/lib/python3.11/site-packages/flask_wtf/recaptcha/widgets.py:2: 10 warnings /usr/local/lib/python3.11/site-packages/flask_wtf/recaptcha/widgets.py:2: DeprecationWarning: 'flask.Markup' is deprecated and will be removed in Flask 2.4. Import 'markupsafe.Markup' instead. from flask import Markup ``` ## Tests and Linting - [x] This branch is up-to-date with the `develop` branch. - [x] `pytest` passes on my local development environment. - [x] `pre-commit` passes on my local development environment. - [x] Verified warning is no longer in the `warnings summary`. ```console =============================== warnings summary =============================== OpenOversight/tests/test_commands.py::test_add_department__duplicate OpenOversight/tests/test_models.py::test__uuid_uniqueness_constraint OpenOversight/tests/routes/test_singular_redirects.py::test_redirect_add_salary /usr/src/app/OpenOversight/tests/conftest.py:325: SAWarning: transaction already deassociated from connection transaction.rollback() OpenOversight/tests/test_models.py::test_salary_repr /usr/src/app/OpenOversight/tests/test_models.py:170: SAWarning: Dialect sqlite+pysqlite does *not* support Decimal objects natively, and SQLAlchemy must convert from floating point - rounding errors and other issues may occur. Please consider storing Decimal numbers as strings or integers on this platform for lossless storage. salary = Salary.query.first() OpenOversight/tests/test_database_cache.py::test_documented_assignments OpenOversight/tests/test_functional.py::test_incident_detail_display_read_more_button_for_descriptions_over_cutoff /usr/local/lib/python3.11/site-packages/jinja2/environment.py:487: SAWarning: Dialect sqlite+pysqlite does *not* support Decimal objects natively, and SQLAlchemy must convert from floating point - rounding errors and other issues may occur. Please consider storing Decimal numbers as strings or integers on this platform for lossless storage. return getattr(obj, attribute) OpenOversight/tests/test_commands.py::test_csv_import_new /usr/src/app/OpenOversight/tests/conftest.py:855: SAWarning: Dialect sqlite+pysqlite does *not* support Decimal objects natively, and SQLAlchemy must convert from floating point - rounding errors and other issues may occur. Please consider storing Decimal numbers as strings or integers on this platform for lossless storage. if len(list(officer.salaries)) > 0: OpenOversight/tests/test_commands.py::test_csv_new_salary /usr/src/app/OpenOversight/tests/test_commands.py:463: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '123456.78' has dtype incompatible with float64, please explicitly cast to a compatible dtype first. df.loc[0, "salary"] = "123456.78" OpenOversight/tests/test_functional.py: 138 warnings /usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py:418: DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default). if resp.getheader('Content-Type') is not None: OpenOversight/tests/test_functional.py: 138 warnings /usr/local/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py:419: DeprecationWarning: HTTPResponse.getheader() is deprecated and will be removed in urllib3 v2.1.0. Instead use HTTPResponse.headers.get(name, default). content_type = resp.getheader('Content-Type').split(';') -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ---------- coverage: platform linux, python 3.11.9-final-0 ----------- ``` --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2a4bbe765..bd3faed56 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,7 +28,7 @@ Flask-Mail==0.9.1 Flask-Migrate==4.0.4 Flask-Sitemap==0.4.0 Flask-SQLAlchemy==3.0.5 -Flask-WTF==1.1.1 +Flask-WTF==1.1.2 google-api-python-client==2.92.0 gunicorn==22.0.0 httplib2==0.22.0