make sure to close manually created (not fixture) remote connection

Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/75a74445
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/75a74445
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/75a74445

Branch: refs/heads/master
Commit: 75a74445eccbe2d4cd9aad395ec8725db4cb6117
Parents: 627d7b0
Author: davebshow <[email protected]>
Authored: Mon Jan 30 20:07:03 2017 -0500
Committer: davebshow <[email protected]>
Committed: Tue Feb 28 10:30:48 2017 -0500

----------------------------------------------------------------------
 .../tests/driver/test_driver_remote_connection_threaded.py     | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/75a74445/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection_threaded.py
----------------------------------------------------------------------
diff --git 
a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection_threaded.py
 
b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection_threaded.py
index d5efc0d..dffd442 100644
--- 
a/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection_threaded.py
+++ 
b/gremlin-python/src/main/jython/tests/driver/test_driver_remote_connection_threaded.py
@@ -54,7 +54,10 @@ def test_conn_in_threads(remote_connection):
     child2.join()
 
 def _executor(q, conn):
+    close = False
     if not conn:
+        # This isn't a fixture so close manually
+        close = True
         conn = DriverRemoteConnection(
             'ws://localhost:45940/gremlin', 'g', pool_size=4)
     try:
@@ -66,3 +69,6 @@ def _executor(q, conn):
         q.put(sys.exc_info()[0])
     else:
         q.put('success!')
+        # Close conn
+        if close:
+            conn.close()

Reply via email to