summaryrefslogtreecommitdiff
path: root/tests
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2012-05-16 01:05:42 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2012-05-16 01:05:42 +0200
commit6fadea8183499452ee0ac3ebc1cab498bafeee9b (patch)
tree7fcf09f18ef74b7864d0550387423e44bf61485a /tests
parent7b73a30280bdb141ae9a8926d2a85fc491b20102 (diff)
autopilot, fix the close_all_app to correctly use kill
(bzr r2356.1.3)
Diffstat (limited to 'tests')
-rw-r--r--tests/autopilot/autopilot/tests/__init__.py5
-rw-r--r--tests/autopilot/autopilot/tests/test_launcher.py8
2 files changed, 7 insertions, 6 deletions
diff --git a/tests/autopilot/autopilot/tests/__init__.py b/tests/autopilot/autopilot/tests/__init__.py
index d22ff166a..69aaf31b9 100644
--- a/tests/autopilot/autopilot/tests/__init__.py
+++ b/tests/autopilot/autopilot/tests/__init__.py
@@ -274,8 +274,9 @@ class AutopilotTestCase(VideoCapturedTestCase, KeybindingsHelper):
def close_all_app(self, app_name):
"""Close all instances of the app_name."""
app = self.KNOWN_APPS[app_name]
- self.addCleanup(call, "kill `pidof %s`" % (app['process-name']), shell=True)
- super(LoggedTestCase, self).tearDown()
+ pids = check_output(["pidof", app['process-name']]).split()
+ if len(pids):
+ call(["kill"] + pids)
def get_app_instances(self, app_name):
"""Get BamfApplication instances for app_name."""
diff --git a/tests/autopilot/autopilot/tests/test_launcher.py b/tests/autopilot/autopilot/tests/test_launcher.py
index 0e5cc1a30..b26aa336f 100644
--- a/tests/autopilot/autopilot/tests/test_launcher.py
+++ b/tests/autopilot/autopilot/tests/test_launcher.py
@@ -447,16 +447,16 @@ class LauncherIconsBehaviorTests(LauncherTestCase):
def test_icon_shows_on_quick_application_reopen(self):
"""Icons should stay on launcher when an application is quickly closed/reopened."""
- self.close_all_app("Calculator")
calc = self.start_app("Calculator")
- calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
+ desktop_file = calc.desktop_file
+ calc_icon = self.launcher.model.get_icon_by_desktop_id(desktop_file)
self.assertThat(calc_icon.visible, Eventually(Equals(True)))
- os.spawnlp(os.P_WAIT, "pkill", "pkill", self.KNOWN_APPS["Calculator"]['process-name'])
+ self.close_all_app("Calculator")
calc = self.start_app("Calculator")
sleep(2)
- calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
+ calc_icon = self.launcher.model.get_icon_by_desktop_id(desktop_file)
self.assertThat(calc_icon, NotEquals(None))
self.assertThat(calc_icon.visible, Eventually(Equals(True)))