diff --git a/registrar_test.py b/registrar_test.py index 5eeb9824aaf70ebd1fb7a565fe268c848b6dd1be..f9c4c76dae8aa47f3aecc4c91f372bd3855712e3 100644 --- a/registrar_test.py +++ b/registrar_test.py @@ -1,21 +1,17 @@ import psycopg2 import os -lines = tuple(open('./env/emg_db.env', 'r')) -for line in lines: - variable_key = line.split("=",1)[0] - variable = line.split("=",1)[1] - if variable_key == "DB_USER" : - database_user = variable - elif variable_key == "DB_PW" : - database_password = variable - elif variable_key == "DB_HOST" : - host = variable - elif variable_key == "DB_PORT" : - port = variable - elif variable_key == "DB_NAME" : - database = variable +with open('./env/emg_db.env', 'r') as f: + env = dict( + line.split('=', 1) + for line in f + ) +database= env['DB_NAME'] +port = env['DB_PORT'] +host = env['DB_HOST'] +database_password= env['DB_PW'] +database_user = env['DB_USER'] def connect_to_db(eo_id): global db_name, coverage_id diff --git a/requirements.txt b/requirements.txt index 86f4bf6983edc1dd61b9eea723e737a8837941ec..56ba698664ddb78df20e57a7c6159d1da82feba9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ pytest psycopg2 -python-swiftclient -python-keystoneclient \ No newline at end of file +# python-swiftclient +# python-keystoneclient \ No newline at end of file