Commit 5cb423e3 authored by Tom Niget's avatar Tom Niget

Add Registry.close() function to properly clean up resources

parent 859f2a78
...@@ -155,6 +155,11 @@ class RegistryServer: ...@@ -155,6 +155,11 @@ class RegistryServer:
else: else:
self.newHMAC(0) self.newHMAC(0)
def close(self):
self.sock.close()
self.db.close()
self.ctl.close()
def getConfig(self, name, *default): def getConfig(self, name, *default):
r, = next(self.db.execute( r, = next(self.db.execute(
"SELECT value FROM config WHERE name=?", (name,)), default) "SELECT value FROM config WHERE name=?", (name,)), default)
......
...@@ -70,6 +70,7 @@ class TestRegistryServer(unittest.TestCase): ...@@ -70,6 +70,7 @@ class TestRegistryServer(unittest.TestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
cls.server.close()
# remove database # remove database
for file in [cls.config.db, cls.config.ca, cls.config.key]: for file in [cls.config.db, cls.config.ca, cls.config.key]:
try: try:
......
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