If you want to wrap tf
, why do you call server_w.tf
in your tests?
That makes the wrapping kind of pointless.
If you try server_w.do_function1()
you'll see the print-statements.
I don't understand what you're trying to achieve with the type(self)(attr)
line though...
I'd try __getattr__
simply like this:
def __getattr__(self, name):
print "before"
attr = getattr(self.tf, name)
print "after"
return attr
This should properly return the function of the wrapped object.