summaryrefslogtreecommitdiff
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__.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/match_up/__init__.py b/src/match_up/__init__.py
index c9c3d0b..2b1e42b 100644
--- a/src/match_up/__init__.py
+++ b/src/match_up/__init__.py
@@ -1,25 +1,25 @@
from pathlib import PurePath
-from time import sleep
-from match_up.model import PlayerDatabase
-from match_up.tests import generate_test_database, remove_test_database
+from match_up.model import PlaySession
+from match_up.tests import (
+ TEST_DATABASE_LOCATION,
+ generate_test_database,
+ activate_random_players,
+)
+DATABASE_LOCATION = "storage.json"
-class PlaySession:
- def __init__(self, database_location: PurePath):
- self.data = PlayerDatabase(database_location)
- def end(self):
- self.data.close()
-
- def __del__(self):
- self.end()
+class Application:
+ def __init__(self, debug=False):
+ if debug:
+ database_location = TEST_DATABASE_LOCATION
+ else:
+ database_location = DATABASE_LOCATION
+ self.session = PlaySession(PurePath(database_location))
def main():
generate_test_database()
- s = PlaySession(PurePath("test_storage.json"))
- for player in s.data.get_players():
- print(player)
- sleep(2)
- s.end()
- remove_test_database()
+ activate_random_players()
+ a = Application(debug=True)
+ print(a.session)