Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Jan. 11, 2011 21:25:49

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

TestCase and fixtures


Hi!

I'm testing my application with a TestCase class, specifing "fixtures"
attribute in my class like:

class MyTestCase(TestCase):
fixtures =
....

I've created the folder "fixtures" in my directory application like:

/home/simo/Projects/myproject/myapp/fixtures/myfix.json

where myfix.json was created by "dumpdata" command, but when I execute the
command

manage.py test myapp

fixtures data don't load, and the command report "...0 fixtures
loads..." but they are load only when I rename the fixtures file
"initial_data.json". I've already read the documentation tohttp://docs.djangoproject.com/en/1.2/topics/testing/#fixture-loading.
I'm making something wrongs??

Regards,
Simone

--
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free --> Linus B. Torvalds

--
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 Jan. 11, 2011 21:33:58

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

TestCase and fixtures


It sounds like you're doing everything correctly.

Just a few thoughts:

Is your app definitely in INSTALLED_APPS in settings.py?Check typos in fixture name and filename (and include extension intest).Are you definitely using a Django TestCase instead of a unittestTestCase?If all else fails, try adding your fixture path to FIXTURE_DIRS:http://docs.djangoproject.com/en/1.2/ref/django-admin/#django-admin-loaddata--
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

#3 Jan. 11, 2011 22:37:04

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

TestCase and fixtures


Hi!
I'm testing a part of my application with a TestCase class specifing the
'fixtures' attributes like

--
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

#4 Jan. 11, 2011 23:07:13

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

TestCase and fixtures


Hi Simone

Try fixtures =

On 01/11/11 21:25, Simone Dalla wrote:
> Hi!
>
> I'm testing my application with a TestCase class, specifing "fixtures"
> attribute in my class like:
>
> class MyTestCase(TestCase):
> fixtures =

> ....
>
> I've created the folder "fixtures" in my directory application like:
>
> /home/simo/Projects/myproject/myapp/fixtures/myfix.json
>
> where myfix.json was created by "dumpdata" command, but when I execute
> the command
>
> manage.py test myapp
>
> fixtures data don't load, and the command report "...0 fixtures
> loads..." but they are load only when I rename the fixtures file
> "initial_data.json". I've already read the documentation
> tohttp://docs.djangoproject.com/en/1.2/topics/testing/#fixture-loading.
> I'm making something wrongs??
>
> Regards,
> Simone
>
> --
> Simo
>
> - Registered Linux User #395060
>
> - Software is like sex, it is better when it is free --> Linus B. Torvalds
>
> --
> 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 at
>http://groups.google.com/group/django-users?hl=en.


--
bloghttp://piotr.zalewa.infojobshttp://webdev.zalewa.infotwithttp://twitter.com/zalunfacehttp://facebook.com/zaloon--
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

#5 Jan. 12, 2011 07:29:57

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

TestCase and fixtures


2011/1/12 Piotr Zalewa <zal...@gmail.com>

> Hi Simone
>
> Try fixtures =


Thank Piotr,
I've already done but same result:

No fixtures found.
...
----------------------------------------------------------------------
Ran 3 tests in 0.419s

--
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free --> Linus B. Torvalds

--
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

#6 Jan. 12, 2011 07:40:13

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

TestCase and fixtures


Thank Shawn

2011/1/11 Shawn Milochik <sh...@milochik.com>

> It sounds like you're doing everything correctly.
>
> Just a few thoughts:
>
> Is your app definitely in INSTALLED_APPS in settings.py?
>

Yes


>
> Check typos in fixture name and filename (and include extension in
> test).
>

Are ok.


>
> Are you definitely using a Django TestCase instead of a unittest
> TestCase?
>

Yes.


>
> If all else fails, try adding your fixture path to FIXTURE_DIRS:
>
>http://docs.djangoproject.com/en/1.2/ref/django-admin/#django-admin-loaddataI've added FIXTURE_DIRS in my settings.py but same results...

This is my real initial code in file test.py:

from django.test import TestCase
from django.contrib.auth.models import User
from employee.models import Dipendente, CategoriaEconomica,
CategoriaGiuridica, Contratto
from organigramma.models import Organizzazione, UnitaOrganizzativa
from lesspaper.models import RichiestaAutorizzazioneStraordinario
from lesspaper.exceptions import AssegnamentoContrattoError

class CalcoloCostoRichistaStraordinarioTest(TestCase):
fixtures =
# fixtures =

def setUp(self):
....
....

--
Simo

- Registered Linux User #395060

- Software is like sex, it is better when it is free --> Linus B. Torvalds

--
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

#7 Jan. 12, 2011 12:29:37

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

TestCase and fixtures


On Wed, Jan 12, 2011 at 3:29 PM, Simone Dalla <simoda...@gmail.com> wrote:
> 2011/1/12 Piotr Zalewa <zal...@gmail.com>
>>
>> Hi Simone
>>
>> Try fixtures =
>
> Thank Piotr,
> I've already done but same result:
> No fixtures found.
> ...
> ----------------------------------------------------------------------
> Ran 3 tests in 0.419s
> --

Hi Simone,

Have you confirmed that the fixture can actually be loaded? That is,
can you run:

./manage.py loaddata myfix

This uses the same mechanism for discovering fixtures that a testcase
uses, but will provide more debugging information (especially if you
beef up the verbosity by using -v 2).

This will load the fixture into your non-test database, so you might
want to make sure that you are either using a temporary database, or
you don't mind the fixture being loaded.

Yours,
Russ Magee %-)

--
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

#8 Jan. 12, 2011 12:48:46

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

TestCase and fixtures


Hi,

Out of curiosity, do you run your tests in a multi database setting ?

Regards,
Xavier.

Le 11 janv. 2011 à 23:36, Simone Dalla a écrit :

> Hi!
> I'm testing a part of my application with a TestCase class specifing the
> 'fixtures' attributes like
>
>
> --
> 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 at
>http://groups.google.com/group/django-users?hl=en.

--
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 23rd of October
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