aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2019-03-05 04:30:04 -0800
committerOle Trøan <otroan@employees.org>2019-03-05 15:44:44 +0000
commit7ab99702a39fa630084c5100075c567ed9961da4 (patch)
treedcc435d1713614145359f3014351419f19d323c7 /test/vpp_papi_provider.py
parenta01e032f06a8c0162b3a90b9f22b902fb1937548 (diff)
Test: vpp_papi_provider. __getattr__
Replace custom __getattr__ with custom __getattribute__. Change-Id: Ib96176abc07eefedba305ed874621001a810eb0d Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/vpp_papi_provider.py')
-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"""