X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cd708c67b92f2c094e33584bb1fc2c6b4640fb90..0b8673b62cd9717fcf7e3bbb608ae07018093d6f:/sdk/python/tests/test_errors.py diff --git a/sdk/python/tests/test_errors.py b/sdk/python/tests/test_errors.py index 5b32da7c4f..968ce98897 100644 --- a/sdk/python/tests/test_errors.py +++ b/sdk/python/tests/test_errors.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python - from __future__ import absolute_import import traceback import unittest @@ -49,18 +47,22 @@ class KeepRequestErrorTestCase(unittest.TestCase): message = "test plain traceback string" test_exc = arv_error.KeepRequestError(message) exc_report = self.traceback_str(test_exc) - self.assertRegex(exc_report, r"^KeepRequestError: ") + self.assertRegex(exc_report, r"^(arvados\.errors\.)?KeepRequestError: ") self.assertIn(message, exc_report) def test_traceback_str_with_request_errors(self): message = "test traceback shows Keep services" test_exc = arv_error.KeepRequestError(message, self.REQUEST_ERRORS[:]) exc_report = self.traceback_str(test_exc) - self.assertRegex(exc_report, r"^KeepRequestError: ") - for expect_substr in [message, "raised IOError", "raised MemoryError", - "test MemoryError", "second test IOError", - "responded with 500 Internal Server Error"]: - self.assertIn(expect_substr, exc_report) + self.assertRegex(exc_report, r"^(arvados\.errors\.)?KeepRequestError: ") + self.assertIn(message, exc_report) + for expect_re in [ + r"raised (IOError|OSError)", # IOError in Python2, OSError in Python3 + r"raised MemoryError", + r"test MemoryError", + r"second test IOError", + r"responded with 500 Internal Server Error"]: + self.assertRegex(exc_report, expect_re) # Assert the report maintains order of listed services. last_index = -1 for service_key, _ in self.REQUEST_ERRORS: