Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added device_id support via ENV variable or auto uuid values #104

Merged
merged 4 commits into from
Jul 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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