Thanks! I'll look into this. If anyone is interested in the outcome I'll submit a patch to the mako_django package I'm using. Drop a reply here if you're interested in the results.
On Nov 12, 6:24 pm, "Russell Keith-Magee" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 13, 2008 at 9:58 AM, Erik <[EMAIL PROTECTED]> wrote: > > > I am involved in a project that's using django with the mako_django > > package for template rendering. I'm working on the unit tests, but > > I'm running into the problem that the context and template are not > > returned after a query from the test client (the members in the > > response are empty). I'm assuming that the reason for this is that > > I'm using a non standard template system, and I was wondering if there > > is a good way to add the full testing support to another template > > language. > > > Can anyone give me some advice about how to get the test framework > > working with an alternate template system? > > The Django test client logs templates and contexts by adding signal > handlers during the setup phase of the test process. This setup phase > instruments the Django template language so that whenever a template > is rendered, a signal is fired; the test client listens for that > signal, and the the template and context detail is saved for later > use. > > If you are using a different template language, you will need to > provide similar instrumentation. As long as your template language > uses the a "template + context" approach to rendering, you should be > able to use the same signal. The instrumentation is defined in > django/test/utils.py. instrumented_test_render() is the instrumented > rendering mechanism; it is installed using setup_test_environment(), > and removed again using teardown_test_environment(); these methods are > invoked as part of the Django test runner. > > If you write your own setup/teardown, you can install your own > instrumentation; you then need to define a custom test runner that > will invoke your own setup and teardown scheme. This process of > integrating custom setup/teardown processes is certainly something > that could be optimized; I'm open to any suggestions as to how it > could be improved (I have a few ideas, but I'd like to hear opinions > from a fresh mind before I introduce them). > > 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 [email protected] 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 -~----------~----~----~----~------~----~------~--~---

