wagtail / django-modelcluster

Django extension to allow working with 'clusters' of models as a single unit, independently of the database
BSD 3-Clause "New" or "Revised" License
485 stars 66 forks source link

test_formfield_callback failing with Django 4.2 #173

Closed mweinelt closed 1 year ago

mweinelt commented 1 year ago

With django-modelcluster 6.0 and Django 4.2.3 we're seeing the following test reliably fail in nixpkgs:

___________________ ClusterFormTest.test_formfield_callback ____________________

self = <tests.tests.test_cluster_form.ClusterFormTest testMethod=test_formfield_callback>

    def test_formfield_callback(self):

        def formfield_for_dbfield(db_field, **kwargs):
            # a particularly stupid formfield_callback that just uses Textarea for everything
            return CharField(widget=Textarea, **kwargs)

        class BandFormWithFFC(ClusterForm):
            formfield_callback = formfield_for_dbfield

            class Meta:
                model = Band
                fields = ['name']
                formsets = ['members', 'albums']

        form = BandFormWithFFC()
>       self.assertEqual(Textarea, type(form['name'].field.widget))
E       AssertionError: <class 'django.forms.widgets.Textarea'> != <class 'django.forms.widgets.TextInput'>

tests/tests/test_cluster_form.py:276: AssertionError
gasman commented 1 year ago

Fixed in #174.