Opened 6 years ago

Last modified 3 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 Jason Peddle 5 years ago.
TEST_NAME, fallback to NAME

Download all attachments as: .zip

Change History (9)

comment:1 Changed 6 years ago by slinkp@…

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 6 years ago by Luke Plant

Type: Bug

comment:3 Changed 6 years ago by Luke Plant

Severity: Normal

comment:4 Changed 6 years ago by Jacob

milestone: 1.4
Triage Stage: UnreviewedAccepted

comment:5 Changed 5 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 5 years ago by Jason Peddle

Attachment: 15691.diff added

TEST_NAME, fallback to NAME

comment:6 in reply to:  5 Changed 5 years ago by Jason Peddle

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 5 years ago by Jacob

milestone: 1.4

Milestone 1.4 deleted

comment:8 Changed 3 years ago by Tim Graham

Needs tests: set

This needs a test.

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