Ensure feature tests use the TEST_SQLITE_PATH, not SQLITE_PATH.

This commit is contained in:
Atira Odhner 2017-02-28 17:09:23 +00:00 committed by Dave Page
parent 76d5dccc46
commit 5fa1e83f0a
3 changed files with 14 additions and 10 deletions

View File

@ -176,10 +176,11 @@ MAX_SESSION_IDLE_TIME = 60
# The default path to the SQLite database used to store user accounts and
# settings. This default places the file in the same directory as this
# config file, but generates an absolute path for use througout the app.
SQLITE_PATH = os.path.join(
DATA_DIR,
'pgadmin4.db'
)
SQLITE_PATH = os.environ.get("SQLITE_PATH") or \
os.path.join(
DATA_DIR,
'pgadmin4.db'
)
# SQLITE_TIMEOUT will define how long to wait before throwing the error -
# OperationError due to database lock. On slower system, you may need to change
# this to some higher value.

View File

@ -16,10 +16,13 @@ class AppStarter:
def start_app(self):
random_server_port = str(random.randint(10000, 65535))
env = {"PGADMIN_PORT": random_server_port}
env = {
"PGADMIN_PORT": random_server_port,
"SQLITE_PATH": self.app_config.TEST_SQLITE_PATH
}
env.update(os.environ)
self.pgadmin_process = subprocess.Popen(["python", "pgAdmin4.py", "magic-portal", random_server_port],
self.pgadmin_process = subprocess.Popen(["python", "pgAdmin4.py"],
shell=False,
preexec_fn=os.setsid,
stderr=open(os.devnull, 'w'),

View File

@ -211,7 +211,7 @@ def drop_tablespace(connection):
def create_server(server):
"""This function is used to create server"""
try:
conn = sqlite3.connect(config.SQLITE_PATH)
conn = sqlite3.connect(config.TEST_SQLITE_PATH)
# Create the server
cur = conn.cursor()
server_details = (1, SERVER_GROUP, server['name'], server['host'],
@ -334,7 +334,7 @@ def get_db_password(config_servers, name, host, db_port):
def get_db_server(sid):
connection = ''
conn = sqlite3.connect(config.SQLITE_PATH)
conn = sqlite3.connect(config.TEST_SQLITE_PATH)
cur = conn.cursor()
server = cur.execute('SELECT name, host, port, maintenance_db,'
' username FROM server where id=%s' % sid)
@ -361,8 +361,8 @@ def get_db_server(sid):
def remove_db_file():
"""This function use to remove SQLite DB file"""
if os.path.isfile(config.SQLITE_PATH):
os.remove(config.SQLITE_PATH)
if os.path.isfile(config.TEST_SQLITE_PATH):
os.remove(config.TEST_SQLITE_PATH)
def _drop_objects(tester):