Re: Difference between sqlite3 and mysql backend on test code involving generic relationships

2008-09-25 Thread Oliver Andrich
Well, it seems to happen, when the post_syncdb signal code from
django.contrib.auth is called. Somehow calling the code from ./manage.py
test differes from ./manage.py flush. I think I will reproduce this in a
minimal django project and try file a bug report.

Best regards,
Oliver

-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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



Re: Difference between sqlite3 and mysql backend on test code involving generic relationships

2008-09-25 Thread Oliver Andrich
I looked a bit deeper into this issue, and so far I can say, that the
exception is raised by django.test.TestCase in the method _pre_setup.
call_command('flush', verbosity=0, interactive=False) is where it
originates. Calling ./manage.py flush on the command line works like a
charm. I also have to note, that DocumentTests includes 3 tests - the first
always works while the later two always fail. But it is not depend on the
test itself, but simply on the order of the tests in the test case.

Bye, Oliver
-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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



Difference between sqlite3 and mysql backend on test code involving generic relationships

2008-09-25 Thread Oliver Andrich
Hi,

I encounter strange differences when I run my test code against sqlite3 and
against mysql. I am about to test it with Postgresql later today. My models
make heavy use of generic relationships. And everytime I run "./manage.py
test" with the mysql backend I receive the following error.

IntegrityError: (1452, 'Cannot add or update a child row: a foreign key
constraint fails (`test_redweb_crossmedia/auth_permission`, CONSTRAINT
`content_type_id_refs_id_728de91f` FOREIGN KEY (`content_type_id`)
REFERENCES `django_content_type` (`id`))')

This is one example testcode I use.

class DocumentTests(TestCase):

def setUp(self):
self.user = User.objects.get_or_create(username='test',
password='test')[0]

def test_creation_of_attachments_and_the_manager(self):
test_document = File(open(path.join(BASEDIR, 'test.pdf'), 'rb'))
doc = Document(content_object=self.user, created_by=self.user)
doc.file.save('test.pdf', test_document)
[...]
doc.delete()

I get_or_create an user, create some kind of attachment class, setup a
generic relationship between both and thats it. In sqlite3 this works like a
charm. Can anybody drop me a helpful tip? The app itself works like
expected, but I would appreciate to have working testcode. :)

Best regards,
Oliver

-- 
Oliver Andrich <[EMAIL PROTECTED]> --- http://oliverandrich.net/

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