Skip to content

Commit bcfe2be

Browse files
cojencotseaver
andauthored
Skip test case stdlib ConnectionError on Python 2
Co-authored-by: Tres Seaver <tseaver@palladion.com>
1 parent 14706e7 commit bcfe2be

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tests/unit/test_retry.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,13 @@ def test_w_requests_connection_error(self):
5959
exc = ValueError("testing")
6060
self.assertFalse(self._call_fut(exc))
6161

62+
@unittest.skipUnless(
63+
"ConnectionError" in __builtins__.__dict__,
64+
"No builtin 'ConnectionError' in Python 2",
65+
)
6266
def test_w_stdlib_connection_error(self):
63-
from google.cloud.storage import retry
64-
65-
try:
66-
exc = ConnectionError()
67-
self.assertTrue(self._call_fut(exc))
68-
self.assertTrue(ConnectionError in retry._RETRYABLE_TYPES)
69-
except NameError:
70-
pass
71-
67+
exc = ConnectionError()
68+
self.assertTrue(self._call_fut(exc))
7269

7370
class TestConditionalRetryPolicy(unittest.TestCase):
7471
def _make_one(self, retry_policy, conditional_predicate, required_kwargs):

0 commit comments

Comments
 (0)