SG-41115 more changes #426
Build #20251114.2 had test failures
Details
- Failed: 45 (2.19%)
- Passed: 2,007 (97.81%)
- Other: 0 (0.00%)
- Total: 2,052
- 1461 of 1894 lines covered (77.14%)
Annotations
Check failure on line 248 in Build log
azure-pipelines / python-api
Build log #L248
5 test(s) failed, 228 test(s) collected.
Check failure on line 610 in Build log
azure-pipelines / python-api
Build log #L610
Bash exited with code '1'.
Check failure on line 248 in Build log
azure-pipelines / python-api
Build log #L248
5 test(s) failed, 228 test(s) collected.
Check failure on line 611 in Build log
azure-pipelines / python-api
Build log #L611
Bash exited with code '1'.
Check failure on line 1 in tests/test_client.py::TestShotgunClient::test_call_rpc
azure-pipelines / python-api
tests/test_client.py::TestShotgunClient::test_call_rpc
self = <tests.test_client.TestShotgunClient testMethod=test_call_rpc>
def test_call_rpc(self):
"""Named rpc method is called and results handled"""
d = {"no-results": "data without a results key"}
self._mock_http(d)
rv = self.sg._call_rpc("no-results", None)
self._assert_http_method("no-results", None)
expected = "rpc response without results key is returned as-is"
self.assertEqual(d, rv, expected)
d = {"results": {"singleton": "result"}}
self._mock_http(d)
rv = self.sg._call_rpc("singleton", None)
self._assert_http_method("singleton", None)
expected = "rpc response with singleton result"
self.assertEqual(d["results"], rv, expected)
d = {"results": ["foo", "bar"]}
a = {"some": "args"}
self._mock_http(d)
rv = self.sg._call_rpc("list", a)
self._assert_http_method("list", a)
expected = "rpc response with list result"
self.assertEqual(d["results"], rv, expected)
d = {"results": ["foo", "bar"]}
a = {"some": "args"}
self._mock_http(d)
rv = self.sg._call_rpc("list-first", a, first=True)
self._assert_http_method("list-first", a)
expected = "rpc response with list result, first item"
self.assertEqual(d["results"][0], rv, expected)
# Test payload encoding with non-ascii characters (using utf-8 literal)
d = {"results": ["foo", "bar"]}
a = {
"utf_literal": "\xe2\x88\x9a",
}
self._mock_http(d)
rv = self.sg._call_rpc("list", a)
expected = "rpc response with list result"
self.assertEqual(d["results"], rv, expected)
# Test that we raise on a 5xx. This is ensuring the retries behavior
# in place specific to 5xx responses still eventually ends up raising.
# 502
d = {"results": ["foo", "bar"]}
a = {"some": "args"}
self._mock_http(d, status=(502, "bad gateway"))
self.assertRaises(api.ProtocolError, self.sg._call_rpc, "list", a)
self.assertEqual(
> self.sg.MAX_ATTEMPTS,
self.sg._http_request.call_count,
f"Call is repeated up to {self.sg.MAX_ATTEMPTS} times",
)
E AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
tests/test_client.py:431: AttributeError
Raw output
/home/vsts/work/1/s/tests/test_client.py:431: AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
Check failure on line 1 in tests/test_client.py::TestShotgunClient::test_upload_s3_500
azure-pipelines / python-api
tests/test_client.py::TestShotgunClient::test_upload_s3_500
self = <tests.test_client.TestShotgunClient testMethod=test_upload_s3_500>
def test_upload_s3_500(self):
"""
Test 500 response is retried when uploading to S3.
"""
self._setup_mock(s3_status_code_error=500)
this_dir, _ = os.path.split(__file__)
storage_url = "http://foo.com/"
path = os.path.abspath(
os.path.expanduser(os.path.join(this_dir, "sg_logo.jpg"))
)
# Expected HTTPError exception error message
expected = (
"The server is currently down or to busy to reply."
"Please try again later."
)
# Test the Internal function that is used to upload each
# data part in the context of multi-part uploads to S3, we
# simulate the HTTPError exception raised with 503 status errors
with self.assertRaises(api.ShotgunError, msg=expected):
self.sg._upload_file_to_storage(path, storage_url)
# Test the max retries attempt
self.assertTrue(
> self.sg.MAX_ATTEMPTS == self.sg._make_upload_request.call_count,
f"Call is repeated up to {self.sg.MAX_ATTEMPTS} times",
)
E AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
tests/test_client.py:496: AttributeError
Raw output
/home/vsts/work/1/s/tests/test_client.py:496: AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
Check failure on line 1 in tests/test_client.py::TestShotgunClient::test_upload_s3_503
azure-pipelines / python-api
tests/test_client.py::TestShotgunClient::test_upload_s3_503
self = <tests.test_client.TestShotgunClient testMethod=test_upload_s3_503>
def test_upload_s3_503(self):
"""
Test 503 response is retried when uploading to S3.
"""
this_dir, _ = os.path.split(__file__)
storage_url = "http://foo.com/"
path = os.path.abspath(
os.path.expanduser(os.path.join(this_dir, "sg_logo.jpg"))
)
# Expected HTTPError exception error message
expected = (
"The server is currently down or to busy to reply."
"Please try again later."
)
# Test the Internal function that is used to upload each
# data part in the context of multi-part uploads to S3, we
# simulate the HTTPError exception raised with 503 status errors
with self.assertRaises(api.ShotgunError, msg=expected):
self.sg._upload_file_to_storage(path, storage_url)
# Test the max retries attempt
self.assertTrue(
> self.sg.MAX_ATTEMPTS == self.sg._make_upload_request.call_count,
f"Call is repeated up to {self.sg.MAX_ATTEMPTS} times",
)
E AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
tests/test_client.py:469: AttributeError
Raw output
/home/vsts/work/1/s/tests/test_client.py:469: AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
azure-pipelines / python-api
tests/test_client.py::TestShotgunClient::test_upload_s3_urlerror__get_attachment_upload_info
self = <tests.test_client.TestShotgunClient testMethod=test_upload_s3_urlerror__get_attachment_upload_info>
def test_upload_s3_urlerror__get_attachment_upload_info(self):
"""
Test URLError response is retried when invoking _send_form
"""
mock_opener = unittest.mock.Mock()
mock_opener.return_value.open.side_effect = urllib.error.URLError(
"[WinError 10054] An existing connection was forcibly closed by the remote host"
)
self.sg._build_opener = mock_opener
this_dir, _ = os.path.split(__file__)
path = os.path.abspath(
os.path.expanduser(os.path.join(this_dir, "sg_logo.jpg"))
)
with self.assertRaises(api.ShotgunError) as cm:
self.sg._get_attachment_upload_info(False, path, False)
# Test the max retries attempt
self.assertEqual(
> self.sg.MAX_ATTEMPTS,
mock_opener.return_value.open.call_count,
f"Call is repeated up to {self.sg.MAX_ATTEMPTS} times",
)
E AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'
tests/test_client.py:519: AttributeError
Raw output
/home/vsts/work/1/s/tests/test_client.py:519: AttributeError: 'Shotgun' object has no attribute 'MAX_ATTEMPTS'