chore: enable ruff lint rule TRY201 and B904 to improve raise stack traces (#29166)

This commit is contained in:
Maxime Beauchemin
2024-06-12 13:04:42 -07:00
committed by GitHub
parent 5167d20f27
commit 4bb2e2f8af
50 changed files with 152 additions and 141 deletions

View File

@@ -180,9 +180,9 @@ class WebDriverPlaywright(WebDriverProxy):
)
element = page.locator(f".{element_name}")
element.wait_for()
except PlaywrightTimeout as ex:
except PlaywrightTimeout:
logger.exception("Timed out requesting url %s", url)
raise ex
raise
try:
# chart containers didn't render
@@ -191,12 +191,12 @@ class WebDriverPlaywright(WebDriverProxy):
slice_container_locator.first.wait_for()
for slice_container_elem in slice_container_locator.all():
slice_container_elem.wait_for()
except PlaywrightTimeout as ex:
except PlaywrightTimeout:
logger.exception(
"Timed out waiting for chart containers to draw at url %s",
url,
)
raise ex
raise
try:
# charts took too long to load
logger.debug(
@@ -204,11 +204,11 @@ class WebDriverPlaywright(WebDriverProxy):
)
for loading_element in page.locator(".loading").all():
loading_element.wait_for(state="detached")
except PlaywrightTimeout as ex:
except PlaywrightTimeout:
logger.exception(
"Timed out waiting for charts to load at url %s", url
)
raise ex
raise
selenium_animation_wait = current_app.config[
"SCREENSHOT_SELENIUM_ANIMATION_WAIT"
@@ -366,9 +366,9 @@ class WebDriverSelenium(WebDriverProxy):
element = WebDriverWait(driver, self._screenshot_locate_wait).until(
EC.presence_of_element_located((By.CLASS_NAME, element_name))
)
except TimeoutException as ex:
except TimeoutException:
logger.exception("Selenium timed out requesting url %s", url)
raise ex
raise
try:
# chart containers didn't render
@@ -378,12 +378,12 @@ class WebDriverSelenium(WebDriverProxy):
(By.CLASS_NAME, "chart-container")
)
)
except TimeoutException as ex:
except TimeoutException:
logger.exception(
"Selenium timed out waiting for chart containers to draw at url %s",
url,
)
raise ex
raise
try:
# charts took too long to load
@@ -393,11 +393,11 @@ class WebDriverSelenium(WebDriverProxy):
WebDriverWait(driver, self._screenshot_load_wait).until_not(
EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
)
except TimeoutException as ex:
except TimeoutException:
logger.exception(
"Selenium timed out waiting for charts to load at url %s", url
)
raise ex
raise
selenium_animation_wait = current_app.config[
"SCREENSHOT_SELENIUM_ANIMATION_WAIT"