Skip to content

Global Setttings

Meteorix edited this page Mar 14, 2019 · 1 revision

global settings

You can use global settings to customize airtest framework. The source code is in airtest/core/settings.py

In your python script, you can use the folowing code to change the global image matching threshold to 0.8 (original is 0.7)

from airtest.core.api import ST
ST.THRESHOLD = 0.8

explaination

    DEBUG = False   # no need 
    LOG_DIR = None   # no need 
    LOG_FILE = "log.txt"   # no need 
    RESIZE_METHOD = staticmethod(cocos_min_strategy)  # used for resizing template image accouding to different screen resolution
    CVSTRATEGY = ["tpl", "sift"]   # image matching methods
    THRESHOLD = 0.7  # [0, 1]   # global image matching threshold
    THRESHOLD_STRICT = 0.7  # [0, 1]  # global image matching threshold for `exists` api
    OPDELAY = 0.1   # sleep 0.1 seconds after every touch/swipe operation
    FIND_TIMEOUT = 20   # default image matching timeout
    FIND_TIMEOUT_TMP = 3   # image matching timeout for `exists` api
    PROJECT_ROOT = os.environ.get("PROJECT_ROOT", "")  # for ``using`` other script, to be deprecated in 1.1.0