Skip to content

Commit

Permalink
Fix flake8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
swjain23 committed Aug 21, 2020
1 parent 6657ece commit 2104d26
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ def _get_pg_exe_path(exe_name: str, server_version: Tuple[int, int, int]) -> str

raise ValueError(f'Exe folder {os_root} does not contain {exe_name}')


# Map from backup types to the corresponding pg_dump format option value
_BACKUP_FORMAT_MAP = {
BackupType.DIRECTORY: 'd',
Expand Down
6 changes: 3 additions & 3 deletions tests/disaster_recovery/test_disaster_recovery_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_get_pg_exe_path_local_mac(self):
finally:
sys.argv[0] = old_arg0
sys.platform = old_platform

def test_get_pg_exe_path_local_win(self):
"""Test the get_pg_exe_path function for windows when the service is running from source code"""
# Back up these values so that the test can overwrite them
Expand Down Expand Up @@ -348,7 +348,7 @@ def test_perform_restore_no_exe(self):
self._test_perform_backup_restore_no_exe_internal(disaster_recovery_service._perform_restore, self.restore_params)

def _test_perform_backup_restore_no_exe_internal(self, test_method: Callable, test_params):
mockConnection = pg_utils.MockPGServerConnection(None)
mockConnection = pg_utils.MockPGServerConnection(None)
with mock.patch('os.path.exists', new=mock.Mock(return_value=False)), mock.patch('subprocess.Popen') as mock_popen:
with mock.patch('ossdbtoolsservice.connection.ConnectionInfo.get_connection', new=mock.Mock(return_value=mockConnection)):
# If I perform a restore when the pg_restore executable cannot be found
Expand Down Expand Up @@ -411,7 +411,7 @@ def test_canceled_task_does_not_spawn_process(self):
"""Test that the pg_dump/pg_restore process is not created if the task has been canceled"""
# Set up the task to be canceled
self.mock_task.canceled = True
mockConnection = pg_utils.MockPGServerConnection(None)
mockConnection = pg_utils.MockPGServerConnection(None)
with mock.patch('subprocess.Popen', new=mock.Mock()) as mock_popen:
with mock.patch('ossdbtoolsservice.connection.ConnectionInfo.get_connection', new=mock.Mock(return_value=mockConnection)):
# If I try to perform a backup/restore for a canceled task
Expand Down

0 comments on commit 2104d26

Please sign in to comment.