Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 June 24, 2010 12:42:31

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

test database and unittesting


When i do "Animal.object.create(name="dog")" in a unittest setup no
row is added to the database, but if i do this in the normal code it
works. The temporary test database is created, but the adding of
objects does not work.

I'm totally lost as to where the error could be. side note: i also had
a problem when importing more than one model, which would result in
the test not being found by the system. I could evade this problem by
just importing the whole models.py and then accessing the objects with
"models.Animal". But all this is now in vain, seeing that nothing is
added to the database

thanks for any tips

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 June 24, 2010 14:09:13

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

test database and unittesting


This must be a django.test.Testcase bug, because the same thing
happens when i load fixtures, but not if i use unittest.Testcase

On Jun 24, 1:42 pm, Rufman <stephaneru...@gmail.com> wrote:
> When i do "Animal.object.create(name="dog")" in a unittest setup no
> row is added to the database, but if i do this in the normal code it
> works. The temporary test database is created, but the adding of
> objects does not work.
>
> I'm totally lost as to where the error could be. side note: i also had
> a problem when importing more than one model, which would result in
> the test not being found by the system. I could evade this problem by
> just importing the whole models.py and then accessing the objects with
> "models.Animal". But all this is now in vain, seeing that nothing is
> added to the database
>
> thanks for any tips

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

Board footer

Moderator control

Enjoy the 15th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support