Skip to content

Commit

Permalink
Fix test and ignore to broad exception caught
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Dec 10, 2024
1 parent f929878 commit 4dcfe80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ async def main(jobs: list[Job]) -> None:
for completed_task in asyncio.as_completed(tasks):
try:
await completed_task
except Exception as e:
log.error("Error in job execution: %s", str(e))
except Exception as e: # pylint: disable=broad-exception-caught
log.critical("Error in job execution: %s", str(e))


if __name__ == "__main__":
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ async def test_metrics_collection(self, mock_metrics_push, *_):
await test_job.run()
mock_metrics_push.assert_not_called()

with patch("src.metrics.env", return_value="http://localhost:9090"):
with patch("src.metrics.env", return_value="http://localhost:9091"):
await test_job.run()
mock_metrics_push.assert_called_once()
call_kwargs = mock_metrics_push.mock_calls[0].kwargs
self.assertEqual("http://localhost:9090", call_kwargs["gateway"])
self.assertEqual("http://localhost:9091", call_kwargs["gateway"])
self.assertEqual("dune-sync-job name", call_kwargs["job"])

0 comments on commit 4dcfe80

Please sign in to comment.