Fix utility route check for Windows.

This commit is contained in:
Murtuza Zabuawala 2018-12-04 10:46:59 +00:00 committed by Dave Page
parent 851c0cfff3
commit f4f0fa0e47
5 changed files with 14 additions and 5 deletions

View File

@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
] ]
def setUp(self): 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') @patch('pgadmin.tools.backup.is_utility_exists')
def runTest(self, is_utility_exists_mock): def runTest(self, is_utility_exists_mock):

View File

@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
] ]
def setUp(self): 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') @patch('pgadmin.tools.import_export.is_utility_exists')
def runTest(self, is_utility_exists_mock): def runTest(self, is_utility_exists_mock):

View File

@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
] ]
def setUp(self): 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') @patch('pgadmin.tools.maintenance.is_utility_exists')
def runTest(self, is_utility_exists_mock): def runTest(self, is_utility_exists_mock):

View File

@ -30,7 +30,7 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
] ]
def setUp(self): 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') @patch('pgadmin.tools.restore.is_utility_exists')
def runTest(self, is_utility_exists_mock): def runTest(self, is_utility_exists_mock):

View File

@ -966,7 +966,7 @@ def get_server_type(server):
traceback.print_exc(file=sys.stderr) 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 \ if 'default_binary_paths' not in cls.server or \
cls.server['default_binary_paths'] is None or \ cls.server['default_binary_paths'] is None or \
cls.server['type'] not in cls.server['default_binary_paths'] 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'] 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)