airtest.core.helper module

class G[source]

Bases: object

Represent the globals variables

BASEDIR = []
LOGGER = <airtest.utils.logwraper.AirtestLogger object>
LOGGING = <logging.Logger object>
SCREEN = None
DEVICE = None
DEVICE_LIST = []
RECENT_CAPTURE = None
RECENT_CAPTURE_PATH = None
CUSTOM_DEVICES = {}
classmethod add_device(dev)[source]

Add device instance in G and set as current device.

Examples

G.add_device(Android())

Parameters:dev – device to init
Returns:None
classmethod register_custom_device(device_cls)[source]
set_logdir(dirpath)[source]

set log dir for logfile and screenshots.

Parameters:dirpath – directory to save logfile and screenshots

Returns:

log(arg, trace='')[source]

Insert user log, will be displayed in Html report.

Parameters:
  • data – log message or Exception
  • trace – log traceback if exists, use traceback.format_exc to get best format
Returns:

None

logwrap(f)[source]
device_platform(device=None)[source]
using(path)[source]
import_device_cls(platform)[source]

lazy import device class

delay_after_operation()[source]