On Thu, 2009-11-26 at 20:23 +0800, Russell Keith-Magee wrote:
> On Thu, Nov 26, 2009 at 5:03 PM, Jani Tiainen <[email protected]> wrote:
> > On Thu, 2009-11-26 at 01:44 -0600, Alex Gaynor wrote:
> >> On Thu, Nov 26, 2009 at 1:42 AM, Jani Tiainen <[email protected]> wrote:
> >> > On Thu, 2009-11-26 at 01:28 -0600, Alex Gaynor wrote:
> >> >
> >> >>
> >> >> Thanks for taking the time to run all of those!  All of those
> >> >> ConnectionDoesNotExist errors come from the fact that the multidb
> >> >> tests expect you to have more than 1 DB set up in your settings file,
> >> >> the rigth solution here is probably to just fail right away, instead
> >> >> of attempting to run each individual test which can produce some
> >> >> confusing failures.  As for the other errors I'm not sure what's a
> >> >> consequence of my work, and what's an existing condition.  If you
> >> >> could run the trunk tests (with your modification for memory) and see
> >> >> what the result is that would be awesome.  Any new errors are
> >> >> obviously regressions and should be fixed.
> >> >>
> >> >> Alex
> >> >>
> >> >
> >> > I didn't have to run anything, that what computers are for..? :)
> >> >
> >> > Could you provide sample DATABASES connection definition for multidb
> >> > tests so I could rerun all that fancy stuff correctly.
> >> >
> >> > --
> >> >
> >> > Jani Tiainen
> >> >
> >> >
> >> >
> >> > --
> >> >
> >> > You received this message because you are subscribed to the Google 
> >> > Groups "Django developers" group.
> >> > To post to this group, send email to [email protected].
> >> > To unsubscribe from this group, send email to 
> >> > [email protected].
> >> > For more options, visit this group at 
> >> > http://groups.google.com/group/django-developers?hl=en.
> >> >
> >> >
> >> >
> >>
> >> DATABASES = {
> >>     "default": {
> >>         # your settings here
> >>     },
> >>     "other": {
> >>         "ENGINE": "sqlite3",
> >>         "NAME": ":memory:",
> >>     }
> >> }
> >>
> >> Is all you need (don't bother rerunning all of the tests with these
> >> settings, the only ones affected are the multiple_database ones).
> >>
> >> Alex
> >>
> >
> > ======================================================================
> > ERROR: Objects created on the default database don't leak onto other
> > databases
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >  File
> > "/home/KEYPRO/jtiai/src/multidb/tests/regressiontests/multiple_database/tests.py",
> >  line 34, in test_default_creation
> >    Book.objects.get(title="Pro Django")
> >  File "/home/KEYPRO/jtiai/src/multidb/django/db/models/manager.py",
> > line 119, in get
> >    return self.get_query_set().get(*args, **kwargs)
> >  File "/home/KEYPRO/jtiai/src/multidb/django/db/models/query.py", line
> > 307, in get
> >    % (self.model._meta.object_name, num, kwargs))
> > MultipleObjectsReturned: get() returned more than one Book -- it
> > returned 2! Lookup parameters were {'title': 'Pro Django'}
> >
> > ======================================================================
> > FAIL: Queries are constrained to a single database
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >  File
> > "/home/KEYPRO/jtiai/src/multidb/tests/regressiontests/multiple_database/tests.py",
> >  line 117, in test_basic_queries
> >    self.assertRaises(Book.DoesNotExist,
> > Book.objects.using('default').get, published__year=2009)
> > AssertionError: DoesNotExist not raised
> >
> > ======================================================================
> > FAIL: Objects created on another database don't leak onto the default
> > database
> > ----------------------------------------------------------------------
> > Traceback (most recent call last):
> >  File
> > "/home/KEYPRO/jtiai/src/multidb/tests/regressiontests/multiple_database/tests.py",
> >  line 76, in test_other_creation
> >    title="Pro Django"
> > AssertionError: DoesNotExist not raised
> >
> > ----------------------------------------------------------------------
> > Ran 12 tests in 2.778s
> >
> > Well that's all for multiple_database tests configured so that "default"
> > points to my oracle and "other" points to sqlite3 memory database.
> 
> Thanks for that Jani.  These errors are extremely unusual - it appears
> as if the test cases aren't correctly flushing the database at the
> start of the test run.
> 
> For example - the ERROR on line 34 of the test case tests that a
> single instance of a book has been created on the default database,
> but two instances are found.However, there should only be 1 book in
> the database at that point.
> 
> I can't think of any reason this would be happening, though. To help
> track this down a bit:
> 
>  * Do you get the same failures if you run those tests in isolation? i.e.,
> 
> ./runtests --settings=oracle
> multiple_databases.QueryTestCase.test_default_creation

Passed (with assertion additions, in memory sqlite)

> ./runtests --settings=oracle
> multiple_databases.QueryTestCase.test_other_creation

Passed.

> ./runtests --settings=oracle 
> multiple_databases.QueryTestCase.test_basic_queries

Passed.

> * Do you still get the same failures if you run with a file-backed
> SQLite instance, rather than an in-memory instance? (change ':memory:'
> to 'other_db' in your settings file)

Yes.

> * Do you still get the same failures if you convert QueryTestCase into
> a TransactionTestCase (i.e., change the import "from django.test
> import TestCase" to "from django.test import TransactionTestCase as
> TestCase")

All three passed in isolated tests.

> * Could you please add:
> 
> self.assertEquals(Book.objects.count(), 0)
> self.assertEquals(Book.objects.using('default').count(), 0)
> self.assertEquals(Book.objects.using('other').count(), 0)

Added these before any tests...

And full multiple_database tests with localfile sqlite3

Transactionals passed.

Without transactional tests full multiple_database tests:

======================================================================
FAIL: Queries are constrained to a single database
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/KEYPRO/jtiai/src/multidb/tests/regressiontests/multiple_database/tests.py",
 line 122, in test_basic_queries
    self.assertRaises(Book.DoesNotExist,
Book.objects.using('default').get, published__year=2009)
AssertionError: DoesNotExist not raised

======================================================================
FAIL: Objects created on the default database don't leak onto other
databases
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/KEYPRO/jtiai/src/multidb/tests/regressiontests/multiple_database/tests.py",
 line 23, in test_default_creation
    self.assertEquals(Book.objects.count(), 0)
AssertionError: 2 != 0

======================================================================
FAIL: Objects created on another database don't leak onto the default
database
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/home/KEYPRO/jtiai/src/multidb/tests/regressiontests/multiple_database/tests.py",
 line 81, in test_other_creation
    title="Pro Django"
AssertionError: DoesNotExist not raised



Hope that these helps to pinpoint problem.

-- 

Jani Tiainen


--

You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.


Reply via email to