added support for custom arguments while running/creating emulator

This commit is contained in:
Ankur Agarwal
2018-08-21 17:50:50 +05:30
parent f3abb0a828
commit a6394bcf74
2 changed files with 11 additions and 4 deletions
+4 -4
View File
@@ -186,8 +186,8 @@ def run():
"""Run app."""
device = os.getenv('DEVICE', 'Nexus 5')
logger.info('Device: {device}'.format(device=device))
device_id = os.getenv('DEVICE_ID', str(uuid.uuid4()))
logger.info('Device Id: {device_id}'.format(device_id=device_id))
custom_args=os.getenv('EMULATOR_ARGS', '')
logger.info('Custom Args: {custom_args}'.format(custom_args=custom_args))
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
logger.info('AVD name: {avd}'.format(avd=avd_name))
@@ -203,9 +203,9 @@ def run():
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))
if is_first_run:
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose -wipe-data'.format(name=avd_name, uuid=device_id)
cmd = 'emulator/emulator @{name} -gpu off -verbose -wipe-data {custom_args}'.format(name=avd_name, custom_args=custom_args)
else:
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose'.format(name=avd_name, uuid=device_id)
cmd = 'emulator/emulator @{name} -gpu off -verbose {custom_args}'.format(name=avd_name, custom_args=custom_args)
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
if appium:
subprocess.Popen(cmd.split())