Skip to content

Commit

Permalink
Check for existence before accessing options and kwargs in tests
Browse files Browse the repository at this point in the history
 - Added TV model for autodetection
  • Loading branch information
dtmilano committed Mar 23, 2017
1 parent 57be54b commit d4396b9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/com/dtmilano/android/viewclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@author: Diego Torres Milano
'''

__version__ = '13.1.5'
__version__ = '13.1.6'

import sys
import warnings
Expand Down Expand Up @@ -3983,7 +3983,7 @@ def writeImageToFile(self, filename, _format="PNG", deviceart=None, dropshadow=T
deviceart = 'nexus_7' # 2012
elif hardware == 'flo':
deviceart = 'nexus_7_2013'
elif hardware in ['mt5861', 'mt5890']:
elif hardware in ['mt5861', 'mt5890', 'maserati']:
deviceart = 'tv_1080p'
elif hardware == 'universal5410':
deviceart = 'samsung_s4'
Expand Down Expand Up @@ -4461,7 +4461,7 @@ def setUpClass(cls):

@classmethod
def tearDownClass(cls):
if cls.kwargs2['useuiautomatorhelper']:
if 'useuiautomatorhelper' in cls.kwargs2 and cls.kwargs2['useuiautomatorhelper']:
for d in cls.globalDevices:
d.vc.uiAutomatorHelper.quit()

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

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

0 comments on commit d4396b9

Please sign in to comment.