本文整理汇总了Python中tests.mocks.EngineEmul.find_file方法的典型用法代码示例。如果您正苦于以下问题:Python EngineEmul.find_file方法的具体用法?Python EngineEmul.find_file怎么用?Python EngineEmul.find_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.mocks.EngineEmul
的用法示例。
在下文中一共展示了EngineEmul.find_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestEngine
# 需要导入模块: from tests.mocks import EngineEmul [as 别名]
# 或者: from tests.mocks.EngineEmul import find_file [as 别名]
class TestEngine(BZTestCase):
def setUp(self):
super(TestEngine, self).setUp()
self.obj = EngineEmul()
self.paths = local_paths_config()
def test_find_file(self):
self.sniff_log(self.obj.log)
config = RESOURCES_DIR + "json/get-post.json"
configs = [config, self.paths]
self.obj.configure(configs)
self.assertEqual(2, len(self.obj.file_search_paths))
self.obj.find_file(config)
self.assertEqual("", self.log_recorder.warn_buff.getvalue())
self.obj.find_file("reporting.json")
self.assertIn("Guessed location", self.log_recorder.warn_buff.getvalue())
self.obj.find_file("definitely_missed.file")
self.assertIn("Could not find", self.log_recorder.warn_buff.getvalue())
self.obj.find_file("http://localhost:8000/BlazeDemo.html")
self.assertIn("Downloading http://localhost:8000/BlazeDemo.html", self.log_recorder.info_buff.getvalue())
def test_missed_config(self):
configs = ['definitely_missed.file']
try:
self.obj.configure(configs)
self.fail()
except TaurusConfigError as exc:
self.assertIn('reading config file', str(exc))
def test_configuration_smoothness(self):
def find_ad_dict_ed(*args):
if isinstance(args[0], dict) and not isinstance(args[0], BetterDict):
raise BaseException("dict found in Configuration")
configs = [
RESOURCES_DIR + "json/get-post.json",
self.paths]
self.obj.configure(configs)
self.assertTrue(isinstance(self.obj.config, Configuration))
BetterDict.traverse(self.obj.config, find_ad_dict_ed)
def test_requests(self):
configs = [
RESOURCES_DIR + "json/get-post.json",
RESOURCES_DIR + "json/reporting.json",
self.paths]
self.obj.configure(configs)
self.obj.prepare()
for executor in self.obj.provisioning.executors:
executor.env.set({"TEST_MODE": "files"})
self.obj.run()
self.obj.post_process()
def test_double_exec(self):
configs = [
RESOURCES_DIR + "yaml/triple.yml",
RESOURCES_DIR + "json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.assertEquals(1, len(self.obj.services))
for executor in self.obj.provisioning.executors:
executor.env.set({"TEST_MODE": "files"})
self.obj.run()
self.obj.post_process()
def test_unknown_module(self):
configs = [
RESOURCES_DIR + "json/gatling.json",
self.paths
]
self.obj.configure(configs)
self.obj.config["provisioning"] = "unknown"
self.obj.config["modules"]["unknown"] = BetterDict()
self.assertRaises(TaurusConfigError, self.obj.prepare)
def test_null_aggregator(self):
self.obj.config.merge({
"execution": [{
"scenario": {
"requests": [{"url": "http://example.com/"}],
}}],
"settings": {
"aggregator": None,
"default-executor": "jmeter",
},
"modules": {
"local": "bzt.modules.provisioning.Local",
#.........这里部分代码省略.........