From a1ff139dd89d1882406f3ca91be7f9001f33e626 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Mon, 26 Oct 2020 21:25:02 +0000 Subject: [PATCH] Fix UI test server import. --- server.py | 4 ++++ tests/test_ui.py | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/server.py b/server.py index e03680c..66f0514 100644 --- a/server.py +++ b/server.py @@ -12,6 +12,9 @@ class BAPSicleServer(): def __del__(self): stopServer() + def get_flask(self): + return app + app = Flask(__name__, static_url_path='') @@ -168,6 +171,7 @@ def stopServer(): q.put("QUIT") for player in channel_p: player.join() + global app app = None diff --git a/tests/test_ui.py b/tests/test_ui.py index c0ed77c..c75d6e9 100644 --- a/tests/test_ui.py +++ b/tests/test_ui.py @@ -1,4 +1,4 @@ -from bapsicle import server +from server import BAPSicleServer import unittest @@ -19,7 +19,8 @@ class TestUI(unittest.TestCase): # initialization logic # code that is executed before each test def setUp(self): - self.app = server.app.test_client() + server = BAPSicleServer() + self.app = server.get_flask().test_client() self.app.testing = True # clean up logic