#22988 closed Cleanup/optimization (fixed)

Test in introspection package appears to be wrong

Reported by: smeatonj Owned by: smeatonj
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

Description

A test in tests/introspection/tests.py 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 14 months ago by smeatonj

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 14 months ago by charettes

  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

The reported issue looks valid, thanks for catching this!

Left some minor comments on Github.

comment:3 Changed 14 months ago by charettes

  • Patch needs improvement unset
  • Triage Stage changed from Accepted to Ready for checkin

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

  • Resolution set to fixed
  • Status changed from assigned to closed

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