本文整理汇总了Python中tests.__dir__函数的典型用法代码示例。如果您正苦于以下问题:Python __dir__函数的具体用法?Python __dir__怎么用?Python __dir__使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__dir__函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_reread
def test_reread(self):
obj = ChromeProfiler()
obj.engine = EngineEmul()
obj.settings.merge({
"processors": {
"trace": {
"class": "bzt.modules.chrome.TraceProcessor",
"extractors": ["bzt.modules.chrome.MemoryMetricsExtractor"]
}
}
})
listener = RecordingListener()
obj.add_listener(listener)
shutil.copy(__dir__() + "/../chrome/trace.json", obj.engine.artifacts_dir)
obj.prepare()
obj.startup()
for _ in range(3):
obj.check()
time.sleep(1)
shutil.copy(__dir__() + "/../chrome/trace.json", obj.engine.artifacts_dir)
for _ in range(3):
obj.check()
time.sleep(1)
obj.shutdown()
obj.post_process()
开发者ID:PurdyForks,项目名称:taurus,代码行数:29,代码来源:test_chrome.py
示例2: test_install_Grinder
def test_install_Grinder(self):
path = os.path.abspath(__dir__() + "/../../build/tmp/grinder-taurus/lib/grinder.jar")
shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)
self.assertFalse(os.path.exists(path))
obj = GrinderExecutor()
obj.engine = EngineEmul()
obj.settings.merge({"path": path})
obj.settings.merge(
{
"properties-file": __dir__() + "/../grinder/grinder.base.properties",
"properties": {"sample_prop": "some_val"},
}
)
obj.execution.merge(
{
"scenario": {
"script": __dir__() + "/../grinder/helloworld.py",
"properties-file": __dir__() + "/..//grinder/grinder.properties",
"properties": {"grinder.useConsole": "false"},
}
}
)
obj.prepare()
self.assertTrue(os.path.exists(path))
开发者ID:VegiS,项目名称:taurus,代码行数:27,代码来源:test_Grinder.py
示例3: test_install_tools
def test_install_tools(self):
"""
check installation of selenium-server, junit
:return:
"""
dummy_installation_path = os.path.abspath(__dir__() + "/../../build/tmp/selenium-taurus")
base_link = "file://" + __dir__() + "/../data/"
shutil.rmtree(os.path.dirname(dummy_installation_path), ignore_errors=True)
selenium_server_link = SeleniumExecutor.SELENIUM_DOWNLOAD_LINK
SeleniumExecutor.SELENIUM_DOWNLOAD_LINK = base_link + "selenium-server-standalone-2.46.0.jar"
junit_link = SeleniumExecutor.JUNIT_DOWNLOAD_LINK
SeleniumExecutor.JUNIT_DOWNLOAD_LINK = base_link + "junit-4.12.jar"
self.assertFalse(os.path.exists(dummy_installation_path))
obj = SeleniumExecutor()
obj.engine = EngineEmul()
obj.settings.merge({"selenium-tools": {
"junit": {"selenium-server": os.path.join(dummy_installation_path, "selenium-server.jar")}}})
obj.settings.merge({"selenium-tools": {
"junit": {"path": os.path.join(dummy_installation_path, "tools", "junit", "junit.jar")}}})
obj.execution = BetterDict()
obj.execution.merge({"scenario": {"script": os.path.abspath(__dir__() + "/../../tests/selenium/jar/")}})
obj.prepare()
self.assertTrue(os.path.exists(os.path.join(dummy_installation_path, "selenium-server.jar")))
self.assertTrue(os.path.exists(os.path.join(dummy_installation_path, "tools", "junit", "junit.jar")))
SeleniumExecutor.SELENIUM_DOWNLOAD_LINK = selenium_server_link
SeleniumExecutor.JUNIT_DOWNLOAD_LINK = junit_link
开发者ID:maribezler,项目名称:taurus,代码行数:32,代码来源:test_SeleniumExecutor.py
示例4: test_merge
def test_merge(self):
obj = Configuration()
configs = [
__dir__() + "/yaml/test.yml",
__dir__() + "/json/merge1.json",
__dir__() + "/json/merge2.json",
]
obj.load(configs)
fname = tempfile.mkstemp()[1]
obj.dump(fname, Configuration.JSON)
with open(fname) as fh:
logging.debug("JSON:\n%s", fh.read())
jmeter = obj['modules']['jmeter']
classval = jmeter['class']
self.assertEquals("bzt.modules.jmeter.JMeterExecutor", classval)
self.assertEquals("value", obj['key'])
self.assertEquals(6, len(obj["list-append"]))
self.assertEquals(2, len(obj["list-replace"]))
self.assertEquals(2, len(obj["list-replace-notexistent"]))
self.assertIsInstance(obj["list-complex"][1][0], BetterDict)
self.assertIsInstance(obj["list-complex"][1][0], BetterDict)
self.assertIsInstance(obj["list-complex"][1][0], BetterDict)
self.assertFalse("properties" in jmeter)
fname = tempfile.mkstemp()[1]
obj.dump(fname, Configuration.JSON)
checker = Configuration()
checker.load([fname])
token = checker["list-complex"][1][0]['token']
self.assertNotEquals('test', token)
token_orig = obj["list-complex"][1][0]['token']
self.assertEquals('test', token_orig)
开发者ID:dutchb,项目名称:taurus,代码行数:32,代码来源:test_configuration.py
示例5: test_install_jmeter
def test_install_jmeter(self):
path = os.path.abspath(__dir__() + "/../../build/tmp/jmeter-taurus/bin/jmeter")
shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)
jmeter_link = JMeterExecutor.JMETER_DOWNLOAD_LINK
jmeter_ver = JMeterExecutor.JMETER_VER
plugins_link = JMeterExecutor.PLUGINS_DOWNLOAD_TPL
JMeterExecutor.JMETER_DOWNLOAD_LINK = "file://" + __dir__() + "/../data/jmeter-dist-{version}.zip"
JMeterExecutor.PLUGINS_DOWNLOAD_TPL = "file://" + __dir__() + "/../data/jmeter-plugins-{plugin}.zip"
JMeterExecutor.JMETER_VER = '2.13'
self.assertFalse(os.path.exists(path))
obj = JMeterExecutor()
obj.engine = EngineEmul()
obj.settings.merge({"path": path})
obj.execution = BetterDict()
obj.execution.merge({"scenario": {"requests": []}})
obj.prepare()
self.assertTrue(os.path.exists(path))
obj.prepare()
JMeterExecutor.JMETER_DOWNLOAD_LINK = jmeter_link
JMeterExecutor.PLUGINS_DOWNLOAD_TPL = plugins_link
JMeterExecutor.JMETER_VER = jmeter_ver
开发者ID:cherednichenko,项目名称:taurus,代码行数:31,代码来源:test_JMeterExecutor.py
示例6: test_jmx_shorthand
def test_jmx_shorthand(self):
ret = self.obj.perform([
__dir__() + "/json/mock_normal.json",
__dir__() + "/jmx/dummy.jmx",
__dir__() + "/jmx/dummy.jmx",
])
self.assertEquals(0, ret)
开发者ID:SPSCommerce,项目名称:taurus,代码行数:7,代码来源:test_CLI.py
示例7: test_selenium_startup_shutdown_jar_single
def test_selenium_startup_shutdown_jar_single(self):
"""
runt tests from single jar
:return:
"""
obj = self.get_selenium_executor()
obj.engine.config.merge({
'execution': {
'scenario': {'script': __dir__() + '/../selenium/jar/'},
'executor': 'selenium'
},
'reporting': [{'module': 'junit-xml'}]
})
obj.engine.config.merge({"provisioning": "local"})
obj.execution = obj.engine.config['execution']
obj.execution.merge({"scenario": {"script": __dir__() + "/../selenium/jar/dummy.jar"}})
obj.settings.merge(obj.engine.config.get("modules").get("selenium"))
obj.prepare()
obj.startup()
while not obj.check():
time.sleep(1)
obj.shutdown()
prepared_files = os.listdir(obj.runner.working_dir)
java_files = [fname for fname in prepared_files if fname.endswith(".java")]
class_files = [fname for fname in prepared_files if fname.endswith(".class")]
jars = [fname for fname in prepared_files if fname.endswith(".jar")]
self.assertEqual(len(java_files), 0)
self.assertEqual(len(class_files), 0)
self.assertEqual(len(jars), 1)
self.assertTrue(os.path.exists(obj.runner.settings.get("report-file")))
开发者ID:azweb76,项目名称:taurus,代码行数:31,代码来源:test_SeleniumExecutor.py
示例8: test_iterations_loop_bug
def test_iterations_loop_bug(self):
obj = JMeterExecutor()
obj.engine = EngineEmul()
obj.engine.config[Provisioning.PROV] = 'test'
obj.execution = BetterDict()
obj.execution.merge({"iterations": 10, "scenario": {"script": __dir__() + "/../jmx/http.jmx"}})
obj.prepare()
modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
tg = modified_xml_tree.find(".//ThreadGroup")
loop_ctrl = tg.find(".//elementProp[@name='ThreadGroup.main_controller']")
tg_loops = loop_ctrl.find(".//stringProp[@name='LoopController.loops']")
tg_forever = loop_ctrl.find(".//boolProp[@name='LoopController.continue_forever']")
self.assertEqual(tg_loops.text, "10")
self.assertEqual(tg_forever.text, "false")
obj = JMeterExecutor()
obj.engine = EngineEmul()
obj.engine.config[Provisioning.PROV] = 'test'
obj.execution = BetterDict()
obj.execution.merge({"scenario": {"script": __dir__() + "/../jmx/http.jmx"}})
obj.prepare()
modified_xml_tree = etree.fromstring(open(obj.modified_jmx, "rb").read())
tg = modified_xml_tree.find(".//ThreadGroup")
loop_ctrl = tg.find(".//elementProp[@name='ThreadGroup.main_controller']")
tg_loops = loop_ctrl.find("*[@name='LoopController.loops']")
tg_forever = loop_ctrl.find(".//boolProp[@name='LoopController.continue_forever']")
self.assertEqual(tg_loops.text, "1") # default value, not disabled
self.assertEqual(tg_forever.text, "false")
开发者ID:SPSCommerce,项目名称:taurus,代码行数:28,代码来源:test_JMeterExecutor.py
示例9: test_body_files
def test_body_files(self):
body_file1 = __dir__() + "/jmeter/body-file.dat"
body_file2 = __dir__() + "/jmeter/jmx/http.jmx"
self.engine.config.merge({
'execution': [{
'iterations': 1,
'executor': 'siege',
'scenario': 'bf'}],
'scenarios': {
'bf': {
"requests": [
{
'url': 'http://first.com',
'body-file': body_file1
}, {
'url': 'http://second.com',
'body': 'body2',
'body-file': body_file2}]}}})
self.executor.execution = self.engine.config.get('execution')[0]
scenario = self.executor.get_scenario()
# check body fields in get_requests() results
reqs = list(scenario.get_requests())
body_fields = [req.body for req in reqs]
self.assertIn('sample of body', body_fields[0])
self.assertIn('body2', body_fields[1])
# check body fields and body-files fields after get_requests()
scenario = self.executor.get_scenario()
body_files = [req.get('body-file') for req in scenario.get('requests')]
body_fields = [req.get('body') for req in scenario.get('requests')]
self.assertTrue(all(body_files))
self.assertEqual(None, body_fields[0])
self.assertIn('body2', body_fields[1])
开发者ID:PurdyForks,项目名称:taurus,代码行数:34,代码来源:test_engine.py
示例10: test_install_Grinder
def test_install_Grinder(self):
path = os.path.abspath(__dir__() + "/../../build/tmp/grinder-taurus/lib/grinder.jar")
shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)
grinder_link = GrinderExecutor.DOWNLOAD_LINK
grinder_version = GrinderExecutor.VERSION
GrinderExecutor.DOWNLOAD_LINK = "file://" + __dir__() + "/../data/grinder-{version}_{version}-binary.zip"
GrinderExecutor.VERSION = "3.11"
self.assertFalse(os.path.exists(path))
obj = GrinderExecutor()
obj.engine = EngineEmul()
obj.settings.merge({"path": path})
obj.execution = BetterDict()
obj.execution.merge({"scenario": {
"script": "tests/grinder/helloworld.py",
"properties-file": "tests/grinder/grinder.properties",
"properties": {"grinder.useConsole": "false"}}})
obj.prepare()
self.assertTrue(os.path.exists(path))
obj.prepare()
GrinderExecutor.DOWNLOAD_LINK = grinder_link
GrinderExecutor.VERSION = grinder_version
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:26,代码来源:test_GrinderExecutor.py
示例11: test_install_Gatling
def test_install_Gatling(self):
path = os.path.abspath(__dir__() + "/../../build/tmp/gatling-taurus/bin/gatling" + EXE_SUFFIX)
shutil.rmtree(os.path.dirname(os.path.dirname(path)), ignore_errors=True)
# backup download link and version
gatling_link = GatlingExecutor.DOWNLOAD_LINK
gatling_ver = GatlingExecutor.VERSION
mirrors_link = GatlingExecutor.MIRRORS_SOURCE
GatlingExecutor.DOWNLOAD_LINK = "file:///" + __dir__() + "/../data/gatling-dist-{version}_{version}.zip"
GatlingExecutor.VERSION = '2.1.4'
GatlingExecutor.MIRRORS_SOURCE = "file:///" + __dir__() + "/../data/unicode_file"
self.assertFalse(os.path.exists(path))
obj = GatlingExecutor()
obj.engine = EngineEmul()
obj.settings.merge({"path": path})
obj.execution = BetterDict()
obj.execution.merge({"scenario": {"script": "tests/gatling/BasicSimulation.scala",
"simulation": "mytest.BasicSimulation"}})
obj.prepare()
self.assertTrue(os.path.exists(path))
obj.prepare()
GatlingExecutor.DOWNLOAD_LINK = gatling_link
GatlingExecutor.VERSION = gatling_ver
GatlingExecutor.MIRRORS_SOURCE = mirrors_link
开发者ID:vasischev,项目名称:taurus,代码行数:27,代码来源:test_GatlingExecutor.py
示例12: test_selenium_startup_shutdown_java_single
def test_selenium_startup_shutdown_java_single(self):
"""
run tests from single .java file
:return:
"""
self.obj.engine.config.merge({
'execution': {
'scenario': {'script': __dir__() + '/../selenium/java/'},
'executor': 'selenium'
},
'reporting': [{'module': 'junit-xml'}]
})
self.obj.engine.config.merge({"provisioning": "local"})
self.obj.execution = self.obj.engine.config['execution']
self.obj.execution.merge({"scenario": {"script": __dir__() + "/../selenium/java/TestBlazemeterFail.java"}})
self.obj.settings.merge(self.obj.engine.config.get("modules").get("selenium"))
self.obj.prepare()
self.obj.startup()
while not self.obj.check():
time.sleep(1)
self.obj.shutdown()
prepared_files = os.listdir(self.obj.runner.working_dir)
java_files = [fname for fname in prepared_files if fname.endswith(".java")]
class_files = [fname for fname in prepared_files if fname.endswith(".class")]
jars = [fname for fname in prepared_files if fname.endswith(".jar")]
self.assertEqual(1, len(java_files))
self.assertEqual(1, len(class_files))
self.assertEqual(1, len(jars))
self.assertTrue(os.path.exists(os.path.join(self.obj.runner.working_dir, "compiled.jar")))
self.assertTrue(os.path.exists(self.obj.runner.settings.get("report-file")))
开发者ID:dldinternet,项目名称:taurus,代码行数:31,代码来源:test_SeleniumExecutor.py
示例13: test_selenium_startup_shutdown_python_single
def test_selenium_startup_shutdown_python_single(self):
"""
run tests from .py file
:return:
"""
self.obj.engine.config.merge({
'execution': {
'scenario': {'script': __dir__() + '/../selenium/python/'},
'executor': 'selenium'
},
'reporting': [{'module': 'junit-xml'}]
})
self.obj.engine.config.merge({"provisioning": "local"})
self.obj.execution = self.obj.engine.config['execution']
self.obj.execution.merge({"scenario": {
"script": __dir__() + "/../selenium/python/test_blazemeter_fail.py"
}})
self.obj.settings.merge(self.obj.engine.config.get("modules").get("selenium"))
self.obj.prepare()
self.obj.startup()
while not self.obj.check():
time.sleep(1)
self.obj.shutdown()
prepared_files = os.listdir(self.obj.runner.working_dir)
python_files = [fname for fname in prepared_files if fname.endswith(".py")]
self.assertEqual(1, len(python_files))
self.assertTrue(os.path.exists(self.obj.runner.settings.get("report-file")))
开发者ID:dldinternet,项目名称:taurus,代码行数:30,代码来源:test_SeleniumExecutor.py
示例14: test_resource_files_collection_local
def test_resource_files_collection_local(self):
obj = GrinderExecutor()
obj.engine = EngineEmul()
obj.execution.merge({"scenario": {"script": __dir__() + "/../grinder/helloworld.py",
"properties-file": __dir__() + "/../grinder/grinder.properties"}})
obj.prepare()
artifacts = os.listdir(obj.engine.artifacts_dir)
self.assertEqual(len(artifacts), 2)
开发者ID:vasischev,项目名称:taurus,代码行数:8,代码来源:test_GrinderExecutor.py
示例15: test_fail_on_zero_results
def test_fail_on_zero_results(self):
obj = GrinderExecutor()
obj.engine = EngineEmul()
obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})
obj.execution.merge({"concurrency": {"local": 2},
"scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
obj.prepare()
self.assertRaises(RuntimeWarning, obj.post_process)
开发者ID:SanjeebJena,项目名称:taurus,代码行数:8,代码来源:test_Grinder.py
示例16: test_gatling
def test_gatling(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/gatling.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.run()
self.obj.post_process()
开发者ID:Yingmin-Li,项目名称:taurus,代码行数:10,代码来源:test_engine.py
示例17: test_double_exec
def test_double_exec(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/yaml/triple.yml",
__dir__() + "/json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.run()
self.obj.post_process()
开发者ID:AlexeyDeyneko,项目名称:taurus,代码行数:11,代码来源:test_engine.py
示例18: test_requests
def test_requests(self):
configs = [
__dir__() + "/../bzt/10-base.json",
__dir__() + "/json/get-post.json",
__dir__() + "/json/reporting.json",
self.paths
]
self.obj.configure(configs)
self.obj.prepare()
self.obj.prepare()
self.obj.run()
self.obj.post_process()
开发者ID:AlexeyDeyneko,项目名称:taurus,代码行数:12,代码来源:test_engine.py
示例19: test_resource_files_collection_invalid
def test_resource_files_collection_invalid(self):
obj = GrinderExecutor()
obj.engine = EngineEmul()
obj.execution.merge({"scenario": {"script": __dir__() + "/../grinder/helloworld.py",
"properties-file": __dir__() + "/../grinder/grinder_invalid.properties"}})
res_files = obj.resource_files()
artifacts = os.listdir(obj.engine.artifacts_dir)
self.assertEqual(len(res_files), 2)
self.assertEqual(len(artifacts), 2)
self.assertIn("helloworld.py", open(os.path.join(obj.engine.artifacts_dir,
"grinder_invalid.properties")).read())
开发者ID:vasischev,项目名称:taurus,代码行数:12,代码来源:test_GrinderExecutor.py
示例20: test_grinder_widget
def test_grinder_widget(self):
obj = GrinderExecutor()
obj.engine = EngineEmul()
obj.settings.merge({'path': __dir__() + "/../grinder/fake_grinder.jar"})
obj.engine.config.merge({"provisioning": 'local'})
obj.execution.merge({"concurrency": {"local": 2},
"ramp-up": 2,
"hold-for": 2,
"scenario": {"script": __dir__() + "/../grinder/helloworld.py"}})
obj.prepare()
obj.get_widget()
self.assertEqual(obj.widget.widgets[0].text, "Script: helloworld.py")
开发者ID:PurdyForks,项目名称:taurus,代码行数:12,代码来源:test_Grinder.py
注:本文中的tests.__dir__函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论