File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15+ import concurrent
1516import copy
1617import json
1718import textwrap
1819import unittest
1920
2021import mock
2122import pytest
23+ import requests
2224from six .moves import http_client
2325
2426try :
@@ -4604,6 +4606,26 @@ def test_result_error(self):
46044606 expected_line = "{}:{}" .format (i , line )
46054607 assert expected_line in full_text
46064608
4609+ def test_result_transport_timeout_error (self ):
4610+ query = textwrap .dedent (
4611+ """
4612+ SELECT foo, bar
4613+ FROM table_baz
4614+ WHERE foo == bar"""
4615+ )
4616+
4617+ client = _make_client (project = self .PROJECT )
4618+ job = self ._make_one (self .JOB_ID , query , client )
4619+ call_api_patch = mock .patch (
4620+ "google.cloud.bigquery.client.Client._call_api" ,
4621+ autospec = True ,
4622+ side_effect = requests .exceptions .Timeout ("Server response took too long." ),
4623+ )
4624+
4625+ # Make sure that timeout errors get rebranded to concurrent futures timeout.
4626+ with call_api_patch , self .assertRaises (concurrent .futures .TimeoutError ):
4627+ job .result (timeout = 1 )
4628+
46074629 def test__begin_error (self ):
46084630 from google .cloud import exceptions
46094631
You can’t perform that action at this time.
0 commit comments