Skip to content

Commit

Permalink
Merge pull request #104 from devilankur18/master
Browse files Browse the repository at this point in the history
Added device_id support via ENV variable or auto uuid values
  • Loading branch information
budtmo authored Jul 31, 2018
2 parents d0271e0 + c4be3a1 commit d13e60a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import os
import subprocess
import uuid

from src import CHROME_DRIVER, CONFIG_FILE, ROOT
from src import log
Expand Down Expand Up @@ -192,6 +193,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))

avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
logger.info('AVD name: {avd}'.format(avd=avd_name))
Expand All @@ -208,9 +211,9 @@ def run():
cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size))

if is_first_run:
cmd = 'emulator/emulator @{name} -gpu off -verbose -wipe-data'.format(name=avd_name)
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose -wipe-data'.format(name=avd_name, uuid=device_id)
else:
cmd = 'emulator/emulator @{name} -gpu off -verbose'.format(name=avd_name)
cmd = 'emulator/emulator @{name} -gpu off -prop emu.uuid={uuid} -verbose'.format(name=avd_name, uuid=device_id)
appium = convert_str_to_bool(str(os.getenv('APPIUM', False)))
if appium:
subprocess.Popen(cmd.split())
Expand Down

0 comments on commit d13e60a

Please sign in to comment.