summaryrefslogtreecommitdiff
path: root/tests/uitests
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2020-09-19 05:15:52 -0400
committerCole Robinson <crobinso@redhat.com>2020-09-19 13:47:04 -0400
commit4193aa2bb0770eaaf257a2efd5076d3ab620d5ae (patch)
tree6cd230087f1e98146649b4a2949a5b880bb84fbf /tests/uitests
parentfa322588b47b5f383e934e2852bea1c1795b970f (diff)
downloadvirt-manager-4193aa2bb0770eaaf257a2efd5076d3ab620d5ae.tar.gz
app: Slight rework of wait_for_exit
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Diffstat (limited to 'tests/uitests')
-rw-r--r--tests/uitests/lib/app.py28
1 files changed, 13 insertions, 15 deletions
diff --git a/tests/uitests/lib/app.py b/tests/uitests/lib/app.py
index 2d6e13c0..9b82525b 100644
--- a/tests/uitests/lib/app.py
+++ b/tests/uitests/lib/app.py
@@ -121,13 +121,8 @@ class VMMDogtailApp(object):
def wait_for_exit(self):
# Wait for shutdown for 2 sec
- waittime = 2
- for ignore in range(int(waittime / .05)):
- time.sleep(.05)
- if self._proc.poll() is not None:
- self._proc = None
- return True
- return False
+ waittime = 5
+ self._proc.wait(timeout=waittime)
def stop(self):
"""
@@ -143,24 +138,27 @@ class VMMDogtailApp(object):
self._proc = None
return
- if self.wait_for_exit():
- return
-
- log.warning("App didn't exit gracefully from SIGINT. Killing...")
- self._proc.kill()
- self.wait_for_exit()
+ try:
+ self.wait_for_exit()
+ except subprocess.TimeoutExpired:
+ log.warning("App didn't exit gracefully from SIGINT. Killing...")
+ self._proc.kill()
+ self.wait_for_exit()
+ raise
#####################################
# virt-manager launching entrypoint #
#####################################
- def open(self, extra_opts=None, check_already_running=True, use_uri=True,
+ def open(self, uri=None,
+ extra_opts=None, check_already_running=True, use_uri=True,
window_name=None, xmleditor_enabled=False, keyfile=None,
break_setfacl=False, first_run=True, no_fork=True,
will_fail=False, enable_libguestfs=False,
firstrun_uri=None):
extra_opts = extra_opts or []
+ uri = uri or self.uri
if tests.utils.TESTCONFIG.debug and no_fork:
stdout = sys.stdout
@@ -175,7 +173,7 @@ class VMMDogtailApp(object):
if no_fork:
cmd += ["--no-fork"]
if use_uri:
- cmd += ["--connect", self.uri]
+ cmd += ["--connect", uri]
if first_run:
cmd.append("--test-options=first-run")