Skip to content

Commit b65ac12

Browse files
committed
python3: convert dict keys to a list
In Python 3.x, dict.keys() does not return a list, it returns an iterable (specifically, a dictionary view). Use list(dict) to make code compatible with both versions. Part of #20
1 parent fbb715c commit b65ac12

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/tarantool_server.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ def __init__(self, _ini=None, test_suite=None):
657657
# or passed through execfile() for PythonTest
658658
self.current_test = None
659659
caller_globals = inspect.stack()[1][0].f_globals
660-
if 'test_run_current_test' in caller_globals.keys():
660+
if 'test_run_current_test' in list(caller_globals):
661661
self.current_test = caller_globals['test_run_current_test']
662662

663663
def __del__(self):

lib/test_suite.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def collect_tests(self):
179179
return self.tests
180180

181181
def get_fragile_list(self):
182-
return self.fragile['tests'].keys()
182+
return list(self.fragile['tests'])
183183

184184
def stable_tests(self):
185185
self.collect_tests()

lib/worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def task_get(self, task_queue):
287287

288288
@staticmethod
289289
def is_joinable(task_queue):
290-
return 'task_done' in task_queue.__dict__.keys()
290+
return 'task_done' in list(task_queue.__dict__)
291291

292292
def restart_server(self):
293293
self.stop_server(cleanup=False)

0 commit comments

Comments
 (0)