本文整理汇总了Python中robot.libraries.BuiltIn.RobotNotRunningError方法的典型用法代码示例。如果您正苦于以下问题:Python BuiltIn.RobotNotRunningError方法的具体用法?Python BuiltIn.RobotNotRunningError怎么用?Python BuiltIn.RobotNotRunningError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类robot.libraries.BuiltIn
的用法示例。
在下文中一共展示了BuiltIn.RobotNotRunningError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self):
# save builtin so we dont have to re-create then everytime
self.builtin = BuiltIn()
# Need to create a testscript
try:
self._pyats_testscript = self.builtin.get_library_instance('pyats.robot.'
'pyATSRobot').testscript
except RobotNotRunningError:
# during libdoc generation
pass
except RuntimeError:
try:
self._pyats_testscript = self.builtin.get_library_instance('ats.robot.'
'pyATSRobot').testscript
except RuntimeError:
# no pyATS
pass
finally:
self._genie_testscript = TestScript(Testscript)
示例2: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self, *args):
self.builtin = BuiltIn()
logger.debug("initializing PageObjects...")
importer = robot.utils.Importer()
for file_path in args:
try:
importer.import_class_or_module_by_path(os.path.abspath(file_path))
logger.debug("imported page object {}".format(file_path))
except Exception as e:
logger.warn(str(e))
self.current_page_object = None
# Start with this library at the front of the library search order;
# that may change as page objects are loaded.
try:
self.builtin.set_library_search_order("PageObjects")
except RobotNotRunningError:
# this should only happen when trying to load this library
# via the robot_libdoc task, in which case we don't care
# whether this throws an error or not.
pass
示例3: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self, debug=False, locators=None):
self.debug = debug
self._session_records = []
# Turn off info logging of all http requests
logging.getLogger("requests.packages.urllib3.connectionpool").setLevel(
logging.WARN
)
if locators:
lex_locators.update(locators)
else:
self._init_locators()
self._faker = faker.Faker("en_US")
try:
self.builtin.set_global_variable("${faker}", self._faker)
except RobotNotRunningError:
# this only happens during unit tests, and we don't care.
pass
示例4: _init_locators
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def _init_locators(self):
"""Load the appropriate locator file for the current version
If no version can be determined, we'll use the highest numbered
locator file name.
"""
try:
version = int(float(self.get_latest_api_version()))
self.builtin.set_suite_metadata("Salesforce API Version", version)
locator_module_name = "locators_{}".format(version)
except RobotNotRunningError:
# We aren't part of a running test, likely because we are
# generating keyword documentation. If that's the case we'll
# use the latest supported version
here = os.path.dirname(__file__)
files = sorted(glob.glob(os.path.join(here, "locators_*.py")))
locator_module_name = os.path.basename(files[-1])[:-3]
self.locators_module = importlib.import_module(
"cumulusci.robotframework." + locator_module_name
)
lex_locators.update(self.locators_module.lex_locators)
示例5: _initiate
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def _initiate(self, port=0, debug=False, java9_or_newer='auto-detect'):
if RemoteSwingLibrary.DEBUG is None:
RemoteSwingLibrary.DEBUG = _tobool(debug)
if RemoteSwingLibrary.PORT is None:
RemoteSwingLibrary.PORT = self._start_port_server(int(port))
if java9_or_newer == 'auto-detect':
RemoteSwingLibrary.JAVA9_OR_NEWER = _tobool(self._java9_or_newer())
elif _tobool(java9_or_newer):
RemoteSwingLibrary.JAVA9_OR_NEWER = True
try:
if '__pyclasspath__' in RemoteSwingLibrary.AGENT_PATH:
RemoteSwingLibrary.AGENT_PATH = RemoteSwingLibrary.read_python_path_env()
BuiltIn().set_global_variable('\${REMOTESWINGLIBRARYPATH}',
self._escape_path(RemoteSwingLibrary.AGENT_PATH))
BuiltIn().set_global_variable('\${REMOTESWINGLIBRARYPORT}', RemoteSwingLibrary.PORT)
self._output_dir = BuiltIn().get_variable_value('${OUTPUTDIR}')
except RobotNotRunningError:
pass
示例6: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self, visible=True, timeout='30', wait_time='0.5', wait_time_after_write='0', img_folder='.'):
"""You can change to hide the emulator screen set the argument visible=${False}
For change the wait_time see `Change Wait Time`, to change the img_folder
see the `Set Screenshot Folder` and to change the timeout see the `Change Timeout` keyword.
"""
self.lu = None
self.host = None
self.port = None
self.credential = None
self.imgfolder = img_folder
# Try Catch to run in Pycharm, and make a documentation in libdoc with no error
try:
self.output_folder = BuiltIn().get_variable_value('${OUTPUT DIR}')
except RobotNotRunningError as rnrex:
if "Cannot access execution context" in str(rnrex):
self.output_folder = os.getcwd()
else:
raise RobotNotRunningError()
except Exception as e:
raise AssertionError(e)
self.wait = float(wait_time)
self.wait_write = float(wait_time_after_write)
self.timeout = int(timeout)
self.visible = visible
self.mf = None
示例7: _s2l
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def _s2l(self):
try:
return BuiltIn().get_library_instance('SeleniumLibrary')
except RobotNotRunningError:
from SeleniumLibrary import SeleniumLibrary
return SeleniumLibrary()
示例8: _make_up_filename
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def _make_up_filename(self):
try:
path = BuiltIn().get_variable_value('${SUITE NAME}')
path = '%s-screenshot' % path.replace(' ', '')
except RobotNotRunningError:
LOGGER.info('Could not get suite name, using '
'default naming scheme')
path = 'ImageHorizon-screenshot'
path = '%s-%d.png' % (path, self.screenshot_counter)
self.screenshot_counter += 1
return path
示例9: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self):
self._browsers = {}
self._current_name = None
self._current_app = None
self._type = None
self._verbose = False
self._ajax_timeout = int(Common.get_config_value('ajax-timeout','web','5'))
self._type = 'webapp'
self._selenium = None # SeleniumLibrary instance
self._site = 'http://'
try:
self._selenium = BuiltIn().get_library_instance('SeleniumLibrary')
except RobotNotRunningError as e:
Common.err("WARN: RENAT is not running")
示例10: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self):
folder = os.path.dirname(__file__)
sys.path.append(folder)
self._clients = {}
self._cur_name = ""
self._test_id = None
self._config_path = None
try:
BuiltIn().get_library_instance('VChannel')
mod_list = glob.glob(Common.get_renat_path() + '/tester_mod/*.py')
keyword_list = []
for item in mod_list:
if item.startswith('_'): continue
mod_name = os.path.basename(item).replace('.py','')
mod = import_module('tester_mod.' + mod_name)
cmd_list = inspect.getmembers(mod, inspect.isfunction)
for cmd,data in cmd_list:
if not cmd.startswith('_') and cmd not in keyword_list:
keyword_list.append(cmd)
def gen_xrun(cmd):
def _xrun(self,*args,**kwargs):
return self._xrun(cmd,*args,**kwargs)
return _xrun
setattr(self,cmd,MethodType(gen_xrun(cmd),self))
except RobotNotRunningError as e:
Common.err("WARN: RENAT is not running")
示例11: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self):
self._current_name = None
self._current_id = None
self._channels = {}
self._max_id = 0
self._ssh_prompt = '\[.*@.*\] '
self._ssh_lib = SSHLibrary.SSHLibrary()
# ignore SSL verify
self._ssl_context = ssl._create_unverified_context()
try:
mod_list = glob.glob(Common.get_renat_path() + '/hypervisor_mod/*.py')
keyword_list = []
for item in mod_list:
if item.startswith('_'): continue
mod_name = os.path.basename(item).replace('.py','')
mod = import_module('hypervisor_mod.' + mod_name)
cmd_list = inspect.getmembers(mod, inspect.isfunction)
for cmd,data in cmd_list:
if not cmd.startswith('_') and cmd not in keyword_list:
keyword_list.append(cmd)
def gen_xrun(cmd):
def _xrun(self,*args,**kwargs):
return self.xrun(cmd,*args,**kwargs)
return _xrun
setattr(self,cmd,MethodType(gen_xrun(cmd),self))
except RobotNotRunningError as e:
Common.err("WARN: RENAT is not running")
示例12: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self):
try:
self._vchannel = BuiltIn().get_library_instance('VChannel')
if self._vchannel is None:
raise Exception("Could not find an instance of VChannel. Need import VChannel first")
except RobotNotRunningError as e:
Common.err("WARN: RENAT is not running")
示例13: __init__
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def __init__(self):
folder = os.path.dirname(__file__)
sys.path.append(folder)
try:
self._vchannel = BuiltIn().get_library_instance('VChannel')
if self._vchannel is None:
raise Exception("Could not find an instance of VChannel. Need import VChannel first")
else:
keyword_list = inspect.getmembers(self._vchannel,inspect.ismethod)
for keyword,body in keyword_list:
if not keyword.startswith('_'):
setattr(self,keyword,body)
# sync the nanme with current VChannel instance
self._cur_name = self._vchannel._current_name
#
mod_list = glob.glob(Common.get_renat_path() + '/router_mod/*.py')
keyword_list = []
for item in mod_list:
# BuiltIn().log_to_console(item)
if item.startswith('_'): continue
mod_name = os.path.basename(item).replace('.py','')
# BuiltIn().log_to_console(mod_name)
mod = import_module('router_mod.' + mod_name)
cmd_list = inspect.getmembers(mod, inspect.isfunction)
for cmd,data in cmd_list:
if not cmd.startswith('_') and cmd not in keyword_list:
keyword_list.append(cmd)
# BuiltIn().log_to_console(' ' + cmd)
def gen_xrun(cmd):
def _xrun(self,*args,**kwargs):
return self.xrun(cmd,*args,**kwargs)
return _xrun
setattr(self,cmd,MethodType(gen_xrun(cmd),self))
except RobotNotRunningError as e:
Common.err("WARN: RENAT is not running")
示例14: _log_level
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def _log_level(self):
try:
level = BuiltIn().get_variable_value("${APPIUM_LOG_LEVEL}", default='DEBUG')
except RobotNotRunningError:
level = 'DEBUG'
return level
示例15: _log_directory
# 需要导入模块: from robot.libraries import BuiltIn [as 别名]
# 或者: from robot.libraries.BuiltIn import RobotNotRunningError [as 别名]
def _log_directory(self):
try:
logfile = BuiltIn().get_variable_value("${LOG FILE}")
if logfile is None:
return BuiltIn().get_variable_value("${OUTPUTDIR}")
return os.path.dirname(logfile)
except RobotNotRunningError:
return os.getcwdu() if PY2 else os.getcwd() # pylint: disable=no-member