On Tuesday, May 29, 2007, at 05:25 PM, Russell Keith-Magee
wrote:
> The only other cause I can think of would be an error
in the fixture
> file that might be getting eaten by the test process.
Does the fixture
> load ok if you run './manage.py loaddata myfixture'
(where myfixture
> is the name of you fixture)?
>
> Failing that:
> - What is your fixture called?
> - Where is it located relative to your project?
> - Can you provide a sample test case that doesn't work
for you?
>
> To answer your other question: The test case doesn't
need to have a
> setUp() method, just a fixtures=[] definition.
I only mentioned the setUp() method because I found
_pre_setup() and
assumed that it was some sort of hook related to the setUp()
method.
My fixture file is called "region.json", to match
one of my models. It
is located in a fixtures folder in the app folder. If I
rename the file
to "initial_data.json", it loads, no problem. Note
that if it can't
find the initial_data file, there is no real error, only
that the test
fails because there is no data in the table.
Doing some more digging, I found that the run() method (in
django/test/testcases.py) along with the install_fixtures()
method
never got called. Maybe just a disconnect between the 0.96
testing docs
and the code? Looking at the later changes to this file
(#5173 - rename
install_fixtures() to _pre_setup(), #5211 - rename run() to
__call__()), I added these changes and it now appears that I
get as far
as flushing the database in _pre_setup().
I now have another problem, but that is related to
"ALTER SEQUENCE" not
available for my version of Postgres (7.3, I know it's old,
but it
WORKS!). Why does get_sql_sequence_reset() use "SELECT
setval()" but
get_sql_flush() uses "ALTER SEQUENCE"? I've been
using setval() in
Postgres for so long, I wasn't even aware that they added
ALTER
SEQUENCE, .
I'll do some more hacking on this when I get to work
tomorrow and try
loaddata from the command line.
Thanks for your help Russ.
Don
--~--~---------~--~----~------------~-------~--~----~
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
django-users-unsubscribe googlegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|