Skip to content

Commit 4a99b2d

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 ee04fd1 commit 4a99b2d

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
@@ -663,7 +663,7 @@ def __init__(self, _ini=None, test_suite=None):
663663
# or passed through execfile() for PythonTest
664664
self.current_test = None
665665
caller_globals = inspect.stack()[1][0].f_globals
666-
if 'test_run_current_test' in caller_globals.keys():
666+
if 'test_run_current_test' in list(caller_globals):
667667
self.current_test = caller_globals['test_run_current_test']
668668

669669
def __del__(self):

lib/test_suite.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def collect_tests(self):
185185
return self.tests
186186

187187
def get_fragile_list(self):
188-
return self.fragile['tests'].keys()
188+
return list(self.fragile['tests'])
189189

190190
def stable_tests(self):
191191
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)