@@ -26,12 +26,18 @@ from unity8.shell.tests import UnityTestCase, _get_device_emulation_scenarios
27from autopilot.matchers import Eventually
27from autopilot.matchers import Eventually
28from autopilot.platform import model
28from autopilot.platform import model
29from testtools import skipUnless
30from testtools import skipUnless
30from testtools.matchers import Equals
31from testtools.matchers import Equals
31import logging
32import logging
33logger = logging.getLogger(__name__)
34logger = logging.getLogger(__name__)
36+# py2 compatible alias for py3
37+if sys.version >= '3':
35class TestLockscreen(UnityTestCase):
41class TestLockscreen(UnityTestCase):
37 """Tests for the lock screen."""
43 """Tests for the lock screen."""
@@ -125,7 +131,10 @@ class TestLockscreen(UnityTestCase):
127 if not isinstance(code, basestring):
133 if not isinstance(code, basestring):
128− raise TypeError("'code' parameter must be a string.")
135+ "'code' parameter must be a string, not %r."
129 for num in code:
138 for num in code:
130 if not num.isdigit():
139 if not num.isdigit():
131 raise ValueError(
140 raise ValueError(
@@ -142,7 +151,10 @@ class TestLockscreen(UnityTestCase):
144 if not isinstance(passphrase, basestring):
153 if not isinstance(passphrase, basestring):
145− raise TypeError("'passphrase' parameter must be a string.")
155+ "'passphrase' parameter must be a string, not %r."
147 pinentryField = self.main_window.get_pinentryField()
159 pinentryField = self.main_window.get_pinentryField()
148 self.touch.tap_object(pinentryField)
160 self.touch.tap_object(pinentryField)
@@ -161,7 +173,10 @@ class TestLockscreen(UnityTestCase):
163 if not isinstance(passphrase, basestring):
175 if not isinstance(passphrase, basestring):
164− raise TypeError("'passphrase' parameter must be a string.")
177+ "'passphrase' parameter must be a string, not %r."
166 prompt = self.main_window.get_greeter().get_prompt()
181 prompt = self.main_window.get_greeter().get_prompt()
167 self.touch.tap_object(prompt)
182 self.touch.tap_object(prompt)