Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix invalid assertLogs usages #284

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions coriolis/tests/worker/rpc/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ def test__check_remove_dir(self):
def test__check_remove_dir_fails(self, mock_rmtree):
tmp = tempfile.mkdtemp()
mock_rmtree.side_effect = Exception('YOLO')
self.server._check_remove_dir(tmp)
self.assertLogs(server.LOG, level=logging.ERROR)
with self.assertLogs('coriolis.worker.rpc.server',
level=logging.ERROR):
self.server._check_remove_dir(tmp)
os.rmdir(tmp)

@mock.patch.object(server.WorkerServerEndpoint, 'get_available_providers')
Expand Down Expand Up @@ -356,10 +357,10 @@ def test__start_process_with_custom_library_paths_raises(
mock_custom_ld_path.side_effect = TypeError()
process = mock.MagicMock()

self.server._start_process_with_custom_library_paths(
process, mock.sentinel.extra_library_paths)
with self.assertLogs('coriolis.worker.rpc.server', logging.WARNING):
self.server._start_process_with_custom_library_paths(
process, mock.sentinel.extra_library_paths)
process.assert_not_called()
self.assertLogs(server.LOG, logging.WARNING)
self.assertEqual(original_ld_path, os.environ['LD_LIBRARY_PATH'])

@mock.patch.object(task_runners_factory, 'get_task_runner_class')
Expand Down