Hi again Malcolm,

I think making assertions in the test client is wrong for most situations, 
though I can't (of course) say much about your specific case; so I'm -1 on 
adding the testcase as a client initializer argument (this would send the 
message that such things are encouraged).

However, note that the only use of the client_class attribute in the Django 
code is in the simple invocation:

        self.client = self.client_class()

which means you can achieve your goal, with no change to Django code, using 
this (admittedly, a little abusive) hack:

class MyTestBase(TestCase):

        def client_class(self):
                return MyTestClient(self)

If your own code refers to self.client_class and expects to have access to its 
attributes, you can still arrange it with a little more effort (an elaborate 
and transparent way, using a descriptor, and a simple way, using another 
attribute, are both left as an exercise to the reader).

HTH,
        Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to