kvesteri / wtforms-alchemy

Tools for creating wtforms from sqlalchemy models
Other
245 stars 59 forks source link

Failing unit test: TestModelFormConfiguration.test_supports_custom_datetime_format #163

Open Vidminas opened 1 year ago

Vidminas commented 1 year ago

With a fresh clone of the repo and running tox -e sqlalchemy14, one of the unit tests fails. This is the output after installing dependencies:

================================================= test session starts =================================================
platform win32 -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
cachedir: .tox\sqlalchemy14\.pytest_cache
rootdir: C:\Users\Vidminas\GitHub\wtforms-alchemy
plugins: anyio-3.7.1, cov-4.1.0
collected 248 items

tests\test_class_map.py .................                                                                        [  6%]
tests\test_column_aliases.py .....                                                                               [  8%]
tests\test_configuration.py ...........F......                                                                   [ 16%]
tests\test_country_field.py ..                                                                                   [ 16%]
tests\test_custom_fields.py .                                                                                    [ 17%]
tests\test_deep_form_relations.py ..                                                                             [ 18%]
tests\test_descriptions.py ..                                                                                    [ 18%]
tests\test_field_exclusion.py ....                                                                               [ 20%]
tests\test_field_order.py .                                                                                      [ 20%]
tests\test_field_parameters.py .............                                                                     [ 26%]
tests\test_field_trimming.py ..                                                                                  [ 27%]
tests\test_form_meta.py ........                                                                                 [ 30%]
tests\test_hybrid_properties.py ..                                                                               [ 31%]
tests\test_i18n_extension.py ...                                                                                 [ 32%]
tests\test_inheritance.py .....                                                                                  [ 34%]
tests\test_labels.py ..                                                                                          [ 35%]
tests\test_model_field_list.py ........                                                                          [ 38%]
tests\test_model_form_factory.py ............                                                                    [ 43%]
tests\test_model_form_field.py ...                                                                               [ 44%]
tests\test_phone_number.py ....                                                                                  [ 45%]
tests\test_phone_number_field.py ............                                                                    [ 50%]
tests\test_query_select_field.py .............                                                                   [ 56%]
tests\test_select_field.py ..........                                                                            [ 60%]
tests\test_synonym.py ..                                                                                         [ 60%]
tests\test_types.py ..............................................                                               [ 79%]
tests\test_unique_validator.py .......................                                                           [ 88%]
tests\test_utils.py .                                                                                            [ 89%]
tests\test_validators.py ...................                                                                     [ 96%]
tests\test_weekdays_field.py ..                                                                                  [ 97%]
tests\test_widgets.py ......                                                                                     [100%]

====================================================== FAILURES =======================================================
___________________________ TestModelFormConfiguration.test_supports_custom_datetime_format ___________________________

self = <tests.test_configuration.TestModelFormConfiguration object at 0x000001883DB515D0>

    def test_supports_custom_datetime_format(self):
        self.init(sa.DateTime, nullable=False)

        class ModelTestForm(ModelForm):
            class Meta:
                model = self.ModelTest
                datetime_format = '%Y-%m-%dT%H:%M:%S'

        form = ModelTestForm()
>       assert form.test_column.format == '%Y-%m-%dT%H:%M:%S'
E       AssertionError: assert ['%Y-%m-%dT%H:%M:%S'] == '%Y-%m-%dT%H:%M:%S'
E        +  where ['%Y-%m-%dT%H:%M:%S'] = <wtforms_components.fields.html5.DateTimeField object at 0x000001883DF97110>.format
E        +    where <wtforms_components.fields.html5.DateTimeField object at 0x000001883DF97110> = <tests.test_configuration.TestModelFormConfiguration.test_supports_custom_datetime_format.<locals>.ModelTestForm object at 0x000001883DEBB190>.test_column

tests\test_configuration.py:154: AssertionError
================================================== warnings summary ===================================================
tests\test_unique_validator.py:12
  C:\Users\Vidminas\GitHub\wtforms-alchemy\tests\test_unique_validator.py:12: MovedIn20Warning: Deprecated API features detected! These feature(s) are not compatible with SQLAlchemy 2.0. To prevent incompatible upgrades prior to updating applications, ensure requirements files are pinned to "sqlalchemy<2.0". Set environment variable SQLALCHEMY_WARN_20=1 to show all deprecation warnings.  Set environment variable SQLALCHEMY_SILENCE_UBER_WARNING=1 to silence this message. (Background on SQLAlchemy 2.0 at: https://sqlalche.me/e/b8d9)
    base = declarative_base()

tests/test_model_form_factory.py::TestModelFormFactory::test_class_meta_wtforms2
tests/test_model_form_factory.py::TestModelFormFactory::test_class_meta_wtforms2
  C:\Users\Vidminas\GitHub\wtforms-alchemy\tests\test_model_form_factory.py:94: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
    if LooseVersion(wtforms.__version__) < LooseVersion('2'):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================== short test summary info ===============================================
FAILED tests/test_configuration.py::TestModelFormConfiguration::test_supports_custom_datetime_format - AssertionError...
====================================== 1 failed, 247 passed, 3 warnings in 2.67s ======================================
sqlalchemy14: exit 1 (5.03 seconds) C:\Users\Vidminas\GitHub\wtforms-alchemy> py.test pid=9716
.pkg: _exit> python C:\Users\Vidminas\.conda\envs\wtforms-alchemy\Lib\site-packages\pyproject_api\_backend.py True setuptools.build_meta __legacy__
  sqlalchemy14: FAIL code 1 (92.41=setup[49.20]+cmd[38.17,5.03] seconds)
  evaluation failed :( (92.62 seconds)