Hi,
Please find the attached patch to fix #2486: Feature tests use SQLITE_PATH
instead of TEST_SQLITE_PATH.
While running the feature tests, the separate process of the app does not
honour the config settings which are in runtests.py file.
Fix:
As per Dave, no need to set TESTING_MODE in config rather set environment
variable PGADMIN_TESTING_MODE to check the testing status and accordingly
set the TEST_SQLITE_PATH (i.e. Database path for testing).
Thanks,
Khushboo
diff --git a/web/pgadmin/__init__.py b/web/pgadmin/__init__.py
index 5a74927..14e84c8 100644
--- a/web/pgadmin/__init__.py
+++ b/web/pgadmin/__init__.py
@@ -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)
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index 3339cd6..2d4e2bc 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -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:
diff --git a/web/setup.py b/web/setup.py
index ab8dab6..36db0af 100644
--- a/web/setup.py
+++ b/web/setup.py
@@ -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)
--
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers