Skip to content

Commit

Permalink
Try with different mariadb user
Browse files Browse the repository at this point in the history
  • Loading branch information
Cryp Toon committed Feb 6, 2024
1 parent c0d06f6 commit d78faaf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,17 @@ def database_init(dbname=DATABASE_NAME):
con.close()
return 'postgresql://postgres:postgres@localhost:5432/' + dbname
elif os.getenv('UNITTEST_DATABASE') == 'mysql':
con = mysql.connector.connect(user='user', host='localhost', password='password')
try:
con = mysql.connector.connect(user='user', host='localhost', password='password')
except:
con = mysql.connector.connect(user='root', host='localhost', password='password')
cur = con.cursor()
cur.execute("DROP DATABASE IF EXISTS {}".format(dbname))
cur.execute("CREATE DATABASE {}".format(dbname))
con.commit()
cur.close()
con.close()
return 'mysql://user:password@localhost:3306/' + dbname
return 'mysql://root:password@localhost:3306/' + dbname
else:
dburi = os.path.join(str(BCL_DATABASE_DIR), '%s.sqlite' % dbname)
if os.path.isfile(dburi):
Expand Down

0 comments on commit d78faaf

Please sign in to comment.