21356: Remove all Python 2/3 compatibility imports
[arvados.git] / sdk / python / tests / test_collections.py
index 8986cf225840054bc5cd4161f7edd0b2c3f58b32..5d574856dd2b5610dca2fb58aaf2dcf68b38165e 100644 (file)
@@ -2,12 +2,8 @@
 #
 # SPDX-License-Identifier: Apache-2.0
 
-from __future__ import absolute_import
-
-from builtins import object
 import arvados
 import copy
-import mock
 import os
 import random
 import re
@@ -18,6 +14,8 @@ import time
 import unittest
 import parameterized
 
+from unittest import mock
+
 from . import run_test_server
 from arvados._ranges import Range, LocatorAndRange
 from arvados.collection import Collection, CollectionReader
@@ -323,6 +321,7 @@ class ArvadosCollectionsTest(run_test_server.TestCaseWithServers,
     class MockKeep(object):
         def __init__(self, content, num_retries=0):
             self.content = content
+            self.num_prefetch_threads = 1
 
         def get(self, locator, num_retries=0, prefetch=False):
             return self.content[locator]
@@ -538,11 +537,11 @@ class CollectionReaderTestCase(unittest.TestCase, CollectionTestMixin):
         self.mock_get_collection(client, status, 'foo_file')
         return client
 
-    def test_init_no_default_retries(self):
+    def test_init_default_retries(self):
         client = self.api_client_mock(200)
         reader = arvados.CollectionReader(self.DEFAULT_UUID, api_client=client)
         reader.manifest_text()
-        client.collections().get().execute.assert_called_with(num_retries=0)
+        client.collections().get().execute.assert_called_with(num_retries=10)
 
     def test_uuid_init_success(self):
         client = self.api_client_mock(200)
@@ -592,7 +591,7 @@ class CollectionReaderTestCase(unittest.TestCase, CollectionTestMixin):
         # Ensure stripped_manifest() doesn't mangle our manifest in
         # any way other than stripping hints.
         self.assertEqual(
-            re.sub('\+[^\d\s\+]+', '', nonnormal),
+            re.sub(r'\+[^\d\s\+]+', '', nonnormal),
             reader.stripped_manifest())
         # Ensure stripped_manifest() didn't mutate our reader.
         self.assertEqual(nonnormal, reader.manifest_text())