Re: [Django] #15691: TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.

37 views
Skip to first unread message

Django

unread,
Sep 9, 2011, 7:11:02 PM9/9/11
to django-...@googlegroups.com
#15691: TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.
------------------------------------+-----------------------------------
Reporter: slinkp@… | Owner: nobody
Type: Bug | Status: new
Milestone: 1.4 | Component: Testing framework
Version: 1.2 | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------+-----------------------------------
Changes (by anonymous):

* has_patch: 0 => 1
* ui_ux: => 0
* easy: => 0


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/15691#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 9, 2011, 7:41:50 PM9/9/11
to django-...@googlegroups.com
#15691: TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.
------------------------------------+-----------------------------------
Reporter: slinkp@… | Owner: nobody
Type: Bug | Status: new
Milestone: 1.4 | Component: Testing framework
Version: 1.2 | Severity: Normal
Resolution: | Keywords:
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------+-----------------------------------

Comment (by jwpeddle):

Replying to [comment:5 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.

--
Ticket URL: <https://code.djangoproject.com/ticket/15691#comment:6>

Django

unread,
Jul 12, 2013, 10:05:58 AM7/12/13
to django-...@googlegroups.com
#15691: TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.
-----------------------------------+------------------------------------

Reporter: slinkp@… | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by timo):

* needs_tests: 0 => 1


Comment:

This needs a test.

--
Ticket URL: <https://code.djangoproject.com/ticket/15691#comment:8>

Django

unread,
Jan 27, 2022, 10:17:45 AM1/27/22
to django-...@googlegroups.com
#15691: TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.
-----------------------------------+--------------------------------------
Reporter: slinkp@… | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.2
Severity: Normal | Resolution: worksforme

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* status: new => closed
* resolution: => worksforme


Comment:

This doesn't reproduce for me on latest `main`.

These settings:


{{{

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'TEST': {
'NAME': BASE_DIR / 'test_mydb',
'DEPENDENCIES': ['users'],
},
},
'users': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
'TEST': {
'NAME': BASE_DIR / 'test_users',
'DEPENDENCIES': [],
},
},
}
}}}

This model:


{{{
from django.db import models

class DefaultModel(models.Model):
name = models.TextField()
}}}

This test:


{{{
from django.test import TestCase

from .models import DefaultModel

class TheTests(TestCase):
databases = '__all__'

def test_basics(self):
o = DefaultModel(name="Default")
o.save()

o = DefaultModel(name="Users")
o.save(using="users")

d = DefaultModel.objects.get()
u = DefaultModel.objects.using('users').get()

self.assertEqual(d, u)
self.assertNotEqual(d.name, u.name)
}}}

All runs without error.

I'll upload the project zip in case someone wants to play with it.

> ...checks for circular dependencies by looking at the NAME key, ignoring
TEST_NAME if it exists...

This doesn't look right, at least how the code is now. The check compared
aliases, not `NAME` or `TEST['NAME']`.

I'll close as `worksforme` but happy to re-open if someone can provide a
reproduce.

--
Ticket URL: <https://code.djangoproject.com/ticket/15691#comment:9>

Django

unread,
Jan 27, 2022, 10:18:47 AM1/27/22
to django-...@googlegroups.com
#15691: TEST_DEPENDENCIES doesn't use TEST_NAME in circular dependency detection.
-----------------------------------+--------------------------------------
Reporter: slinkp@… | Owner: nobody
Type: Bug | Status: closed
Component: Testing framework | Version: 1.2
Severity: Normal | Resolution: worksforme
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Carlton Gibson):

* Attachment "issue15691.zip" added.

Test project trying to reproduce circa 2022.

--
Ticket URL: <https://code.djangoproject.com/ticket/15691>

Reply all
Reply to author
Forward
0 new messages