88import re
99import time
1010import unittest
11+ import unittest .mock
1112import urllib .error
1213
13- from . import mock
14-
1514import shotgun_api3 as api
1615from shotgun_api3 .shotgun import ServerCapabilities
1716from shotgun_api3 .lib import six
@@ -133,12 +132,12 @@ def _setup_mock(self, s3_status_code_error=503):
133132 """Setup mocking on the ShotgunClient to stop it calling a live server"""
134133 # Replace the function used to make the final call to the server
135134 # eaiser than mocking the http connection + response
136- self .sg ._http_request = mock .Mock (
135+ self .sg ._http_request = unittest . mock .Mock (
137136 spec = api .Shotgun ._http_request , return_value = ((200 , "OK" ), {}, None )
138137 )
139138 # Replace the function used to make the final call to the S3 server, and simulate
140139 # the exception HTTPError raised with 503 status errors
141- self .sg ._make_upload_request = mock .Mock (
140+ self .sg ._make_upload_request = unittest . mock .Mock (
142141 spec = api .Shotgun ._make_upload_request ,
143142 side_effect = urllib .error .HTTPError (
144143 "url" ,
@@ -152,12 +151,12 @@ def _setup_mock(self, s3_status_code_error=503):
152151 # also replace the function that is called to get the http connection
153152 # to avoid calling the server. OK to return a mock as we will not use
154153 # it
155- self .mock_conn = mock .Mock (spec = api .lib .httplib2 .Http )
154+ self .mock_conn = unittest . mock .Mock (spec = api .lib .httplib2 .Http )
156155 # The Http objects connection property is a dict of connections
157156 # it is holding
158157 self .mock_conn .connections = dict ()
159158 self .sg ._connection = self .mock_conn
160- self .sg ._get_connection = mock .Mock (return_value = self .mock_conn )
159+ self .sg ._get_connection = unittest . mock .Mock (return_value = self .mock_conn )
161160
162161 # create the server caps directly to say we have the correct version
163162 self .sg ._server_caps = ServerCapabilities (
@@ -173,7 +172,7 @@ def _mock_http(self, data, headers=None, status=None):
173172 """
174173 # test for a mock object rather than config.mock as some tests
175174 # force the mock to be created
176- if not isinstance (self .sg ._http_request , mock .Mock ):
175+ if not isinstance (self .sg ._http_request , unittest . mock .Mock ):
177176 return
178177
179178 if not isinstance (data , str ):
0 commit comments