本文整理汇总了Python中unittest.result.TestResult.testsRun方法的典型用法代码示例。如果您正苦于以下问题:Python TestResult.testsRun方法的具体用法?Python TestResult.testsRun怎么用?Python TestResult.testsRun使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unittest.result.TestResult
的用法示例。
在下文中一共展示了TestResult.testsRun方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start
# 需要导入模块: from unittest.result import TestResult [as 别名]
# 或者: from unittest.result.TestResult import testsRun [as 别名]
def start(cls, config_path: str = CONFIG_PATH) -> None:
"""
Starts the runtime server with all components.
:param config_path: Path to an alternative config directory
"""
# server has to be run with root rights - except on travis CI
if not os.geteuid() == 0 and not os.environ.get('TRAVIS'):
sys.exit('Script must be run as root')
cls._stopped = Lock()
signal.signal(signal.SIGTERM, cls._signal_term_handler)
cls.CONFIG_PATH = config_path
# set the config_path at the manager
ConfigManager.set_config_path(config_path)
# read from config the Vlan mode
vlan_activate = ConfigManager.get_server_property("Vlan_On")
cls.VLAN = vlan_activate
# read from config if debug mode is on
log_level = int(ConfigManager.get_server_property("Log_Level"))
debug_mode = False
if log_level is 10:
debug_mode = True
cls.DEBUG = debug_mode
setproctitle("fftserver")
cls._server_stop_event = Event()
cls._pid = os.getpid()
# create instance and give params to the logger object
LoggerSetup.setup(log_level)
# load Router configs
cls.__load_configuration()
for router in cls.get_routers():
cls._running_task.append(None)
cls._waiting_tasks.append(deque())
# start process/thread pool for job and test handling
cls._max_subprocesses = (len(cls._routers) + 1) # plus one for the power strip
cls._task_pool = Pool(processes=cls._max_subprocesses, initializer=init_process,
initargs=(cls._server_stop_event,), maxtasksperchild=1)
cls._task_wait_executor = ThreadPoolExecutor(max_workers=(cls._max_subprocesses * 2))
# start thread for multiprocess stop wait
t = threading.Thread(target=cls._close_wait)
t.start()
# add Namespace and Vlan for each Router
if cls.VLAN:
cls._nv_assistent = NVAssistent("eth0")
for router in cls.get_routers():
logging.debug("Add Namespace and Vlan for Router(" + str(router.id) + ")")
cls._nv_assistent.create_namespace_vlan(router)
# add Namespace and Vlan for 1 Powerstrip (expand to more if necessary)
logging.debug("Add Namespace and Vlan for Powerstrip")
cls._nv_assistent.create_namespace_vlan(cls.get_power_strip())
# update Router
cls.router_online(None, update_all=True, blocked=True)
cls.update_router_info(None, update_all=True)
# open database and read old test results
try:
with shelve.open('test_results', 'c') as db:
# read test values
key_list = db.keys()
for k in key_list:
t = TestResult()
dbt = db[str(k)]
t.failures = dbt.failures
t.errors = dbt.errors
t.testsRun = dbt.testsRun
t._original_stdout = None
t._original_stderr = None
cls._test_results.append((dbt.router_id, dbt.test_name, t))
except Exception as e:
logging.error("Error at read test results from DB: {0}".format(e))
logging.info("Runtime Server started")
try:
cls._ipc_server.start_ipc_server(cls, True) # serves forever - works like a while(true)
except (KeyboardInterrupt, SystemExit):
logging.info("Received an interrupt signal")
cls.stop()