On Nov 28, 1:21 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On Thu, Nov 27, 2008 at 11:21 AM, Julien Phalip <[EMAIL PROTECTED]> wrote:
>
> > I'm keen to try to find some proper ways to fix this, but before I go
> > too deep into the bowels of Django's testing framework, I was
> > wondering what would be the criticisms you'd have about the "solution"
> > I came up with (at the start of this thread)? It sort of works without
> > patching Django, but is it acceptable? and if not, why?
>
> > At this stage, it looks good enough to me except for two main points
> > that feel dirty:
> > 1) the test models should be unloaded after the test is run
> > 2) potential conflicts with external apps should be avoided.
>
> I will openly admit that I haven't given this much though, except in
> the abstract. I'm certain that there are many details and gotchas that
> I haven't thought of that implementation will reveal.
>
> Broadly speaking, I'm happy with the approach you are suggesting. The
> interface needs some work, though. I'd like to think that at an API
> level, it could be as simple as:
>
> class MyMetaTest(TestCase):
>     apps = ['fakeapp','otherapp']
>
>     def test_stuff(self):
>       ...
>
> where 'fakeapp' et al are submodules of the test module that contain a
> models.py definition. Obviously, the test applications need to be:
>  - Added to INSTALLED APPS and the app cache on startup
>  - Installed in the app cache before the syncdb caused by the pre-test
> database flush takes effect. You shouldn't need to manually invoke
> syncdb.
>  - Removed from INSTALLED_APPS and the app cache on teardown
>
> I'm of two minds as to whether apps should define a complete
> replacement for INSTALLED_APPS, or if it should be a supplement to the
> INSTALLED_APPS that already exists for the project. This hits up
> against the recurring issue of testing as a per-app process vs testing
> as a project integration process.
>
> The name clash problem you describe shouldn't be that big an issue -
> you have the django-admin model validation tools at your disposal. You
> will probably want to put in some checks to make sure that validation
> only gets called once (so that you're not needlessly revalidating),
> but the validator should pick out any name clashes or other conflicts.
>
> Russ %-)

Thanks a lot for the feedback and pointers. I'll think about it over
the next few days and will try to post a first sketch patch in the
ticket.
--~--~---------~--~----~------------~-------~--~----~
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