From 4d0276d9d964c8420e550d7846b8a0b2930bb5ba Mon Sep 17 00:00:00 2001 From: zhanggang Date: Tue, 11 Apr 2017 04:09:15 -0400 Subject: [PATCH] Unuse an undefined local variable 'name'. trove/tests/utils/users.py: _find_user_by_condition In expect code, the error message use an undefined variable 'name' and this will raise a NameError. Change-Id: I05cc16f865ef2ca73466aa165284975964680f8a Closes-Bug: 1681309 --- trove/tests/util/users.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trove/tests/util/users.py b/trove/tests/util/users.py index 7492907242..c8ef5e4f8e 100644 --- a/trove/tests/util/users.py +++ b/trove/tests/util/users.py @@ -118,7 +118,7 @@ class Users(object): try: user = min(users, key=lambda user: user.test_count) except ValueError: - raise RuntimeError('Did not find a user with name "%s".' % name) + raise RuntimeError('Did not find a user with specified condition') user.test_count += 1 return user @@ -128,5 +128,6 @@ class Users(object): return self._find_user_by_condition(condition) def find_user_by_tenant_id(self, tenant_id): + """Finds a user who meets the requirements and has been used least.""" condition = lambda user: user.tenant_id == tenant_id return self._find_user_by_condition(condition)