From 90399f9fe92e4a3096559c4ceeced776b426091b Mon Sep 17 00:00:00 2001 From: JingLiu Date: Thu, 22 Dec 2016 17:37:36 +0800 Subject: Replace method attr in vars() to hasattr As ChangBo Guo(gcb) said in review https://review.openstack.org/#/c/359786, 'hasattr' has less cost than 'vars'. Repair it in another place. Change-Id: Ib13767be8377f536a9d82e54a6e7af8b6a8a1604 --- oslo_log/tests/unit/test_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oslo_log/tests/unit/test_log.py b/oslo_log/tests/unit/test_log.py index e0c254f..12f04bd 100644 --- a/oslo_log/tests/unit/test_log.py +++ b/oslo_log/tests/unit/test_log.py @@ -1416,7 +1416,7 @@ class LogConfigTestCase(BaseTestCase): super(LogConfigTestCase, self).setUp() names = self.create_tempfiles([('logging', MIN_LOG_INI)]) self.log_config_append = names[0] - if 'old_time' in vars(log._load_log_config): + if hasattr(log._load_log_config, 'old_time'): del log._load_log_config.old_time def test_log_config_append_ok(self): -- cgit v1.2.1