Commit 33b83d53 authored by Tom Niget's avatar Tom Niget

Use with instead of direct call to exit

parent 6297a1f5
...@@ -42,7 +42,8 @@ class TestRegistryClientInteract(unittest.TestCase): ...@@ -42,7 +42,8 @@ class TestRegistryClientInteract(unittest.TestCase):
def tearDown(self): def tearDown(self):
self.server.proc.terminate() self.server.proc.terminate()
self.server.proc.__exit__() with self.server.proc:
pass
def test_1_main(self): def test_1_main(self):
""" a client interact a server, no re6stnet node test basic function""" """ a client interact a server, no re6stnet node test basic function"""
......
...@@ -136,7 +136,8 @@ class Re6stRegistry: ...@@ -136,7 +136,8 @@ class Re6stRegistry:
try: try:
logging.debug("teminate process %s", self.proc.pid) logging.debug("teminate process %s", self.proc.pid)
self.proc.destroy() self.proc.destroy()
self.proc.__exit__() with self.proc:
pass
except: except:
pass pass
...@@ -263,7 +264,8 @@ class Re6stNode: ...@@ -263,7 +264,8 @@ class Re6stNode:
"""stop running re6stnet process""" """stop running re6stnet process"""
logging.debug("%s teminate process %s", self.name, self.proc.pid) logging.debug("%s teminate process %s", self.name, self.proc.pid)
self.proc.destroy() self.proc.destroy()
self.proc.__exit__() with self.proc:
pass
def __del__(self): def __del__(self):
"""teminate process and rm temp dir""" """teminate process and rm temp dir"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment