on xenial help sign in
AP test to ensure sigstop emitted
commit36a2dc46e279db1cda900645ed6087402d82d036 authorGerry Boland <gerry.boland@canonical.com> dateThu 31 Jul 2014, 11:11 (12 years ago) parent6ed8935
1 file changed+18−3
tests/autopilot/unity8/shell/tests/test_upstart.py+18−3
tests/autopilot/unity8/shell/tests/test_upstart.py+18−3
@@ -25,7 +25,8 @@ import signal
2525import subprocess
2626import time
2727
28−from testtools.matchers._basic import Equals
28+import fixtures
29+from testtools.matchers import Equals, MismatchError
2930from autopilot.matchers import Eventually
3031from autopilot.introspection import get_proxy_object_for_existing_process
3132
@@ -100,8 +101,21 @@ class UpstartIntegrationTests(UnityTestCase):
100101 emulator_base=UnityEmulatorBase,))
101102
102103 def test_no_sigstop(self):
103− self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "")
104+ self.useFixture(
105+ fixtures.EnvironmentVariable(
106+ 'UNITY_MIR_EMITS_SIGSTOP', newvalue=None))
104107 self._launch_unity()
108+
109+ try:
110+ self.assertThat(
111+ lambda: os.WIFSTOPPED(self._get_status()),
112+ Eventually(Equals(True)))
113+ except MismatchError:
114+ pass
115+ else:
116+ self.process.send_signal(signal.SIGCONT)
117+ self.fail('Unity8 raised SIGSTOP')
118+
105119 self._set_proxy()
106120
107121 logger.debug("Unity started, waiting for it to be ready.")
@@ -109,7 +123,8 @@ class UpstartIntegrationTests(UnityTestCase):
109123 logger.debug("Unity loaded and ready.")
110124
111125 def test_expect_sigstop(self):
112− self.patch_environment("UNITY_MIR_EMITS_SIGSTOP", "1")
126+ self.useFixture(
127+ fixtures.EnvironmentVariable('UNITY_MIR_EMITS_SIGSTOP', '1'))
113128 self._launch_unity()
114129 self.assertThat(
115130 lambda: os.WIFSTOPPED(self._get_status()),