Skip to content

Commit d4396b9

Browse files
committed
Check for existence before accessing options and kwargs in tests
- Added TV model for autodetection
1 parent 57be54b commit d4396b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/com/dtmilano/android/viewclient.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
@author: Diego Torres Milano
1919
'''
2020

21-
__version__ = '13.1.5'
21+
__version__ = '13.1.6'
2222

2323
import sys
2424
import warnings
@@ -3983,7 +3983,7 @@ def writeImageToFile(self, filename, _format="PNG", deviceart=None, dropshadow=T
39833983
deviceart = 'nexus_7' # 2012
39843984
elif hardware == 'flo':
39853985
deviceart = 'nexus_7_2013'
3986-
elif hardware in ['mt5861', 'mt5890']:
3986+
elif hardware in ['mt5861', 'mt5890', 'maserati']:
39873987
deviceart = 'tv_1080p'
39883988
elif hardware == 'universal5410':
39893989
deviceart = 'samsung_s4'
@@ -4461,7 +4461,7 @@ def setUpClass(cls):
44614461

44624462
@classmethod
44634463
def tearDownClass(cls):
4464-
if cls.kwargs2['useuiautomatorhelper']:
4464+
if 'useuiautomatorhelper' in cls.kwargs2 and cls.kwargs2['useuiautomatorhelper']:
44654465
for d in cls.globalDevices:
44664466
d.vc.uiAutomatorHelper.quit()
44674467

@@ -4529,7 +4529,7 @@ def setUp(self):
45294529
# A list containing only one device was specified
45304530
self.serialno = __devices[0]
45314531
self.device, self.serialno = ViewClient.connectToDeviceOrExit(serialno=self.serialno, **self.kwargs1)
4532-
if self.options[CulebraOptions.START_ACTIVITY]:
4532+
if CulebraOptions.START_ACTIVITY in self.options and self.options[CulebraOptions.START_ACTIVITY]:
45334533
self.device.startActivity(component=self.options[CulebraOptions.START_ACTIVITY])
45344534
self.vc = ViewClient(self.device, self.serialno, **self.kwargs2)
45354535
# Set the default device, to be consistent with multi-devices case
@@ -4541,7 +4541,7 @@ def tearDown(self):
45414541
pass
45424542

45434543
def preconditions(self):
4544-
if self.options[CulebraOptions.ORIENTATION_LOCKED] is not None:
4544+
if CulebraOptions.ORIENTATION_LOCKED in self.options and self.options[CulebraOptions.ORIENTATION_LOCKED] is not None:
45454545
# If orientation locked was set to a valid orientation value then use it to compare
45464546
# against current orientation (when the test is run)
45474547
return (self.device.display['orientation'] == self.options[CulebraOptions.ORIENTATION_LOCKED])

0 commit comments

Comments
 (0)