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/36051156
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/36051156
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/36051156

Branch: refs/heads/TINKERPOP-1599
Commit: 360511560c090574a4f92e4984b7c39bbe28c5ea
Parents: dce23a7
Author: davebshow <[email protected]>
Authored: Mon Jan 30 20:07:03 2017 -0500
Committer: davebshow <[email protected]>
Committed: Wed Feb 15 18:28:20 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/36051156/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