Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 81e36dd commit 4c3e595Copy full SHA for 4c3e595
kubernetes/test/test_api_client.py
@@ -0,0 +1,25 @@
1
+# coding: utf-8
2
+
3
4
+import atexit
5
+import weakref
6
+import unittest
7
8
+import kubernetes
9
10
11
+class TestApiClient(unittest.TestCase):
12
13
+ def test_context_manager_closes_threadpool(self):
14
+ with kubernetes.client.ApiClient() as client:
15
+ self.assertIsNotNone(client.pool)
16
+ pool_ref = weakref.ref(client._pool)
17
+ self.assertIsNotNone(pool_ref())
18
+ self.assertIsNone(pool_ref())
19
20
+ def test_atexit_closes_threadpool(self):
21
+ client = kubernetes.client.ApiClient()
22
23
+ self.assertIsNotNone(client._pool)
24
+ atexit._run_exitfuncs()
25
+ self.assertIsNone(client._pool)
0 commit comments