From 7bfe8139c0e7aec911a866c848dc5edceae91800 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 22 Aug 2020 16:22:41 -0400 Subject: [PATCH] uitests: Add module_trace.py coverage Signed-off-by: Cole Robinson --- tests/uitests/test_cli.py | 12 +++++++++++- virtManager/lib/module_trace.py | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/uitests/test_cli.py b/tests/uitests/test_cli.py index 42ce7af6..1b75ecd6 100644 --- a/tests/uitests/test_cli.py +++ b/tests/uitests/test_cli.py @@ -97,12 +97,22 @@ class VMMCLI(uiutils.UITestCase): self.app.topwin.find("test default", "table cell") def testShowCLIError(self): + # Unknown option self.app.open(extra_opts=["--idontexist"]) self._click_alert_button("Unhandled command line", "Close") uiutils.check_in_loop(lambda: not self.app.is_running()) - def testShowConnectBadURI(self): + # Missing VM + self.app.open(extra_opts=["--show-domain-delete", "IDONTEXIST"]) + self._click_alert_button("does not have VM", "Close") + uiutils.check_in_loop(lambda: not self.app.is_running()) + + # Bad URI baduri = "fribfrobfroo" self.app = uiutils.VMMDogtailApp(baduri) self._click_alert_button(baduri, "Close") uiutils.check_in_loop(lambda: not self.app.is_running()) + + def testCLITraceLibvirt(self): + self.app.open(extra_opts=["--trace-libvirt=mainloop"]) + self.sleep(5) diff --git a/virtManager/lib/module_trace.py b/virtManager/lib/module_trace.py index 7573a380..f5894f03 100644 --- a/virtManager/lib/module_trace.py +++ b/virtManager/lib/module_trace.py @@ -80,7 +80,7 @@ def wrap_module(module, mainloop, regex): CHECK_MAINLOOP = mainloop for name in dir(module): if regex and not re.match(regex, name): - continue + continue # pragma: no cover obj = getattr(module, name) if isinstance(obj, FunctionType): wrap_func(module, obj)