aboutsummaryrefslogtreecommitdiff
path: root/tests/backendTest.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/backendTest.py')
-rw-r--r--tests/backendTest.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/backendTest.py b/tests/backendTest.py
index 0965e0a..12cefad 100644
--- a/tests/backendTest.py
+++ b/tests/backendTest.py
@@ -1,5 +1,6 @@
import mysql.connector as con
-
+from mysql.connector.errors import InterfaceError
+import sys
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
@@ -9,7 +10,11 @@ try:
except KeyError:
config.read("../config.ini")
-mycon = con.connect(host=config['DATABASE']['HOST'],user=config['DATABASE']['USER'],password=config['DATABASE']['PASSWORD'],port=config['DATABASE']['PORT'],database=config['DATABASE']['NAME'])
+try:
+ mycon = con.connect(host=config['DATABASE']['HOST'],user=config['DATABASE']['USER'],password=config['DATABASE']['PASSWORD'],port=config['DATABASE']['PORT'],database=config['DATABASE']['NAME'])
+except InterfaceError:
+ print("Could not connect to the database")
+ sys.exit(1)
mycursor = mycon.cursor()
# If we are running the CI on an actual server, try using the 6LU7 Mpro and Geraniin Job ID because Eucalyptol fails