本文整理匯總了Python中ufora.test.PerformanceTestReporter.loadTestsFromFile方法的典型用法代碼示例。如果您正苦於以下問題:Python PerformanceTestReporter.loadTestsFromFile方法的具體用法?Python PerformanceTestReporter.loadTestsFromFile怎麽用?Python PerformanceTestReporter.loadTestsFromFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ufora.test.PerformanceTestReporter
的用法示例。
在下文中一共展示了PerformanceTestReporter.loadTestsFromFile方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_reporting_to_file
# 需要導入模塊: from ufora.test import PerformanceTestReporter [as 別名]
# 或者: from ufora.test.PerformanceTestReporter import loadTestsFromFile [as 別名]
def test_reporting_to_file(self):
tempDir = tempfile.mkdtemp()
tempFile = os.path.join(tempDir, "data.json")
with SetEnv(
PerformanceTestReporter.TEST_DATA_LOCATION_ENVIRONMENT_VARIABLE,
tempFile
):
PerformanceTestReporter.recordTest("test1.result", 10.0, {"some":"metadata"})
PerformanceTestReporter.recordTest("test1.result", None, {"some":"metadata"})
testData = PerformanceTestReporter.loadTestsFromFile(tempFile)
self.assertEqual(testData,
[{"name":"test1.result", "time":10.0, "metadata": {"some":"metadata"}},
{"name":"test1.result", "time":None, "metadata": {"some":"metadata"}}
])
示例2: test_throughputDoesNotFailOnTimeoutIfSomePassed
# 需要導入模塊: from ufora.test import PerformanceTestReporter [as 別名]
# 或者: from ufora.test.PerformanceTestReporter import loadTestsFromFile [as 別名]
def test_throughputDoesNotFailOnTimeoutIfSomePassed(self):
tempDir = tempfile.mkdtemp()
tempFile = os.path.join(tempDir, "data.json")
with SetEnv(
PerformanceTestReporter.TEST_DATA_LOCATION_ENVIRONMENT_VARIABLE,
tempFile
):
def testFunOfN(n):
if n < 10:
pass
else:
raise PerformanceTestReporter.TimedOutException("timed out!!")
PerformanceTestReporter.testThroughput(
"test1", testFunOfN = testFunOfN)
testData = PerformanceTestReporter.loadTestsFromFile(tempFile)
self.assertEqual(len(testData), 1)