on xenial help sign in
Remove last remains of using temp dbus server.
commitec2f09ed03ddd101f19d9d38526667f36f73ecb4 authorChristopher Lee <chris.lee@canonical.com> dateWed 31 Jul 2013, 19:00 (13 years ago) parent0d72c18
1 file changed+9−45
tests/autopilot/unity8/shell/tests/test_notifications.py+9−45
tests/autopilot/unity8/shell/tests/test_notifications.py+9−45
@@ -21,12 +21,10 @@
2121
2222from __future__ import absolute_import
2323
24−from unity8.shell import with_lightdm_mock
2524from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
2625
2726from testtools.matchers import Equals, NotEquals
2827from autopilot.matchers import Eventually
29−from autopilot.platform import model
3028
3129from gi.repository import Notify
3230import time
@@ -46,34 +44,6 @@ class NotificationsTests(UnityTestCase):
4644
4745 scenarios = _get_device_emulation_scenarios()
4846
49− # Important note:
50− # * On desktop only we run a custom dbus session
51− # * We have a single class for these tests and are using setUpClass and
52− # tearDownClass to overcome issues that we have encountered with starting a
53− # new dbus server for each test (and scenario).
54− # Namely we have noticed that, even if we init and uninit as required,
55− # Notification.show() fails with the error stating: "GError: Error calling
56− # StartServiceByName for org.freedesktop.Notifications: The connection is
57− # closed"
58− # This use of setUpClass may be changed in the future if we're able to sort
59− # out the above issue, but for now this works for us.
60−
61− @classmethod
62− def setUpClass(cls):
63− cls.dbus_address = 'session'
64− cls.dbus_pid = None
65− if model() == 'Desktop':
66− p = subprocess.Popen(['dbus-launch'], stdout=subprocess.PIPE)
67− output = p.communicate()
68− results = output[0].split("\n")
69− cls.dbus_pid = int(results[1].split("=")[1])
70− cls.dbus_address = results[0].split("=", 1)[1]
71−
72− logger.info(
73− "Using DBUS_SESSION_BUS_ADDRESS: %s",
74− cls.dbus_address
75− )
76−
7747 def setUp(self):
7848 super(NotificationsTests, self).setUp()
7949
@@ -83,12 +53,6 @@ class NotificationsTests(UnityTestCase):
8353 Notify.init("Autopilot Ephemeral Notification Tests")
8454 self.addCleanup(Notify.uninit)
8555
86− @classmethod
87− def tearDownClass(cls):
88− if cls.dbus_pid is not None:
89− logger.info("Killing custom dbus server")
90− os.killpg(cls.dbus_pid, signal.SIGTERM)
91−
9256 def _get_icon_path(self, icon_name):
9357 """Given an icons file name returns the full path (either system or
9458 source tree.
@@ -265,7 +229,7 @@ class NotificationsTests(UnityTestCase):
265229 )
266230
267231 def test_interactive(self):
268− self.launch_unity(dbus_bus=self.dbus_address)
232+ self.launch_unity()
269233 greeter = self.main_window.get_greeter()
270234 greeter.unlock()
271235
@@ -304,7 +268,7 @@ class NotificationsTests(UnityTestCase):
304268
305269 def test_sd_incoming_call(self):
306270 """Snap-decision simulating incoming call."""
307− self.launch_unity(dbus_bus=self.dbus_address)
271+ self.launch_unity()
308272 greeter = self.main_window.get_greeter()
309273 greeter.unlock()
310274
@@ -354,7 +318,7 @@ class NotificationsTests(UnityTestCase):
354318
355319 def test_icon_summary_body(self):
356320 """Notification must display the expected summary and body text."""
357− self.launch_unity(dbus_bus=self.dbus_address)
321+ self.launch_unity()
358322 greeter = self.main_window.get_greeter()
359323 greeter.unlock()
360324
@@ -387,7 +351,7 @@ class NotificationsTests(UnityTestCase):
387351 self._assert_notification(notification, summary, body, True, True, 1.0)
388352
389353 def test_icon_summary(self):
390− self.launch_unity(dbus_bus=self.dbus_address)
354+ self.launch_unity()
391355 greeter = self.main_window.get_greeter()
392356 greeter.unlock()
393357
@@ -424,7 +388,7 @@ class NotificationsTests(UnityTestCase):
424388 )
425389
426390 def test_urgency_order(self):
427− self.launch_unity(dbus_bus=self.dbus_address)
391+ self.launch_unity()
428392 greeter = self.main_window.get_greeter()
429393 greeter.unlock()
430394
@@ -514,7 +478,7 @@ class NotificationsTests(UnityTestCase):
514478 )
515479
516480 def test_summary_and_body(self):
517− self.launch_unity(dbus_bus=self.dbus_address)
481+ self.launch_unity()
518482 greeter = self.main_window.get_greeter()
519483 greeter.unlock()
520484
@@ -539,7 +503,7 @@ class NotificationsTests(UnityTestCase):
539503 )
540504
541505 def test_summary_only(self):
542− self.launch_unity(dbus_bus=self.dbus_address)
506+ self.launch_unity()
543507 greeter = self.main_window.get_greeter()
544508 greeter.unlock()
545509
@@ -562,7 +526,7 @@ class NotificationsTests(UnityTestCase):
562526 # Also, the sleeps should be changed to something similar to what is in
563527 # the test "test_urgency_order" i.e. using the eventually matcher to
564528 # ensure that the required notification etc. is displayed.
565− self.launch_unity(dbus_bus=self.dbus_address)
529+ self.launch_unity()
566530 greeter = self.main_window.get_greeter()
567531 greeter.unlock()
568532
@@ -640,7 +604,7 @@ class NotificationsTests(UnityTestCase):
640604 self._assert_notification(get_notification(), summary, body, False)
641605
642606 def test_append_hint(self):
643− self.launch_unity(dbus_bus=self.dbus_address)
607+ self.launch_unity()
644608 greeter = self.main_window.get_greeter()
645609 greeter.unlock()
646610