Skip to content

Commit

Permalink
Catch some final coverage cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Jun 13, 2024
1 parent 24df998 commit 63f122e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions testbed/tests/window/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ async def second_window_probe(app, app_probe, second_window):
yield probe
if second_window in app.windows:
second_window.close()
del second_window
gc.collect()


async def test_title(main_window, main_window_probe):
Expand Down
6 changes: 5 additions & 1 deletion winforms/src/toga_winforms/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ def create_app_commands(self):
def create_menus(self):
# Winforms menus are created on the Window.
for window in self.interface.windows:
if hasattr(window._impl, "create_menus"):
# It's difficult to trigger this on a simple window, because we can't easily
# modify the set of app-level commands that are registered, and a simple
# window doesn't exist when the app starts up. Therefore, no-branch the else
# case.
if hasattr(window._impl, "create_menus"): # pragma: no branch
window._impl.create_menus()

######################################################################
Expand Down

0 comments on commit 63f122e

Please sign in to comment.