11308: Futurize test_arv_get.py and commands/get.py
authorTom Clegg <tom@curoverse.com>
Fri, 14 Apr 2017 17:52:57 +0000 (13:52 -0400)
committerTom Clegg <tom@curoverse.com>
Fri, 14 Apr 2017 19:12:12 +0000 (15:12 -0400)
sdk/python/arvados/commands/get.py
sdk/python/tests/test_arv_get.py

index 72d099d06dc2f1000146e7dc67311e5add05763d..57e48e0f9ab804fd16dc9487c8eea96937b307e2 100755 (executable)
@@ -265,7 +265,7 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
 
 def files_in_collection(c):
     # Sort first by file type, then alphabetically by file path.
-    for i in sorted(c.keys(),
+    for i in sorted(list(c.keys()),
                     key=lambda k: (
                         isinstance(c[k], arvados.collection.Subcollection),
                         k.upper())):
index d89231776683cf82c1037bdbc52a79d7916c72b2..49036393f2ddbd5f5be74807dd69b49b7bf60adf 100644 (file)
@@ -1,6 +1,5 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
+from __future__ import absolute_import
+from future.utils import listitems
 import io
 import shutil
 import tempfile
@@ -8,9 +7,9 @@ import tempfile
 import arvados
 import arvados.collection as collection
 import arvados.commands.get as arv_get
-import run_test_server
+from . import run_test_server
 
-from arvados_testutil import redirected_streams
+from .arvados_testutil import redirected_streams
 
 class ArvadosGetTestCase(run_test_server.TestCaseWithServers):
     MAIN_SERVER = {}
@@ -32,7 +31,7 @@ class ArvadosGetTestCase(run_test_server.TestCaseWithServers):
                                   'subdir/baz.txt' : 'baz',
                               }):
         c = collection.Collection()
-        for path, data in contents.items():
+        for path, data in listitems(contents):
             with c.open(path, 'w') as f:
                 f.write(data)
         c.save_new()