In the case where popup_should_be_opened is False (i.e. on devices), I don’t think this test is useful, because popup_watcher.was_emitted is initially False anyway, before it changes to True.
So you probably want to make this assertion conditional instead:
if popup_should_be_opened: self.assertThat(popup_watcher.was_emitted, Eventually(Equals(True)))
545 + self.assertThat (lambda: popup_watcher. was_emitted, Equals( popup_should_ be_opened) ))
546 + Eventually(
In the case where popup_should_ be_opened is False (i.e. on devices), I don’t think this test is useful, because popup_watcher. was_emitted is initially False anyway, before it changes to True.
So you probably want to make this assertion conditional instead:
if popup_should_ be_opened:
self.assertTha t(popup_ watcher. was_emitted, Eventually( Equals( True)))