Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 March 25, 2008 15:47:37

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

unit testing Q


Hi there ...

As a relative newcomer to Django, I recently starting looking at how best
to implement unit tests for my app. I came across this page:http://www.djangoproject.com/documentation/testing/as well as a couple of other examples online.

If I'm understanding things correctly, the unit testing framework creates
a temporary DB separate from the main DB for the purpose of running the
tests, which is then removed afterwards. For my situation, that falls
somewhere between impractical and impossible - OTOH, I do all of my
development using a sandbox DB which I very much would not mind if the
unit tests worked against.

Is it possible (and if so, how?) to point the unit tests at my sandbox DB?


--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#2 March 25, 2008 17:38:43

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

unit testing Q


Absolutely - the "making a seperate DB" is all wrapped in
"django-admin.py test" or "./manage.py test" - which does a number of
things for you. You don't have to use that at all - and just running
standard python unit tests will work against your system. You'll need
to set up your environment to use the right "django" bits - the same
as you would from using any other general python script external to
the webserver, but it works just fine.

-joe

On Tue, Mar 25, 2008 at 7:44 AM, Jeff Gentry <> wrote:
> As a relative newcomer to Django, I recently starting looking at how best
> to implement unit tests for my app. I came across this page:
>http://www.djangoproject.com/documentation/testing/> as well as a couple of other examples online.
>
> If I'm understanding things correctly, the unit testing framework creates
> a temporary DB separate from the main DB for the purpose of running the
> tests, which is then removed afterwards. For my situation, that falls
> somewhere between impractical and impossible - OTOH, I do all of my
> development using a sandbox DB which I very much would not mind if the
> unit tests worked against.
>
> Is it possible (and if so, how?) to point the unit tests at my sandbox DB?

--~--~---------~--~----~------------~-------~--~----~
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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

#3 March 26, 2008 01:17:12

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

unit testing Q


On Tue, Mar 25, 2008 at 11:44 PM, Jeff Gentry <> wrote:
>
> Hi there ...
>
> As a relative newcomer to Django, I recently starting looking at how best
> to implement unit tests for my app. I came across this page:
>http://www.djangoproject.com/documentation/testing/> as well as a couple of other examples online.
>
> If I'm understanding things correctly, the unit testing framework creates
> a temporary DB separate from the main DB for the purpose of running the
> tests, which is then removed afterwards. For my situation, that falls
> somewhere between impractical and impossible - OTOH, I do all of my
> development using a sandbox DB which I very much would not mind if the
> unit tests worked against.
>
> Is it possible (and if so, how?) to point the unit tests at my sandbox DB?

Possible - sure. You will need to write a custom test runner that
creates database connections to your 'live' database rather than the
creating and connecting to a temporary test database. Seehttp://www.djangoproject.com/documentation/testing/#defining-a-test-runnerFor details on writing a custom test runner.

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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en-~----------~----~----~----~------~----~------~--~---

Offline

Board footer

Moderator control

Enjoy the 16th 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