Public bug reported:

python-django-postgres-extra DEP8 tests are currently failing in
resolute with postgresql-18.

This is because postgresql-18 now "Store[s] column NOT NULL
specifications in pg_constraint"
(https://www.postgresql.org/docs/release/18.0/,
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=14e87ffa5).

Fixed upstream in
https://github.com/django/django/commit/906a51e125c3007f86d42b81072a1dad7149af05

Error:

tests/test_schema_editor_clone_model_to_schema.py::test_schema_editor_clone_model_to_schema
FAILED
[100%]

==================================================================================================================
 FAILURES 
==================================================================================================================
__________________________________________________________________________________________________
 test_schema_editor_clone_model_to_schema 
__________________________________________________________________________________________________

fake_model = <class 'tests.fake_model.Fe84Edef'>, fake_model_fk_target_1
= <class 'tests.fake_model.2A3983B8'>, fake_model_fk_target_2 = <class
'tests.fake_model.Ac0498F6'>

    @pytest.mark.skipif(
        django.VERSION < (3, 2),
        reason=django_32_skip_reason,
    )
    @pytest.mark.django_db(transaction=True)
    def test_schema_editor_clone_model_to_schema(
        fake_model, fake_model_fk_target_1, fake_model_fk_target_2
    ):
        """Tests that cloning a model into a separate schema without obtaining
        AccessExclusiveLock on the source table works as expected."""
    
        schema_editor = PostgresSchemaEditor(connection)
    
        with schema_editor:
            schema_editor.alter_table_storage_setting(
                fake_model._meta.db_table, "autovacuum_enabled", "false"
            )
    
        table_name = fake_model._meta.db_table
        source_schema_name = "public"
        target_schema_name = _create_schema()
    
        with schema_editor:
            schema_editor.clone_model_structure_to_schema(
                fake_model, schema_name=target_schema_name
            )
    
            assert _list_lock_modes_in_schema(source_schema_name) == {
                "AccessShareLock"
            }
    
>       _assert_cloned_table_is_same(
            (source_schema_name, table_name),
            (target_schema_name, table_name),
            excluding_constraints_and_indexes=True,
        )

tests/test_schema_editor_clone_model_to_schema.py:240: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.13/contextlib.py:85: in inner
    return func(*args, **kwds)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

source_table_fqn = ('public', 'tests_fe84edef'), target_table_fqn =
('6e67809a', 'tests_fe84edef'), excluding_constraints_and_indexes = True

    @transaction.atomic
    def _assert_cloned_table_is_same(
        source_table_fqn: Tuple[str, str],
        target_table_fqn: Tuple[str, str],
        excluding_constraints_and_indexes: bool = False,
    ):
        source_schema_name, source_table_name = source_table_fqn
        target_schema_name, target_table_name = target_table_fqn
    
        source_columns = db_introspection.get_columns(
            source_table_name, schema_name=source_schema_name
        )
        target_columns = db_introspection.get_columns(
            target_table_name, schema_name=target_schema_name
        )
        assert source_columns == target_columns
    
        source_relations = db_introspection.get_relations(
            source_table_name, schema_name=source_schema_name
        )
        target_relations = db_introspection.get_relations(
            target_table_name, schema_name=target_schema_name
        )
        if excluding_constraints_and_indexes:
            assert target_relations == {}
        else:
            assert source_relations == target_relations
    
        source_constraints = db_introspection.get_constraints(
            source_table_name, schema_name=source_schema_name
        )
        target_constraints = db_introspection.get_constraints(
            target_table_name, schema_name=target_schema_name
        )
        if excluding_constraints_and_indexes:
