Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(586)

Side by Side Diff: client/site_tests/factory_Keyboard/factory_Keyboard.py

Issue 2819079: Make test failure messages more verbose (and thus useful to testing operators). (Closed) Base URL: ssh://gitrw.chromium.org/autotest.git
Patch Set: Add more test fail messages Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 7
8 # DESCRIPTION : 8 # DESCRIPTION :
9 # 9 #
10 # Intended for use during manufacturing to validate that all keyboard 10 # Intended for use during manufacturing to validate that all keyboard
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 class factory_Keyboard(test.test): 127 class factory_Keyboard(test.test):
128 version = 1 128 version = 1
129 preserve_srcdir = True 129 preserve_srcdir = True
130 130
131 def run_once(self, layout=None): 131 def run_once(self, layout=None):
132 132
133 factory.log('%s run_once' % self.__class__) 133 factory.log('%s run_once' % self.__class__)
134 134
135 os.chdir(self.srcdir) 135 os.chdir(self.srcdir)
136 kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout)
137 image_size = (kbd_image.get_width(), kbd_image.get_height())
138 136
139 with open('%s.bindings' % layout, 'r') as file: 137 try:
140 bindings = eval(file.read()) 138 kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout)
139 image_size = (kbd_image.get_width(), kbd_image.get_height())
140 except cairo.Error as e:
141 raise error.TestNAError('Error while opening %s.png: %s' %
142 (layout, e.message))
143
144 try:
145 with open('%s.bindings' % layout, 'r') as file:
146 bindings = eval(file.read())
147 except IOError as e:
148 raise error.TestNAError('Error while opening %s: %s [Errno %d]' %
149 (e.filename, e.strerror, e.errno))
141 150
142 test = KeyboardTest(kbd_image, bindings) 151 test = KeyboardTest(kbd_image, bindings)
143 152
144 drawing_area = gtk.DrawingArea() 153 drawing_area = gtk.DrawingArea()
145 drawing_area.set_size_request(*image_size) 154 drawing_area.set_size_request(*image_size)
146 drawing_area.connect('expose_event', test.expose_event) 155 drawing_area.connect('expose_event', test.expose_event)
147 drawing_area.add_events(gdk.EXPOSURE_MASK) 156 drawing_area.add_events(gdk.EXPOSURE_MASK)
148 157
149 countdown_widget, countdown_label = ful.make_countdown_widget() 158 countdown_widget, countdown_label = ful.make_countdown_widget()
150 gobject.timeout_add(1000, test.timer_event, countdown_label) 159 gobject.timeout_add(1000, test.timer_event, countdown_label)
151 160
152 test_widget = gtk.VBox() 161 test_widget = gtk.VBox()
153 test_widget.set_spacing(20) 162 test_widget.set_spacing(20)
154 test_widget.pack_start(drawing_area, False, False) 163 test_widget.pack_start(drawing_area, False, False)
155 test_widget.pack_start(countdown_widget, False, False) 164 test_widget.pack_start(countdown_widget, False, False)
156 165
157 ful.run_test_widget(self.job, test_widget, 166 ful.run_test_widget(self.job, test_widget,
158 window_registration_callback=test.register_callbacks) 167 window_registration_callback=test.register_callbacks)
159 168
160 missing = test.calc_missing_string() 169 missing = test.calc_missing_string()
161 if missing: 170 if missing:
162 raise error.TestFail(missing) 171 raise error.TestFail(missing)
163 172
164 factory.log('%s run_once finished' % self.__class__) 173 factory.log('%s run_once finished' % self.__class__)
OLDNEW
« no previous file with comments | « client/site_tests/factory_ExtDisplay/factory_ExtDisplay.py ('k') | client/site_tests/factory_Leds/factory_Leds.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698