|
|
7b76a2 |
Index: urllib3-1.5/test/test_collections.py
|
|
|
7b76a2 |
===================================================================
|
|
|
7b76a2 |
--- urllib3-1.5.orig/test/test_collections.py
|
|
|
7b76a2 |
+++ urllib3-1.5/test/test_collections.py
|
|
|
7b76a2 |
@@ -122,9 +122,11 @@ class TestLRUContainer(unittest.TestCase
|
|
|
7b76a2 |
def test_iter(self):
|
|
|
7b76a2 |
d = Container()
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(NotImplementedError):
|
|
|
7b76a2 |
+ def to_test():
|
|
|
7b76a2 |
for i in d:
|
|
|
7b76a2 |
self.fail("Iteration shouldn't be implemented.")
|
|
|
7b76a2 |
|
|
|
7b76a2 |
+ self.assertRaises(NotImplementedError, to_test)
|
|
|
7b76a2 |
+
|
|
|
7b76a2 |
if __name__ == '__main__':
|
|
|
7b76a2 |
unittest.main()
|
|
|
7b76a2 |
Index: urllib3-1.5/test/test_connectionpool.py
|
|
|
7b76a2 |
===================================================================
|
|
|
7b76a2 |
--- urllib3-1.5.orig/test/test_connectionpool.py
|
|
|
7b76a2 |
+++ urllib3-1.5/test/test_connectionpool.py
|
|
|
7b76a2 |
@@ -98,8 +98,7 @@ class TestConnectionPool(unittest.TestCa
|
|
|
7b76a2 |
|
|
|
7b76a2 |
def _test(exception, expect):
|
|
|
7b76a2 |
pool._make_request = lambda *args, **kwargs: _raise(exception)
|
|
|
7b76a2 |
- with self.assertRaises(expect):
|
|
|
7b76a2 |
- pool.request('GET', '/')
|
|
|
7b76a2 |
+ self.assertRaises(expect, pool.request, 'GET', '/')
|
|
|
7b76a2 |
|
|
|
7b76a2 |
self.assertEqual(pool.pool.qsize(), POOL_SIZE)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
@@ -114,15 +113,13 @@ class TestConnectionPool(unittest.TestCa
|
|
|
7b76a2 |
# MaxRetryError, not EmptyPoolError
|
|
|
7b76a2 |
# See: https://github.com/shazow/urllib3/issues/76
|
|
|
7b76a2 |
pool._make_request = lambda *args, **kwargs: _raise(HTTPException)
|
|
|
7b76a2 |
- with self.assertRaises(MaxRetryError):
|
|
|
7b76a2 |
- pool.request('GET', '/', retries=1, pool_timeout=0.01)
|
|
|
7b76a2 |
+ self.assertRaises(MaxRetryError, pool.request, 'GET', '/', retries=1, pool_timeout=0.01)
|
|
|
7b76a2 |
self.assertEqual(pool.pool.qsize(), POOL_SIZE)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
def test_assert_same_host(self):
|
|
|
7b76a2 |
c = connection_from_url('http://google.com:80')
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(HostChangedError):
|
|
|
7b76a2 |
- c.request('GET', 'http://yahoo.com:80', assert_same_host=True)
|
|
|
7b76a2 |
+ self.assertRaises(HostChangedError, c.request, 'GET', 'http://yahoo.com:80', assert_same_host=True)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
def test_pool_close(self):
|
|
|
7b76a2 |
pool = connection_from_url('http://google.com:80')
|
|
|
7b76a2 |
@@ -139,16 +136,13 @@ class TestConnectionPool(unittest.TestCa
|
|
|
7b76a2 |
pool.close()
|
|
|
7b76a2 |
self.assertEqual(pool.pool, None)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(ClosedPoolError):
|
|
|
7b76a2 |
- pool._get_conn()
|
|
|
7b76a2 |
+ self.assertRaises(ClosedPoolError, pool._get_conn)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
pool._put_conn(conn3)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(ClosedPoolError):
|
|
|
7b76a2 |
- pool._get_conn()
|
|
|
7b76a2 |
+ self.assertRaises(ClosedPoolError, pool._get_conn)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(Empty):
|
|
|
7b76a2 |
- old_pool_queue.get(block=False)
|
|
|
7b76a2 |
+ self.assertRaises(Empty, old_pool_queue.get, block=False)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
|
|
|
7b76a2 |
if __name__ == '__main__':
|
|
|
7b76a2 |
Index: urllib3-1.5/test/test_poolmanager.py
|
|
|
7b76a2 |
===================================================================
|
|
|
7b76a2 |
--- urllib3-1.5.orig/test/test_poolmanager.py
|
|
|
7b76a2 |
+++ urllib3-1.5/test/test_poolmanager.py
|
|
|
7b76a2 |
@@ -54,13 +54,11 @@ class TestPoolManager(unittest.TestCase)
|
|
|
7b76a2 |
p.clear()
|
|
|
7b76a2 |
self.assertEqual(len(p.pools), 0)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(ClosedPoolError):
|
|
|
7b76a2 |
- conn_pool._get_conn()
|
|
|
7b76a2 |
+ self.assertRaises(ClosedPoolError, conn_pool._get_conn)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
conn_pool._put_conn(conn)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
- with self.assertRaises(ClosedPoolError):
|
|
|
7b76a2 |
- conn_pool._get_conn()
|
|
|
7b76a2 |
+ self.assertRaises(ClosedPoolError, conn_pool._get_conn)
|
|
|
7b76a2 |
|
|
|
7b76a2 |
self.assertEqual(len(p.pools), 0)
|
|
|
7b76a2 |
|