@@ -33,6 +33,7 @@ from autopilot.display import Display
33import logging
33import logging
34import os.path
34import os.path
35import subprocess
35import subprocess
36from testtools.matchers import Equals, NotEquals
37from testtools.matchers import Equals, NotEquals
38from unity8 import (
39from unity8 import (
@@ -81,8 +82,6 @@ class UnityTestCase(AutopilotTestCase):
82 """A test case base class for the Unity shell tests."""
83 """A test case base class for the Unity shell tests."""
84− __unity_was_running_before_tests = False
86 @classmethod
85 @classmethod
87 def setUpClass(cls):
86 def setUpClass(cls):
88 output = subprocess.check_output([
87 output = subprocess.check_output([
@@ -92,20 +91,13 @@ class UnityTestCase(AutopilotTestCase):
94 if "start/" in output:
93 if "start/" in output:
95− UnityTestCase.__unity_was_running_before_tests = True
94+ sys.stderr.write(
96− logger.info("Stopping existing Unity")
95+ "Error: Unity is currently running, these tests require it to "
97− try:
96+ "be 'stopped'.\n"
98− subprocess.check_call(["/sbin/initctl", "stop", "unity8"])
97+ "Please run this command before running these tests: \n"
99− except subprocess.CalledProcessError as e:
98+ "initctl stop unity\n"
100− logger.warning("Unable to stop unity8")
99+ )
101− e.args += ("Failed to stop existing unity8 process", )
100+ sys.exit(1)
105− def tearDownClass(cls):
106− if UnityTestCase.__unity_was_running_before_tests:
107− logger.info("Starting unity again with original env")
108− subprocess.check_call(["/sbin/initctl", "start", "unity8"])
110 def setUp(self):
102 def setUp(self):
111 super(UnityTestCase, self).setUp()
103 super(UnityTestCase, self).setUp()