Index: client/site_tests/factory_Keyboard/factory_Keyboard.py |
diff --git a/client/site_tests/factory_Keyboard/factory_Keyboard.py b/client/site_tests/factory_Keyboard/factory_Keyboard.py |
index b07588daa243a30b50568b557d9b213191f5e242..1f15cebb6512fee5f1f5e9c0e84b4eb57b186e4d 100644 |
--- a/client/site_tests/factory_Keyboard/factory_Keyboard.py |
+++ b/client/site_tests/factory_Keyboard/factory_Keyboard.py |
@@ -133,11 +133,20 @@ class factory_Keyboard(test.test): |
factory.log('%s run_once' % self.__class__) |
os.chdir(self.srcdir) |
- kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout) |
- image_size = (kbd_image.get_width(), kbd_image.get_height()) |
- with open('%s.bindings' % layout, 'r') as file: |
- bindings = eval(file.read()) |
+ try: |
+ kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout) |
+ image_size = (kbd_image.get_width(), kbd_image.get_height()) |
+ except cairo.Error as e: |
+ raise error.TestNAError('Error while opening %s.png: %s' % |
+ (layout, e.message)) |
+ |
+ try: |
+ with open('%s.bindings' % layout, 'r') as file: |
+ bindings = eval(file.read()) |
+ except IOError as e: |
+ raise error.TestNAError('Error while opening %s: %s [Errno %d]' % |
+ (e.filename, e.strerror, e.errno)) |
test = KeyboardTest(kbd_image, bindings) |