Re: unit tests: database confusion

2010-05-12 Thread Phlip
> Hi jararaca
>               Can u brief me the solution.Even i am not able to access test
> database ,some how it fetch production database itself

Hear galloping, think horses not zebras.

are y'all running your test batch like this?

  python manage.py test --settings=test_settings.py

does test_settings.py contain only correct DATABASE settings?

If u ran python manage.py shell --settings=test_settings.py

  > from django.conf import settings
  > print settings.__dict__

what settings do u see?

-- 
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: unit tests: database confusion

2010-05-12 Thread gulle



jararaca wrote:
> 
> 
> Thanks Russ, I don't have a stray settings-file but I've spotted the
> problem now: One of my files with custom SQL for the models contained
> the line USE xy; (with xy being my database, argh!). So everything
> before the execution of this line used my test database correctly but
> all later commands were executed on the real database.
> 
> Happy testing to all of you,
> micha
> 
>> > But the strangest part is yet to come: When testing, it is obviously
>> > always my "real" database that is being read, not the 'test_xy'
>> > database, even if I change DATABASE_NAME in settings!
> 
> 
> --~--~-~--~~~---~--~~
> 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-unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en
> -~--~~~~--~~--~--~---
> 
> 
> 

Hi jararaca
  Can u brief me the solution.Even i am not able to access test
database ,some how it fetch production database itself

regards,
//g


-- 
View this message in context: 
http://old.nabble.com/unit-tests%3A-database-confusion-tp10737510p28536896.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
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: unit tests: database confusion

2007-05-23 Thread jararaca

Thanks Russ, I don't have a stray settings-file but I've spotted the
problem now: One of my files with custom SQL for the models contained
the line USE xy; (with xy being my database, argh!). So everything
before the execution of this line used my test database correctly but
all later commands were executed on the real database.

Happy testing to all of you,
micha

> > But the strangest part is yet to come: When testing, it is obviously
> > always my "real" database that is being read, not the 'test_xy'
> > database, even if I change DATABASE_NAME in settings!


--~--~-~--~~~---~--~~
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: unit tests: database confusion

2007-05-22 Thread Russell Keith-Magee

On 5/22/07, jararaca <[EMAIL PROTECTED]> wrote:
>
> A short while ago I had my unit tests up and running, including
> reading some objects from a fixture. Today I've tried to run the tests
> again (calling 'manage.py test' just as I did before). Now the test
> database is created as I can see using the MySQL Frontend, but the
> objects from the fixture never show up there - in spite of the command
> line output telling me they have been installed. Furthermore I get
> lots of errors like "Failed to install index for ... 'Duplicate key
> name...'".

The only cause I can think of for this level of confusion would be a
stray settings file somewhere. The settings file is just another
python file; if there are multiple settings.py files on your
PYTHONPATH, you could get data put into unexpected databases, etc.

> But the strangest part is yet to come: When testing, it is obviously
> always my "real" database that is being read, not the 'test_xy'
> database, even if I change DATABASE_NAME in settings!

I have no idea why it would write to the real database, unless your
stray settings file contained a TEST_DATABASE_NAME value that was the
same as your DATABASE_NAME.

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



unit tests: database confusion

2007-05-22 Thread jararaca

A short while ago I had my unit tests up and running, including
reading some objects from a fixture. Today I've tried to run the tests
again (calling 'manage.py test' just as I did before). Now the test
database is created as I can see using the MySQL Frontend, but the
objects from the fixture never show up there - in spite of the command
line output telling me they have been installed. Furthermore I get
lots of errors like "Failed to install index for ... 'Duplicate key
name...'".
But the strangest part is yet to come: When testing, it is obviously
always my "real" database that is being read, not the 'test_xy'
database, even if I change DATABASE_NAME in settings!
This is so weird. Do you have any idea what might have gone wrong?

Micha


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