Assign device_id via environment variable
This commit is contained in:
parent
3673d195ea
commit
972445a8bc
|
@ -4,6 +4,7 @@ import json
|
|||
import logging
|
||||
import os
|
||||
import subprocess
|
||||
import uuid
|
||||
|
||||
from src import CHROME_DRIVER, CONFIG_FILE, ROOT
|
||||
from src import log
|
||||
|
@ -191,6 +192,7 @@ def create_node_config(avd_name: str, browser_name: str, appium_host: str, appiu
|
|||
def run():
|
||||
"""Run app."""
|
||||
device = os.getenv('DEVICE', 'Nexus 5')
|
||||
device_id = os.getenv('DEVICE_ID', str(uuid.uuid4()))
|
||||
logger.info('Device: {device}'.format(device=device))
|
||||
|
||||
avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION)
|
||||
|
@ -208,9 +210,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())
|
||||
|
|
Loading…
Reference in a new issue