Re: TestCase and fixtures

2011-01-12 Thread Xavier Ordoquy
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 at 
http://groups.google.com/group/django-users?hl=en.



Re: TestCase and fixtures

2011-01-12 Thread Russell Keith-Magee
On Wed, Jan 12, 2011 at 3:29 PM, Simone Dalla  wrote:
> 2011/1/12 Piotr Zalewa 
>>
>> Hi Simone
>>
>> Try fixtures = ['myfix']
>
> 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 at 
http://groups.google.com/group/django-users?hl=en.



Re: TestCase and fixtures

2011-01-11 Thread Simone Dalla
Thank Shawn

2011/1/11 Shawn Milochik 

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


I'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 = ['myfix',]
# fixtures = ['myfix.json',]

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 at 
http://groups.google.com/group/django-users?hl=en.



Re: TestCase and fixtures

2011-01-11 Thread Simone Dalla
2011/1/12 Piotr Zalewa 

> Hi Simone
>
> Try fixtures = ['myfix']


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 at 
http://groups.google.com/group/django-users?hl=en.



Re: TestCase and fixtures

2011-01-11 Thread Piotr Zalewa
Hi Simone

Try fixtures = ['myfix']

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 = ['myfix.json']

> 
> 
> 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
> to http://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.


-- 
blog  http://piotr.zalewa.info
jobs  http://webdev.zalewa.info
twit  http://twitter.com/zalun
face  http://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 at 
http://groups.google.com/group/django-users?hl=en.



TestCase and fixtures

2011-01-11 Thread Simone Dalla
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.



Re: TestCase and fixtures

2011-01-11 Thread Shawn Milochik

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 in 
test).


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


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 at 
http://groups.google.com/group/django-users?hl=en.



TestCase and fixtures

2011-01-11 Thread Simone Dalla
Hi!

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

class MyTestCase(TestCase):
fixtures = ['myfix.json']


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 to
http://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.