On Tue, 2007-05-29 at 09:27 +0200, Sandro Dentella wrote:
> > > Do we need such a settings or we really need to *copy* database encoding 
> > > so
> > > that tests are done exactly as the application database. (if it's possible
> > > to use other than utf8...).
> > 
> > That assumes there is an application database to copy and/or that is
> > configured sensibly. It's a bit of a wart that DATABASE_NAME is required
> > at all in the test settings file -- it's just that it's woven pretty
> > deeply into various places in the code. For fun, somebody could look
> > into fixing that; it would only take an hour or so for somebody with
> > reasonable Pyhthon familiarity and not much Django internals
> > familiarity, I would guess.
> > 
> > Short verison: tests should be as independent and run in as uniform an
> > environment as possible.
> 
> Well I may be thinking at a different use case... but when you run
> 'manage.py test' you *do* have a project configured, don't you?

Not necessarily for production setup and usually not with my production
settings file. I will typically be running the tests on my development
machines, far away from any production installation.

> 
> > The test framework can't realistically  insulate people against mistakes
> > they make outside of Django. You create test databases much more often
> > than project databases (unless you don't run your tests). So I'm -1 on
> > trying to do anything like this.
> 
> I consider this a slippery situation. I forsee many cases in which
> application db and test db will be different and a simple check in
> run_test/create_test_db could prevent people from scratchind their head to
> understand why tests pass and application raises DecodeError... as has been
> in this same thread around message 25.

Since the tests won't have access to production setups in realistic
situations (development doesn't happen on production machines), this
isn't possible to enforce.

Fortunately, the good news is that if somebody like you wants to enforce
this equivalence because you are working with access to your production
db all the time, you can easily extract the necessary settings for the
tests from your production settings. It's just Python code underneath,
after all. You can do whatever you like in settings.py.

Regards,
Malcolm



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

Reply via email to