@@ -40,6 +40,29 @@ def is_master(config):
4040 return not hasattr (config , 'slaveinput' )
4141
4242
43+ def get_launch_attributes (rp_launch_attributes ):
44+ """Generate list of launch attributes for RP.
45+
46+ :param list rp_launch_attributes: rp_launch_attributes option value
47+ :return list: List of dictionaries to be passed to the
48+ RP Python client
49+ """
50+ launch_attrs = []
51+ for rp_attr in rp_launch_attributes :
52+ try :
53+ key , value = rp_attr .split (':' )
54+ attr_dict = {'key' : key , 'value' : value }
55+ except ValueError :
56+ attr_dict = {'value' : rp_attr }
57+
58+ if all (value for value in attr_dict .values ()):
59+ launch_attrs .append (attr_dict )
60+ continue
61+ log .debug ('Failed to process "{0}" attribute, attribute value'
62+ ' should not be empty.' .format (rp_attr ))
63+ return launch_attrs
64+
65+
4366@pytest .mark .optionalhook
4467def pytest_configure_node (node ):
4568 """
@@ -78,8 +101,8 @@ def pytest_sessionstart(session):
78101 retries = int (session .config .getini ('retries' )),
79102 )
80103
81- attributes = [{ 'value' : tag } for tag in
82- session .config .getini ('rp_launch_attributes' )]
104+ attributes = get_launch_attributes (
105+ session .config .getini ('rp_launch_attributes' ))
83106 session .config .py_test_service .start_launch (
84107 session .config .option .rp_launch ,
85108 attributes = attributes ,
0 commit comments