#24680: In testing, warnings appear when loading database-specific fixtures
-------------------------------------+-------------------------------------
     Reporter:  zhang-z              |      Owner:  nobody
         Type:                       |     Status:  new
  Cleanup/optimization               |
    Component:  Core (Management     |    Version:  master
  commands)                          |   Keywords:  testing, fixtures,
     Severity:  Normal               |  database-specific, warning
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+-------------------------------------
 '''How to reproduce'''

 settings.py:

 {{{
 DATABASES = {
     'db1': {......},
     'db2': {......}
 }
 }}}

 fixtures:
 fixtures/data1.db1.json
 fixtures/data2.db2.json

 tests.py:

 {{{
 class FixtureTestCase(TestCase):
     fixtures = ['data1', 'data2']
     multi_db = True

     def test(self): pass
 }}}

 '''Expected results'''
 As stated in the doc [https://docs.djangoproject.com/en/dev/ref/django-
 admin/#database-specific-fixtures], "data1" should be loaded into "db1"
 DB, "data2" should be loaded into "db2".

 '''Real results'''
 Fixtures were loaded correctly. But there were warnings appeared:
 "UserWarning: No fixture named 'data1' found."; "UserWarning: No fixture
 named 'data2' found."

 As everything was set up as required, warnings should not appear

 '''How it happened'''
 "TestCase._fixture_setup" call "loaddata" command on all database-fixture
 combinations, like this:

 {{{
 loaddata data1 data2 database=db1
 loaddata data1 data2 database=db2
 }}}

 For "db1", "data2" is not found; and for "db2", "data1" is not found. So
 warnings raised.

 I think the implementation of "_fixture_setup" and/or "loaddata" need some
 change, to make it work perfectly

--
Ticket URL: <https://code.djangoproject.com/ticket/24680>
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.fbed3aa4bd26607a337209f153ab058c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to