Opened 4 years ago

Closed 4 years ago

#22988 closed Cleanup/optimization (fixed)

Test in introspection package appears to be wrong

Reported by: jarshwah Owned by: jarshwah
Component: Database layer (models, ORM) Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


A test in tests/introspection/ appears to be wrong:

    def test_django_table_names(self):
        with connection.cursor() as cursor:
            cursor.execute('CREATE TABLE django_ixn_test_table (id INTEGER);')
            tl = connection.introspection.django_table_names()
            cursor.execute("DROP TABLE django_ixn_test_table;")
            self.assertTrue('django_ixn_testcase_table' not in tl,
                         "django_table_names() returned a non-Django table")

The assertion is checking for the non-existence of a table name that doesn't match the one just created. PR coming.

Change History (4)

comment:1 Changed 4 years ago by jarshwah

Has patch: set
Status: newassigned

comment:2 Changed 4 years ago by Simon Charette

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

The reported issue looks valid, thanks for catching this!

Left some minor comments on Github.

comment:3 Changed 4 years ago by Simon Charette

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:4 Changed 4 years ago by Simon Charette <charette.s@…>

Resolution: fixed
Status: assignedclosed

In b7455b52a07feb6cee482ecef9c1797d9b16221f:

Fixed #22988 -- Adjusted an introspection test assertion.

Also changed test to use assertNotIn.

Note: See TracTickets for help on using tickets.
Back to Top