diff options
author | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:19:42 -0700 |
---|---|---|
committer | SVN-Git Migration <python-modules-team@lists.alioth.debian.org> | 2015-10-08 13:19:42 -0700 |
commit | c9df3d807f7134f58f4a84dc8b80e9dc98c62f3a (patch) | |
tree | 2c14ecbc5e10513419b15f690e7bddfdb2dab75e /test/test_poolmanager.py | |
parent | b6ab7bae87b22c6fae783e8850533219d3bf8a29 (diff) | |
download | python-urllib3-c9df3d807f7134f58f4a84dc8b80e9dc98c62f3a.tar python-urllib3-c9df3d807f7134f58f4a84dc8b80e9dc98c62f3a.tar.gz |
Imported Upstream version 1.10.4
Diffstat (limited to 'test/test_poolmanager.py')
-rw-r--r-- | test/test_poolmanager.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_poolmanager.py b/test/test_poolmanager.py index 754ee8a..6195d51 100644 --- a/test/test_poolmanager.py +++ b/test/test_poolmanager.py @@ -71,6 +71,22 @@ class TestPoolManager(unittest.TestCase): self.assertRaises(LocationValueError, p.connection_from_url, 'http://@') self.assertRaises(LocationValueError, p.connection_from_url, None) + def test_contextmanager(self): + with PoolManager(1) as p: + conn_pool = p.connection_from_url('http://google.com') + self.assertEqual(len(p.pools), 1) + conn = conn_pool._get_conn() + + self.assertEqual(len(p.pools), 0) + + self.assertRaises(ClosedPoolError, conn_pool._get_conn) + + conn_pool._put_conn(conn) + + self.assertRaises(ClosedPoolError, conn_pool._get_conn) + + self.assertEqual(len(p.pools), 0) + if __name__ == '__main__': unittest.main() |