Ensure feature tests use the TEST_SQLITE_PATH, not SQLITE_PATH.
parent
76d5dccc46
commit
5fa1e83f0a
|
|
@ -176,10 +176,11 @@ MAX_SESSION_IDLE_TIME = 60
|
||||||
# The default path to the SQLite database used to store user accounts and
|
# 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
|
# settings. This default places the file in the same directory as this
|
||||||
# config file, but generates an absolute path for use througout the app.
|
# config file, but generates an absolute path for use througout the app.
|
||||||
SQLITE_PATH = os.path.join(
|
SQLITE_PATH = os.environ.get("SQLITE_PATH") or \
|
||||||
DATA_DIR,
|
os.path.join(
|
||||||
'pgadmin4.db'
|
DATA_DIR,
|
||||||
)
|
'pgadmin4.db'
|
||||||
|
)
|
||||||
# SQLITE_TIMEOUT will define how long to wait before throwing the error -
|
# 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
|
# OperationError due to database lock. On slower system, you may need to change
|
||||||
# this to some higher value.
|
# this to some higher value.
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,13 @@ class AppStarter:
|
||||||
|
|
||||||
def start_app(self):
|
def start_app(self):
|
||||||
random_server_port = str(random.randint(10000, 65535))
|
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)
|
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,
|
shell=False,
|
||||||
preexec_fn=os.setsid,
|
preexec_fn=os.setsid,
|
||||||
stderr=open(os.devnull, 'w'),
|
stderr=open(os.devnull, 'w'),
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ def drop_tablespace(connection):
|
||||||
def create_server(server):
|
def create_server(server):
|
||||||
"""This function is used to create server"""
|
"""This function is used to create server"""
|
||||||
try:
|
try:
|
||||||
conn = sqlite3.connect(config.SQLITE_PATH)
|
conn = sqlite3.connect(config.TEST_SQLITE_PATH)
|
||||||
# Create the server
|
# Create the server
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
server_details = (1, SERVER_GROUP, server['name'], server['host'],
|
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):
|
def get_db_server(sid):
|
||||||
connection = ''
|
connection = ''
|
||||||
conn = sqlite3.connect(config.SQLITE_PATH)
|
conn = sqlite3.connect(config.TEST_SQLITE_PATH)
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
server = cur.execute('SELECT name, host, port, maintenance_db,'
|
server = cur.execute('SELECT name, host, port, maintenance_db,'
|
||||||
' username FROM server where id=%s' % sid)
|
' username FROM server where id=%s' % sid)
|
||||||
|
|
@ -361,8 +361,8 @@ def get_db_server(sid):
|
||||||
|
|
||||||
def remove_db_file():
|
def remove_db_file():
|
||||||
"""This function use to remove SQLite DB file"""
|
"""This function use to remove SQLite DB file"""
|
||||||
if os.path.isfile(config.SQLITE_PATH):
|
if os.path.isfile(config.TEST_SQLITE_PATH):
|
||||||
os.remove(config.SQLITE_PATH)
|
os.remove(config.TEST_SQLITE_PATH)
|
||||||
|
|
||||||
|
|
||||||
def _drop_objects(tester):
|
def _drop_objects(tester):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue