Python3: do not use im_self/im_func/func_closure

One should use __self__, __func__ and __closure__ instead, as they work
with both Python 2 and 3.

Change-Id: I2b2847cfd5b4fa70e45387ff369240227ce9e526
Blueprint: neutron-python3
This commit is contained in:
Cyril Roelandt 2015-06-18 11:52:28 +00:00
parent 345ffb99ef
commit a4b17cbb80
2 changed files with 2 additions and 2 deletions

View File

@ -29,7 +29,7 @@ class TestCallLog(base.BaseTestCase):
def setUp(self):
super(TestCallLog, self).setUp()
self.klass = TargetKlass()
logger = self.klass.test_method.im_func.func_closure[0].cell_contents
logger = self.klass.test_method.__func__.__closure__[0].cell_contents
self.log_debug = mock.patch.object(logger, 'debug').start()
def _test_call_log(self, *args, **kwargs):

View File

@ -418,7 +418,7 @@ class TestCachingDecorator(base.BaseTestCase):
self.func_name = '%(module)s._CachingDecorator.func' % {
'module': self.__module__
}
self.not_cached = self.decor.func.func.im_self._not_cached
self.not_cached = self.decor.func.func.__self__._not_cached
def test_cache_miss(self):
expected_key = (self.func_name, 1, 2, ('foo', 'bar'))