本文整理汇总了Python中testscenarios.multiply_scenarios函数的典型用法代码示例。如果您正苦于以下问题:Python multiply_scenarios函数的具体用法?Python multiply_scenarios怎么用?Python multiply_scenarios使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了multiply_scenarios函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_tests_input_scenario_utils
def load_tests_input_scenario_utils(*args):
"""
Wrapper for testscenarios to set the scenarios to avoid running a getattr
on the CONF object at import.
"""
if getattr(args[0], "suiteClass", None) is not None:
loader, standard_tests, pattern = args
else:
standard_tests, module, loader = args
output = None
scenario_utils = None
try:
scenario_utils = InputScenarioUtils()
scenario_flavor = scenario_utils.scenario_flavors
scenario_image = scenario_utils.scenario_images
except (exc_lib.InvalidCredentials, TypeError):
output = standard_tests
finally:
if scenario_utils:
scenario_utils.clear_creds()
if output is not None:
return output
for test in testtools.iterate_tests(standard_tests):
setattr(test, "scenarios", testscenarios.multiply_scenarios(scenario_image, scenario_flavor))
return testscenarios.load_tests_apply_scenarios(*args)
示例2: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(cls._v1,
cls._v2,
cls._topics,
cls._priority,
cls._payload,
cls._context)
示例3: generate_scenarios
def generate_scenarios(cls):
attr = [
('exchange', dict(attr='exchange')),
('topic', dict(attr='topic')),
('namespace', dict(attr='namespace')),
('version', dict(attr='version')),
('server', dict(attr='server')),
('fanout', dict(attr='fanout')),
]
a = [
('a_notset', dict(a_value=_notset)),
('a_none', dict(a_value=None)),
('a_empty', dict(a_value='')),
('a_foo', dict(a_value='foo')),
('a_bar', dict(a_value='bar')),
]
b = [
('b_notset', dict(b_value=_notset)),
('b_none', dict(b_value=None)),
('b_empty', dict(b_value='')),
('b_foo', dict(b_value='foo')),
('b_bar', dict(b_value='bar')),
]
cls.scenarios = testscenarios.multiply_scenarios(attr, a, b)
for s in cls.scenarios:
s[1]['equals'] = (s[1]['a_value'] == s[1]['b_value'])
示例4: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(cls._unit_system,
cls._sign,
cls._magnitude,
cls._unit_prefix,
cls._unit_suffix,
cls._return_int)
示例5: generate_scenarios
def generate_scenarios(cls):
workflow_scenarios = []
for name, wf_change in cls.workflow_scenarios:
wf = cls.default_workflow.copy()
wf.update(wf_change)
workflow_scenarios.append((name, wf))
cls.scenarios = testscenarios.multiply_scenarios(cls.sample_scenarios, workflow_scenarios)
示例6: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(cls._n_senders,
cls._context,
cls._reply,
cls._reply_fail,
cls._failure,
cls._timeout)
示例7: generate_scenarios
def generate_scenarios(cls):
impl = [('blocking', dict(executor=impl_blocking.BlockingExecutor,
stop_before_return=True))]
if impl_eventlet is not None:
impl.append(
('eventlet', dict(executor=impl_eventlet.EventletExecutor,
stop_before_return=False)))
cls.scenarios = testscenarios.multiply_scenarios(impl)
示例8: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(
cls._image_name,
cls._file_format,
cls._virtual_size,
cls._disk_size,
cls._garbage_before_snapshot,
cls._snapshot_count)
示例9: generate_scenarios
def generate_scenarios(cls):
impl = [
('blocking', dict(executor=impl_blocking.BlockingExecutor)),
('threaded', dict(executor=impl_thread.ThreadExecutor)),
]
if impl_eventlet is not None:
impl.append(
('eventlet', dict(executor=impl_eventlet.EventletExecutor)))
cls.scenarios = testscenarios.multiply_scenarios(impl)
示例10: generate_scenarios
def generate_scenarios(cls):
impl = [
("blocking", dict(executor=impl_blocking.BlockingExecutor)),
("threaded", dict(executor=impl_thread.ThreadExecutor)),
]
if impl_eventlet is not None:
impl.append(("eventlet", dict(executor=impl_eventlet.EventletExecutor)))
if impl_aioeventlet is not None:
impl.append(("aioeventlet", dict(executor=impl_aioeventlet.AsyncioEventletExecutor)))
cls.scenarios = testscenarios.multiply_scenarios(impl)
示例11: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(cls._exchanges,
cls._topics,
cls._server,
cls._fanout,
cls._method,
cls._endpoints)
# fanout call not supported
def filter_fanout_call(scenario):
params = scenario[1]
fanout = params['fanout1'] or params['fanout2']
call = params['call1'] or params['call2']
return not (call and fanout)
# listening multiple times on same topic/server pair not supported
def filter_same_topic_and_server(scenario):
params = scenario[1]
single_topic = params['topic1'] == params['topic2']
single_server = params['server1'] == params['server2']
return not (single_topic and single_server)
# fanout to multiple servers on same topic and exchange
# each endpoint will receive both messages
def fanout_to_servers(scenario):
params = scenario[1]
fanout = params['fanout1'] or params['fanout2']
single_exchange = params['exchange1'] == params['exchange2']
single_topic = params['topic1'] == params['topic2']
multi_servers = params['server1'] != params['server2']
if fanout and single_exchange and single_topic and multi_servers:
params['expect1'] = params['expect1'][:] + params['expect1']
params['expect2'] = params['expect2'][:] + params['expect2']
return scenario
# multiple endpoints on same topic and exchange
# either endpoint can get either message
def single_topic_multi_endpoints(scenario):
params = scenario[1]
single_exchange = params['exchange1'] == params['exchange2']
single_topic = params['topic1'] == params['topic2']
if single_topic and single_exchange and params['multi_endpoints']:
params['expect_either'] = (params['expect1'] +
params['expect2'])
params['expect1'] = params['expect2'] = []
else:
params['expect_either'] = []
return scenario
for f in [filter_fanout_call, filter_same_topic_and_server]:
cls.scenarios = filter(f, cls.scenarios)
for m in [fanout_to_servers, single_topic_multi_endpoints]:
cls.scenarios = map(m, cls.scenarios)
示例12: load_tests_input_scenario_utils
def load_tests_input_scenario_utils(*args):
"""
Wrapper for testscenarios to set the scenarios to avoid running a getattr
on the CONF object at import.
"""
if getattr(args[0], 'suiteClass', None) is not None:
loader, standard_tests, pattern = args
else:
standard_tests, module, loader = args
scenario_utils = InputScenarioUtils()
scenario_flavor = scenario_utils.scenario_flavors
scenario_image = scenario_utils.scenario_images
for test in testtools.iterate_tests(standard_tests):
setattr(test, 'scenarios', testscenarios.multiply_scenarios(
scenario_image,
scenario_flavor))
return testscenarios.load_tests_apply_scenarios(*args)
示例13: CreateMemberAdminStateTests
scenario_listener_F = ('listener_F', {'listener_flag': False})
scenario_pool_T = ('pool_T', {'pool_flag': True})
scenario_pool_F = ('pool_F', {'pool_flag': False})
scenario_member_T = ('member_T', {'member_flag': True})
scenario_member_F = ('member_F', {'member_flag': False})
scenario_mem_to_flag_T = ('member_to_flag_T', {'member_to_flag': True})
scenario_mem_to_flag_F = ('member_to_flag_F', {'member_to_flag': False})
# The following command creates 16 unique scenarios
scenario_create_member = testscenarios.multiply_scenarios(
[scenario_lb_T, scenario_lb_F],
[scenario_listener_T, scenario_listener_F],
[scenario_pool_T, scenario_pool_F],
[scenario_member_T, scenario_member_F])
# The following command creates 32 unique scenarios
scenario_update_member = testscenarios.multiply_scenarios(
[scenario_mem_to_flag_T, scenario_mem_to_flag_F],
scenario_create_member)
class CreateMemberAdminStateTests(base_ddt.AdminStateTests):
scenarios = scenario_create_member
@classmethod
def resource_setup(cls):
示例14: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(cls._max_size,
cls._create_error)
示例15: generate_scenarios
def generate_scenarios(cls):
cls.scenarios = testscenarios.multiply_scenarios(
cls.content_scenarios,
cls.output_file_scenarios)