Stop gui when cant connect to redis

This commit is contained in:
2015-12-23 11:07:01 +05:30
parent bc06862a7f
commit 09aae4a189
+6 -3
View File
@@ -38,19 +38,22 @@ class Controller(htmlPy.Object):
try: try:
assert redis_db.ping() assert redis_db.ping()
except redis.exceptions.ConnectionError: except redis.exceptions.ConnectionError:
self.app_gui.stop()
raise redis.exceptions.ConnectionError("Cant connect to this socket. Is redis running?\n" raise redis.exceptions.ConnectionError("Cant connect to this socket. Is redis running?\n"
"Couldnt start pytest_status_gui") "Stopping pytest_status_gui")
except AssertionError: except AssertionError:
self.app_gui.stop()
raise redis.exceptions.ConnectionError("Cant connect to redis, something else seems to be running on this socket. " raise redis.exceptions.ConnectionError("Cant connect to redis, something else seems to be running on this socket. "
"Is redis running?\n" "Is redis running?\n"
"Couldnt start pytest_status_gui") "Stopping pytest_status_gui")
try: try:
# make sure that this is correct redis db # make sure that this is correct redis db
assert redis_db.get("PYTEST_STATUS_DB") == "1" assert redis_db.get("PYTEST_STATUS_DB") == "1"
except AssertionError: except AssertionError:
self.app_gui.stop()
raise redis.exceptions.ConnectionError("Redis is running on this port, but it is not related to pytest status\n" raise redis.exceptions.ConnectionError("Redis is running on this port, but it is not related to pytest status\n"
"Couldnt start pytest_status_gui") "Stopping pytest_status_gui")
dir_name = self.app_gui.dir_name dir_name = self.app_gui.dir_name
hash_dir_name = redis_db.hget("directories_to_hash", dir_name) hash_dir_name = redis_db.hget("directories_to_hash", dir_name)