Skip to content

Commit

Permalink
Close communication channel before exiting the test runner (#1597)
Browse files Browse the repository at this point in the history
* Close communication channel before exiting the test runner
* revert change
* Fixes #1529
  • Loading branch information
DonJayamanne authored May 7, 2018
1 parent 9aba811 commit b40cc2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/1529.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Close communication channel before exiting the test runner.
14 changes: 12 additions & 2 deletions pythonFiles/PythonTools/visualstudio_py_testlauncher.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,20 @@ def __init__(self, socket, callback):
self.seq = 0
self.callback = callback
self.lock = thread.allocate_lock()
self._closed = False
# start the testing reader thread loop
self.test_thread_id = thread.start_new_thread(self.readSocket, ())

def close(self):
self._closed = True

def readSocket(self):
data = self.socket.recv(1024)
self.callback()
try:
data = self.socket.recv(1024)
self.callback()
except OSError:
if not self._closed:
raise

def receive(self):
pass
Expand Down Expand Up @@ -312,6 +320,8 @@ def main():
else:
runner = unittest.TextTestRunner(verbosity=opts.uvInt, resultclass=VsTestResult)
result = runner.run(tests)
if _channel is not None:
_channel.close()
sys.exit(not result.wasSuccessful())
finally:
if cov is not None:
Expand Down

0 comments on commit b40cc2c

Please sign in to comment.