aboutsummaryrefslogtreecommitdiff
path: root/src/match_up/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/match_up/__init__.py')
-rw-r--r--src/match_up/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/match_up/__init__.py b/src/match_up/__init__.py
index 7b30c1b..c9c3d0b 100644
--- a/src/match_up/__init__.py
+++ b/src/match_up/__init__.py
@@ -8,6 +8,12 @@ class PlaySession:
def __init__(self, database_location: PurePath):
self.data = PlayerDatabase(database_location)
+ def end(self):
+ self.data.close()
+
+ def __del__(self):
+ self.end()
+
def main():
generate_test_database()
@@ -15,5 +21,5 @@ def main():
for player in s.data.get_players():
print(player)
sleep(2)
- s.data._database.close()
+ s.end()
remove_test_database()