Skip to content

fix(testing): return [] instead of None from get_logs for non-Chrome browsers#3779

Merged
T4rk1n merged 3 commits into
plotly:devfrom
troclaux:fix/get-logs-return-empty-list
Jul 2, 2026
Merged

fix(testing): return [] instead of None from get_logs for non-Chrome browsers#3779
T4rk1n merged 3 commits into
plotly:devfrom
troclaux:fix/get-logs-return-empty-list

Conversation

@troclaux

Copy link
Copy Markdown
Contributor

Summary

Browser.get_logs() returns None when the driver is not Chrome. This breaks test assertions like assert dash_duo.get_logs() == [] on Firefox/Safari.

The Chrome path already returns [] (an empty list comprehension) when there are no log entries, so returning [] on other drivers is the consistent behaviour. The warning message is updated to reflect the change.

Changes

dash/testing/browser.py: changed return Nonereturn [] and updated the warning text accordingly.

Test plan

  • Existing tests that assert dash_duo.get_logs() == [] will no longer raise a TypeError on non-Chrome drivers
…browsers

When running tests with non-Chrome drivers, get_logs() returned None, causing
assertions like `assert dash_duo.get_logs() == []` to fail. Returning an empty
list is consistent with the Chrome path, which also returns an empty list when
there are no logs.

@T4rk1n T4rk1n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💃

@T4rk1n T4rk1n merged commit 5dea7b8 into plotly:dev Jul 2, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants