mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-12-23 15:40:45 -06:00
Ensure the feature tests use the correct test settings database. Fixes #2486
This commit is contained in:
parent
0056a94115
commit
1ee555e468
@ -305,8 +305,6 @@ DEFAULT_BINARY_PATHS = {
|
||||
##########################################################################
|
||||
# Test settings - used primarily by the regression suite, not for users
|
||||
##########################################################################
|
||||
# Set default testing mode
|
||||
TESTING_MODE = False
|
||||
|
||||
# The default path for SQLite database for testing
|
||||
TEST_SQLITE_PATH = os.path.join(DATA_DIR, 'test_pgadmin4.db')
|
||||
|
@ -170,6 +170,11 @@ def create_app(app_name=None):
|
||||
logger = logging.getLogger('werkzeug')
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
# Set SQLITE_PATH to TEST_SQLITE_PATH while running test cases
|
||||
if "PGADMIN_TESTING_MODE" in os. environ and \
|
||||
os.environ["PGADMIN_TESTING_MODE"] == "1":
|
||||
config.SQLITE_PATH = config.TEST_SQLITE_PATH
|
||||
|
||||
# Ensure the various working directories exist
|
||||
from pgadmin.setup import create_app_data_directory, db_upgrade
|
||||
create_app_data_directory(config)
|
||||
|
@ -50,7 +50,7 @@ from regression.feature_utils.app_starter import AppStarter
|
||||
if os.path.isfile(config.TEST_SQLITE_PATH):
|
||||
os.remove(config.TEST_SQLITE_PATH)
|
||||
|
||||
config.TESTING_MODE = True
|
||||
os.environ["PGADMIN_TESTING_MODE"] = "1"
|
||||
|
||||
# Disable upgrade checks - no need during testing, and it'll cause an error
|
||||
# if there's no network connection when it runs.
|
||||
@ -408,6 +408,9 @@ if __name__ == '__main__':
|
||||
|
||||
print("Please check output in file: %s/regression.log\n" % CURRENT_PATH)
|
||||
|
||||
# Unset environment variable
|
||||
del os.environ["PGADMIN_TESTING_MODE"]
|
||||
|
||||
if failure:
|
||||
sys.exit(1)
|
||||
else:
|
||||
|
@ -33,7 +33,8 @@ if __name__ == '__main__':
|
||||
|
||||
app.config.from_object(config)
|
||||
|
||||
if config.TESTING_MODE:
|
||||
if "PGADMIN_TESTING_MODE" in os. environ and \
|
||||
os.environ["PGADMIN_TESTING_MODE"] == "1":
|
||||
config.SQLITE_PATH = config.TEST_SQLITE_PATH
|
||||
|
||||
create_app_data_directory(config)
|
||||
|
Loading…
Reference in New Issue
Block a user