summaryrefslogtreecommitdiff
path: root/test/test_exceptions.py
diff options
context:
space:
mode:
authorBryce Boe <bbzbryce@gmail.com>2013-04-26 19:25:35 -0700
committerBryce Boe <bbzbryce@gmail.com>2013-04-26 19:37:52 -0700
commit9a2e8e0a247e5fc2fc5aba0cdec93d1cde8bfaab (patch)
tree92176ac21bad8f0fd4d8ae148b547a23d2445e74 /test/test_exceptions.py
parent7cee0a9b86f837fa59e65e2fc7a07b886a5b1548 (diff)
downloadurllib3-9a2e8e0a247e5fc2fc5aba0cdec93d1cde8bfaab.tar.gz
Add RequestError subclass to PoolError.
The former PoolError `__reduce__` method was broken as it assumed the `url` attribute was set, when in fact it was not. As per issue #174, this commit creates a `RequestError` subclass of `PoolError` and makes `MaxRetryError` and TimeoutError` a subclass of `RequestError`.
Diffstat (limited to 'test/test_exceptions.py')
-rw-r--r--test/test_exceptions.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_exceptions.py b/test/test_exceptions.py
index 3e02ca68..2ecb523c 100644
--- a/test/test_exceptions.py
+++ b/test/test_exceptions.py
@@ -1,7 +1,8 @@
import unittest
import pickle
-from urllib3.exceptions import HTTPError, MaxRetryError, LocationParseError
+from urllib3.exceptions import (HTTPError, MaxRetryError, LocationParseError,
+ ClosedPoolError, EmptyPoolError, TimeoutError)
from urllib3.connectionpool import HTTPConnectionPool
@@ -15,5 +16,12 @@ class TestPickle(unittest.TestCase):
def test_exceptions_with_objects(self):
assert pickle.dumps(HTTPError('foo'))
- assert pickle.dumps(MaxRetryError(HTTPConnectionPool('localhost'), '/', None))
+ assert pickle.dumps(MaxRetryError(HTTPConnectionPool('localhost'),
+ '/', None))
assert pickle.dumps(LocationParseError('fake location'))
+ assert pickle.dumps(ClosedPoolError(HTTPConnectionPool('localhost'),
+ None))
+ assert pickle.dumps(EmptyPoolError(HTTPConnectionPool('localhost'),
+ None))
+ assert pickle.dumps(TimeoutError(HTTPConnectionPool('localhost'),
+ '/', None))