Opened 4 years ago

Last modified 2 years ago

#15691 new Bug

TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.

Reported by: slinkp@… Owned by: nobody
Component: Testing framework Version: 1.2
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As far as I can tell, TEST_DEPENDENCIES checks for circular dependencies by looking at the NAME key, ignoring TEST_NAME if it exists.

This means that if you have some aliases that use the same NAME but different TEST_NAMEs, it will bail out reporting a circular dependency even though there isn't one. Example:

DATABASES = {
    'default': {
        'NAME': 'mydb',
         ...
        'TEST_NAME': 'test_mydb',
        'TEST_DEPENDENCIES': ['users'],
    },
    'users': {
        'NAME': 'mydb',
        ...
        'TEST_NAME': 'test_users',
        'TEST_DEPENDENCIES': [],
    },

It's reasonable to ask why you'd have multiple database configs with the same NAME. On OpenBlock we've been doing that as our default setup, because most of our dev rigs and deployments use only one physical database, but when running tests we want to be sure that multi-database setups work.

Attachments (1)

15691.diff (969 bytes) - added by jwpeddle 4 years ago.
TEST_NAME, fallback to NAME

Download all attachments as: .zip

Change History (9)

comment:1 Changed 4 years ago by slinkp@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

fwiw, our config hasn't caused any problems to date on Django 1.2.3. I noticed this problem because tests started failing if we tried upgrading to 1.2.4 or 1.2.5, and I traced it to the addition of TEST_DEPENDENCIES.

comment:2 Changed 4 years ago by lukeplant

  • Type set to Bug

comment:3 Changed 4 years ago by lukeplant

  • Severity set to Normal

comment:4 Changed 4 years ago by jacob

  • milestone set to 1.4
  • Triage Stage changed from Unreviewed to Accepted

comment:5 follow-up: Changed 4 years ago by anonymous

  • Easy pickings unset
  • Has patch set
  • UI/UX unset

test_db_signature in db/backends/[oracle/]creation.py was not using TEST_NAME. Diff attached that gives precedence to TEST_NAME, then NAME

Changed 4 years ago by jwpeddle

TEST_NAME, fallback to NAME

comment:6 in reply to: ↑ 5 Changed 4 years ago by jwpeddle

Replying to anonymous:

test_db_signature in db/backends/[oracle/]creation.py was not using TEST_NAME. Diff attached that gives precedence to TEST_NAME, then NAME

Forgot to sign my name.

comment:7 Changed 4 years ago by jacob

  • milestone 1.4 deleted

Milestone 1.4 deleted

comment:8 Changed 2 years ago by timo

  • Needs tests set

This needs a test.

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