on xenial help sign in
Fix flake8 errors, remove imports using emulator and rename emulator tests to helper tests.
f4e4fccRichard Huddie
tests/autopilot/unity8/application_lifecycle/tests/test_application_lifecycle.py+4−2
@@ -92,14 +92,16 @@ class ApplicationLifecycleTests(tests.ApplicationLifeCycleTestCase):
92 process_helpers.lock_unity()
92 process_helpers.lock_unity()
93
93
94 # FIXME - this is because the device greeter uses a password.
94 # FIXME - this is because the device greeter uses a password.
95− # Need to be able to selectively enable mocks so that we can use the fake greeter.
95+ # Need to be able to selectively enable mocks so that we can use the
96+ # fake greeter.
96 def unlock_thread_worker(greeter):
97 def unlock_thread_worker(greeter):
97 greeter.wait_swiped_away()
98 greeter.wait_swiped_away()
98 process_helpers.unlock_unity()
99 process_helpers.unlock_unity()
99 greeter.created.wait_for(False)
100 greeter.created.wait_for(False)
100
101
101 greeter = self.main_window.get_greeter()
102 greeter = self.main_window.get_greeter()
103+ unlock_thread = threading.Thread(
102− unlock_thread = threading.Thread(target=unlock_thread_worker, args=(greeter,))
104+ target=unlock_thread_worker, args=(greeter,))
103 unlock_thread.start()
105 unlock_thread.start()
104 application_name = self.launch_fake_app()
106 application_name = self.launch_fake_app()
105 unlock_thread.join(10)
107 unlock_thread.join(10)
tests/autopilot/unity8/fixture_setup.py+5−15
@@ -31,21 +31,14 @@ from ubuntuuitoolkit import fixture_setup
31
31
32from unity8 import (
32from unity8 import (
33 get_binary_path,
33 get_binary_path,
34+ get_mocks_library_path,
35+ get_default_extra_mock_libraries,
36+ get_data_dirs,
34 sensors,
37 sensors,
38+ shell,
35 process_helpers
39 process_helpers
36)
40)
37
41
38−from unity8.shell import emulators
39−
40−from unity8.shell.emulators import (
41− main_window as main_window_emulator
42−)
43−
44−from unity8 import (
45− get_mocks_library_path,
46− get_default_extra_mock_libraries,
47− get_data_dirs
48−)
49
42
50logger = logging.getLogger(__name__)
43logger = logging.getLogger(__name__)
51
44
@@ -140,8 +133,7 @@ class LaunchUnityWithFakeSensors(fixtures.Fixture):
140 args = [binary_arg] + env_args
133 args = [binary_arg] + env_args
141 self.unity_proxy = process_helpers.restart_unity_with_testability(
134 self.unity_proxy = process_helpers.restart_unity_with_testability(
142 *args)
135 *args)
143− self.main_win = self.unity_proxy.select_single(
136+ self.main_win = self.unity_proxy.select_single(shell.QQuickView)
144− main_window_emulator.QQuickView)
145
137
146 def _create_sensors(self):
138 def _create_sensors(self):
147 # Wait for unity to start running.
139 # Wait for unity to start running.
@@ -159,8 +151,6 @@ class LaunchUnityWithFakeSensors(fixtures.Fixture):
159 fifo.write('create light 0 10 1\n')
151 fifo.write('create light 0 10 1\n')
160 fifo.write('create proximity\n')
152 fifo.write('create proximity\n')
161
153
162−logger = logging.getLogger(__name__)
163−
164
154
165class RestartUnityWithTestability(fixtures.Fixture):
155class RestartUnityWithTestability(fixtures.Fixture):
166
156
tests/autopilot/unity8/shell/tests/test_helpers.py+3−3
@@ -44,7 +44,7 @@ class MainWindowTestCase(tests.UnityTestCase):
44 process_helpers.unlock_unity()
44 process_helpers.unlock_unity()
45
45
46
46
47−class DashEmulatorTestCase(tests.DashBaseTestCase):
47+class DashHelperTestCase(tests.DashBaseTestCase):
48
48
49 def test_search(self):
49 def test_search(self):
50 self.dash.enter_search_query('Test')
50 self.dash.enter_search_query('Test')
@@ -106,7 +106,7 @@ class DashEmulatorTestCase(tests.DashBaseTestCase):
106 self.assertIsInstance(scope, dash_helpers.GenericScopeView)
106 self.assertIsInstance(scope, dash_helpers.GenericScopeView)
107
107
108
108
109−class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
109+class GenericScopeViewHelperTestCase(tests.DashBaseTestCase):
110
110
111 def setUp(self):
111 def setUp(self):
112 # Set up the fake scopes before launching unity.
112 # Set up the fake scopes before launching unity.
@@ -126,7 +126,7 @@ class GenericScopeViewEmulatorTestCase(tests.DashBaseTestCase):
126 self.assertTrue(preview.isCurrent)
126 self.assertTrue(preview.isCurrent)
127
127
128
128
129−class DashAppsEmulatorTestCase(tests.DashBaseTestCase):
129+class DashAppsHelperTestCase(tests.DashBaseTestCase):
130
130
131 available_applications = [
131 available_applications = [
132 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',
132 'Title.2.0', 'Title.2.1', 'Title.2.2', 'Title.2.3', 'Title.2.4',