I was wondering how django.test.TestCase and the ORM interact. If I create 
a databased backed object in a TestCase, the ORM can "see" the object when 
I query for it, as expected.


from django.test import TestCase
class MyTests(TestCase):
    def test_where_is_my_obj(self):
        MyObj.objects.create(...)
        self.assert(MyObj.objects.count(), 1) # this is true as expected


But let's say I put a break point right before the assert statement. If I 
were to connect to the test database directly using let's say "mysql -u 
myuser -p test_database_that_django_made", the myobj table is empty. How 
does the ORM know about this uncommited object? And, how can I see this 
object in the database shell?

Note: I can get mysql shell to "see" myobj if I use TransactionTestCase 
instead (which proves that TestCase isn't committing?) but it's extremely 
slow compared to TestCase.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" 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].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/60a64019-e575-4c56-94df-87dd7464bb68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to