>           assert target_constraints == {}
E           AssertionError: assert {'tests_fe84edef_age_not_null': {'columns': 
['age'], 'primary_key': False, 'unique': False, 'foreign_key': None, 'check': 
False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}, 'tests_fe84edef_blob_not_null': {'columns': 
['blob'], 'primary_key': False, 'unique': False, 'foreign_key': None, 'check': 
False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}, 'tests_fe84edef_family_id_not_null': {'columns': 
['family_id'], 'primary_key': False, 'unique': False, 'foreign_key': None, 
'check': False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}, 'tests_fe84edef_height_not_null': {'columns': 
['height'], 'primary_key': False, 'unique': False, 'foreign_key': None, 
'check': False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}, 'tests_fe84edef_id_not_null': {'columns': 
['id'], 'primary_key': False, 'unique': False, 'foreign_key': None, 'check': 
False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}, 'tests_fe84edef_last_name_not_null': {'columns': 
['last_name'], 'primary_key': False, 'unique': False, 'foreign_key': None, 
'check': False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}, 'tests_fe84edef_nicknames_not_null': {'columns': 
['nicknames'], 'primary_key': False, 'unique': False, 'foreign_key': None, 
'check': False, 'index': False, 'definition': None, 'options': 
['autovacuum_enabled=false']}} == {}
E             
E             Left contains 7 more items:
E             {'tests_fe84edef_age_not_null': {'check': False,
E                                              'columns': ['age'],
E                                              'definition': None,
E                                              'foreign_key': None,
E                                              'index': False,
E                                              'options': 
['autovacuum_enabled=false'],
E                                              'primary_key': False,
E                                              'unique': False},
E              'tests_fe84edef_blob_not_null': {'check': False,
E                                               'columns': ['blob'],
E                                               'definition': None,
E                                               'foreign_key': None,
E                                               'index': False,
E                                               'options': 
['autovacuum_enabled=false'],
E                                               'primary_key': False,
E                                               'unique': False},
E              'tests_fe84edef_family_id_not_null': {'check': False,
E                                                    'columns': ['family_id'],
E                                                    'definition': None,
E                                                    'foreign_key': None,
E                                                    'index': False,
E                                                    'options': 
['autovacuum_enabled=false'],
E                                                    'primary_key': False,
E                                                    'unique': False},
E              'tests_fe84edef_height_not_null': {'check': False,
E                                                 'columns': ['height'],
E                                                 'definition': None,
E                                                 'foreign_key': None,
E                                                 'index': False,
E                                                 'options': 
['autovacuum_enabled=false'],
E                                                 'primary_key': False,
E                                                 'unique': False},
E              'tests_fe84edef_id_not_null': {'check': False,
E                                             'columns': ['id'],
E                                             'definition': None,
E                                             'foreign_key': None,
E                                             'index': False,
E                                             'options': 
['autovacuum_enabled=false'],
E                                             'primary_key': False,
E                                             'unique': False},
E              'tests_fe84edef_last_name_not_null': {'check': False,
E                                                    'columns': ['last_name'],
E                                                    'definition': None,
E                                                    'foreign_key': None,
E                                                    'index': False,
E                                                    'options': 
['autovacuum_enabled=false'],
E                                                    'primary_key': False,
E                                                    'unique': False},
E              'tests_fe84edef_nicknames_not_null': {'check': False,
E                                                    'columns': ['nicknames'],
E                                                    'definition': None,
E                                                    'foreign_key': None,
E                                                    'index': False,
E                                                    'options': 
['autovacuum_enabled=false'],
E                                                    'primary_key': False,
E                                                    'unique': False}}
E             
E             Full diff:
E             - {}
E             + {
E             +     'tests_fe84edef_age_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'age',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             +     'tests_fe84edef_blob_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'blob',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             +     'tests_fe84edef_family_id_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'family_id',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             +     'tests_fe84edef_height_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'height',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             +     'tests_fe84edef_id_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'id',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             +     'tests_fe84edef_last_name_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'last_name',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             +     'tests_fe84edef_nicknames_not_null': {
E             +         'check': False,
E             +         'columns': [
E             +             'nicknames',
E             +         ],
E             +         'definition': None,
E             +         'foreign_key': None,
E             +         'index': False,
E             +         'options': [
E             +             'autovacuum_enabled=false',
E             +         ],
E             +         'primary_key': False,
E             +         'unique': False,
E             +     },
E             + }

tests/test_schema_editor_clone_model_to_schema.py:72: AssertionError

** Affects: postgresql-common (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: python-django (Ubuntu)
     Importance: Undecided
     Assignee: Athos Ribeiro (athos)
         Status: In Progress

** Affects: python-django-postgres-extra (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: update-excuse

** Changed in: python-django (Ubuntu)
     Assignee: (unassigned) => Athos Ribeiro (athos)

** Changed in: python-django (Ubuntu)
       Status: New => In Progress

** Also affects: python-django-postgres-extra (Ubuntu)
   Importance: Undecided
       Status: New

** Also affects: postgresql-common (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2136172

Title:
  python-django-postgres-extra DEP8 failures with postgresql-18

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/postgresql-common/+bug/2136172/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to