summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/vpp_papi_provider.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index c21d8c2a8b0..2188ed3c041 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -174,11 +174,15 @@ class VppPapiProvider(object):
return self.api(apifn, d)
return f
- def __getattr__(self, name):
+ def __getattribute__(self, name):
try:
- return getattr(self, name)
- except:
- return self.factory(name, getattr(self.papi, name))
+ method = super(VppPapiProvider, self).__getattribute__(name)
+ except AttributeError:
+ method = self.factory(name, getattr(self.papi, name))
+ # lazily load the method so we don't need to call factory
+ # again for this name.
+ setattr(self, name, method)
+ return method
def connect(self):
"""Connect the API to VPP"""