Skip to content

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

Open
troclaux wants to merge 1 commit intoplotly:devfrom
troclaux:fix/get-logs-return-empty-list
Open

fix(testing): return [] instead of None from get_logs for non-Chrome browsers#3779
troclaux wants to merge 1 commit intoplotly:devfrom
troclaux:fix/get-logs-return-empty-list

Conversation

@troclaux
Copy link
Copy Markdown

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant