refactor: Enable G logging rules and comprehensive ruff improvements (#35081)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Maxime Beauchemin
2025-09-15 12:42:49 -07:00
committed by GitHub
parent e1a2e4843a
commit 088ecdd0bf
47 changed files with 340 additions and 184 deletions

View File

@@ -263,10 +263,12 @@ class TestTakeTiledScreenshot:
with patch("superset.utils.screenshot_utils.combine_screenshot_tiles"):
take_tiled_screenshot(mock_page, "dashboard", viewport_height=2000)
# Should log dashboard dimensions
mock_logger.info.assert_any_call("Dashboard: 800x5000px at (50, 100)")
# Should log number of tiles
mock_logger.info.assert_any_call("Taking 3 screenshot tiles")
# Should log dashboard dimensions with lazy logging format
mock_logger.info.assert_any_call(
"Dashboard: %sx%spx at (%s, %s)", 800, 5000, 50, 100
)
# Should log number of tiles with lazy logging format
mock_logger.info.assert_any_call("Taking %s screenshot tiles", 3)
def test_exception_handling_returns_none(self):
"""Test that exceptions are handled and None is returned."""
@@ -277,9 +279,10 @@ class TestTakeTiledScreenshot:
result = take_tiled_screenshot(mock_page, "dashboard", viewport_height=2000)
assert result is None
mock_logger.exception.assert_called_once_with(
"Tiled screenshot failed: Unexpected error"
)
# The exception object is passed, not the string
call_args = mock_logger.exception.call_args
assert call_args[0][0] == "Tiled screenshot failed: %s"
assert str(call_args[0][1]) == "Unexpected error"
def test_wait_timeouts_between_tiles(self, mock_page):
"""Test that there are appropriate waits between tiles."""