本文整理汇总了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)