本文整理汇总了Python中TestCase.TestCase.prepare方法的典型用法代码示例。如果您正苦于以下问题:Python TestCase.prepare方法的具体用法?Python TestCase.prepare怎么用?Python TestCase.prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestCase.TestCase
的用法示例。
在下文中一共展示了TestCase.prepare方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runBenchmark
# 需要导入模块: from TestCase import TestCase [as 别名]
# 或者: from TestCase.TestCase import prepare [as 别名]
def runBenchmark(self,benchmark,stdout):
config = self.getConfiguration()
testCase = TestCase(config,stdout)
testCase.prepare(benchmark)
self.scanFedSizes(benchmark,testCase)
testCase.destroy()
示例2: __init__
# 需要导入模块: from TestCase import TestCase [as 别名]
# 或者: from TestCase.TestCase import prepare [as 别名]
class RestartableRunner:
"""class for running a single configuration without writing out
any results. Can be asked to restart stop and restart the EVB."""
def __init__(self, testRunner):
# @param testRunner is used to get the requested
# EVB configuration. It should inherit
# from class TestRunner and have a method
# getConfiguration()
self.testRunner = testRunner
# flag whether EVB should be restarted
# after it was stopped or not
self.stopFlag = False
# flag for 'evb was started'
self.evbStarted = threading.Event()
self.evbStopped = threading.Event()
self.evbStopped.set()
# queues for communication with
# callback which is called after
# the startup of the EVB
from Queue import Queue
# used to signal that the EVB should be stopped
self.stopQueue = Queue()
# acknowledgement events that EVB was stopped
self.stopAckQueue = Queue()
# callback which is called after a TestCaseObject was created
self.beforeScanStartCallback = None
self.testCase = None
def run(self, stdout):
logging.info("RestartableRunner.run() called")
self.testRunner.startLaunchers()
# TODO: check if all launchers are responding (with timeout)
# instead of waiting for a fixed amount of time
time.sleep(5)
configData = self.testRunner.getAllConfigurations()[0]
config = configData['config']
testName = configData['name']
try:
while not self.stopFlag:
try:
self.testCase = TestCase(config, stdout, afterStartupCallback=self.afterStartupCallback)
self.testCase.prepare(testName)
fragSize = self.testRunner.getFedSizes()
assert len(fragSize) == 1
fragSize = fragSize[0]
fragSizeRMS = int(fragSize * self.testRunner.args['rms'])
# this should only terminate when the user terminates the optimization
self.testCase.runScan(fragSize, fragSizeRMS, self.testRunner.args)
# evb was stopped
self.evbStarted.clear()
self.evbStopped.set()
self.testCase.destroy()
self.testCase = None
except BadConfig:
self.stopFlag = True
sys.exit(1)
finally:
self.testRunner.stopLaunchers()
def checkApplicationsEnabled(self):
# @return true if all applications are in 'Enabled' state
# note that this gives only meaningful results
# while run() is running
if not self.testCase is None:
try:
self.testCase.checkState('Enabled')
return True
except (StateException, FailedState), ex:
# some are not in Enabled state
return False
return None