diff --git a/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py b/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py index b01704b35..494964f57 100644 --- a/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py +++ b/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py @@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): ] def setUp(self): - check_binary_path_or_skip_test(self) + check_binary_path_or_skip_test(self, 'pg_dump') @patch('pgadmin.tools.backup.is_utility_exists') def runTest(self, is_utility_exists_mock): diff --git a/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py b/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py index ae04cf599..1931a75ac 100644 --- a/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py +++ b/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py @@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): ] def setUp(self): - check_binary_path_or_skip_test(self) + check_binary_path_or_skip_test(self, 'psql') @patch('pgadmin.tools.import_export.is_utility_exists') def runTest(self, is_utility_exists_mock): diff --git a/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py b/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py index cb0799896..fccc9871c 100644 --- a/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py +++ b/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py @@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): ] def setUp(self): - check_binary_path_or_skip_test(self) + check_binary_path_or_skip_test(self, 'psql') @patch('pgadmin.tools.maintenance.is_utility_exists') def runTest(self, is_utility_exists_mock): diff --git a/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py b/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py index 2ec980c2c..4283ae32c 100644 --- a/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py +++ b/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py @@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): ] def setUp(self): - check_binary_path_or_skip_test(self) + check_binary_path_or_skip_test(self, 'pg_restore') @patch('pgadmin.tools.restore.is_utility_exists') def runTest(self, is_utility_exists_mock): diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 311eeef48..cdf018f26 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -966,7 +966,7 @@ def get_server_type(server): traceback.print_exc(file=sys.stderr) -def check_binary_path_or_skip_test(cls): +def check_binary_path_or_skip_test(cls, utility_name): if 'default_binary_paths' not in cls.server or \ cls.server['default_binary_paths'] is None or \ cls.server['type'] not in cls.server['default_binary_paths'] or \ @@ -976,3 +976,12 @@ def check_binary_path_or_skip_test(cls): cls.server['name'] ) ) + + from pgadmin.utils import is_utility_exists + binary_path = os.path.join( + cls.server['default_binary_paths'][cls.server['type']], + utility_name + ) + retVal = is_utility_exists(binary_path) + if retVal is not None: + cls.skipTest(retVal)