#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 <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/074.caa38fb2e740015b6ae97a723421e0ac%40djangoproject.com.