pytest_cases/fixture_parametrize_plus.py
def _process_argvalues(argnames, marked_argvalues, nb_params):
    """Internal method to use in _pytest_parametrize_plus

    Processes the provided marked_argvalues (possibly marked with pytest.param) and returns
    p_ids, p_marks, argvalues (not marked with pytest.param), fixture_indices

    Note: `marked_argvalues` is modified in the process if a `lazy_value` is found with a custom id or marks.

    :param argnames:
    :param marked_argvalues:
    :param nb_params:
    :return:
    """
    p_ids, p_marks, argvalues = extract_parameterset_info(argnames, marked_argvalues, check_nb=False)

    # find if there are fixture references or lazy values in the values provided
    fixture_indices = []
    if nb_params == 1:
        for i, v in enumerate(argvalues):
            if is_lazy_value(v):
                # Note: no need to modify the id, it will be ok thanks to the lazy_value class design
                # handle marks
                _mks = v.get_marks(as_decorators=True)
                if len(_mks) > 0:
                    # merge with the mark decorators possibly already present with pytest.param
                    if p_marks[i] is None:
                        p_marks[i] = []
                    p_marks[i] = list(p_marks[i]) + _mks

                    # update the marked_argvalues
                    marked_argvalues[i] = ParameterSet(values=(argvalues[i],), id=p_ids[i], marks=p_marks[i])
                del _mks

            if isinstance(v, fixture_ref):
                fixture_indices.append((i, None))
    elif nb_params > 1:
        for i, v in enumerate(argvalues):
            if is_lazy_value(v):
                # a lazy value is used for several parameters at the same time, and is NOT between pytest.param()
                argvalues[i] = v.as_lazy_tuple(nb_params)

                # TUPLE usage: we HAVE to set an id to prevent too early access to the value by _idmaker
                # note that on pytest 2 we cannot set an id here, the lazy value wont be too lazy
                assert p_ids[i] is None
                _id = v.get_id()
                if not has_pytest_param:
                    warn("The custom id %r in `lazy_value` will be ignored as this version of pytest is too old to"
                         " support `pytest.param`." % _id)
                    _id = None

                # handle marks
                _mks = v.get_marks(as_decorators=True)
                if len(_mks) > 0:
                    # merge with the mark decorators possibly already present with pytest.param
                    assert p_marks[i] is None
                    p_marks[i] = _mks

                # note that here argvalues[i] IS a tuple-like so we do not create a tuple around it
                marked_argvalues[i] = ParameterSet(values=argvalues[i], id=_id, marks=_mks)
                p_ids[i] = _id
                del _id, _mks

            elif isinstance(v, fixture_ref):
                # a fixture ref is used for several parameters at the same time
                fixture_indices.append((i, None))

            elif len(v) == 1 and is_lazy_value(v[0]):
                # same than above but it was in a pytest.mark
                # valueref_indices.append((i, None))
                argvalues[i] = v[0].as_lazy_tuple(nb_params)  # unpack it
                if p_ids[i] is None:
                    # force-use the id from the lazy value (do not have pytest request for it, that would unpack it)
                    p_ids[i] = v[0].get_id()
                # handle marks
                _mks = v[0].get_marks(as_decorators=True)
                if len(_mks) > 0:
                    # merge with the mark decorators possibly already present with pytest.param
                    if p_marks[i] is None:
                        p_marks[i] = []
                    p_marks[i] = list(p_marks[i]) + _mks
                del _mks
                marked_argvalues[i] = ParameterSet(values=argvalues[i], id=p_ids[i], marks=p_marks[i])

            elif len(v) == 1 and isinstance(v[0], fixture_ref):
                # same than above but it was in a pytest.mark
                fixture_indices.append((i, None))
                argvalues[i] = v[0]  # unpack it
            else:
                # check for consistency
                if len(v) != len(argnames):
                    raise ValueError("Inconsistent number of values in pytest parametrize: %s items found while the "
                                     "number of parameters is %s: %s." % (len(v), len(argnames), v))

                # let's dig into the tuple
                fix_pos_list = [j for j, _pval in enumerate(v) if isinstance(_pval, fixture_ref)]
                if len(fix_pos_list) > 0:
                    # there is at least one fixture ref inside the tuple
                    fixture_indices.append((i, fix_pos_list))

                # let's dig into the tuple
                # has_val_ref = any(isinstance(_pval, lazy_value) for _pval in v)
                # val_pos_list = [j for j, _pval in enumerate(v) if isinstance(_pval, lazy_value)]
                # if len(val_pos_list) > 0:
                #     # there is at least one value ref inside the tuple
                #     argvalues[i] = tuple_with_value_refs(v, theoreticalsize=nb_params, positions=val_pos_list)

    return p_ids, p_marks, argvalues, fixture_indices
Internal method to use in _pytest_parametrize_plus

    Processes the provided marked_argvalues (possibly marked with pytest.param) and returns
    p_ids, p_marks, argvalues (not marked with pytest.param), fixture_indices

    Note: `marked_argvalues` is modified in the process if a `lazy_value` is found with a custom id or marks.

    :param argnames:
    :param marked_argvalues:
    :param nb_params:
    :return:
    
Internal method to use in _pytest_parametrize_plus
Processes the provided marked_argvalues (possibly marked with pytest.param) and returns
p_ids, p_marks, argvalues (not marked with pytest.param), fixture_indices

`marked_argvalues` is modified in the process if a `lazy_value` is found with a custom id or marks.
Internal method to use in _pytest_parametrize_plus Processes the provided marked_argvalues ( possibly marked with pytest . param ) and returns p_ids p_marks argvalues ( not marked with pytest . param ) fixture_indices ` marked_argvalues ` is modified in the process if a ` lazy_value ` is found with a custom id or marks .
def _process_argvalues(argnames, marked_argvalues, nb_params):
    p_ids, p_marks, argvalues = extract_parameterset_info(argnames, marked_argvalues, check_nb=False)
    fixture_indices = []
    if nb_params == 1:
        for i, v in enumerate(argvalues):
            if is_lazy_value(v):
                _mks = v.get_marks(as_decorators=True)
                if len(_mks) > 0:
                    if p_marks[i] is None:
                        p_marks[i] = []
                    p_marks[i] = list(p_marks[i]) + _mks
                    marked_argvalues[i] = ParameterSet(values=(argvalues[i],), id=p_ids[i], marks=p_marks[i])
                del _mks
            if isinstance(v, fixture_ref):
                fixture_indices.append((i, None))
    elif nb_params > 1:
        for i, v in enumerate(argvalues):
            if is_lazy_value(v):
                argvalues[i] = v.as_lazy_tuple(nb_params)
                assert p_ids[i] is None
                _id = v.get_id()
                if not has_pytest_param:
                    warn("The custom id %r in `lazy_value` will be ignored as this version of pytest is too old to"
                         " support `pytest.param`." % _id)
                    _id = None
                _mks = v.get_marks(as_decorators=True)
                if len(_mks) > 0:
                    assert p_marks[i] is None
                    p_marks[i] = _mks
                marked_argvalues[i] = ParameterSet(values=argvalues[i], id=_id, marks=_mks)
                p_ids[i] = _id
                del _id, _mks
            elif isinstance(v, fixture_ref):
                fixture_indices.append((i, None))
            elif len(v) == 1 and is_lazy_value(v[0]):
                argvalues[i] = v[0].as_lazy_tuple(nb_params)  
                if p_ids[i] is None:
                    p_ids[i] = v[0].get_id()
                _mks = v[0].get_marks(as_decorators=True)
                if len(_mks) > 0:
                    if p_marks[i] is None:
                        p_marks[i] = []
                    p_marks[i] = list(p_marks[i]) + _mks
                del _mks
                marked_argvalues[i] = ParameterSet(values=argvalues[i], id=p_ids[i], marks=p_marks[i])
            elif len(v) == 1 and isinstance(v[0], fixture_ref):
                fixture_indices.append((i, None))
                argvalues[i] = v[0]  
            else:
                if len(v) != len(argnames):
                    raise ValueError("Inconsistent number of values in pytest parametrize: %s items found while the "
                                     "number of parameters is %s: %s." % (len(v), len(argnames), v))
                fix_pos_list = [j for j, _pval in enumerate(v) if isinstance(_pval, fixture_ref)]
                if len(fix_pos_list) > 0:
                    fixture_indices.append((i, fix_pos_list))
    return p_ids, p_marks, argvalues, fixture_indices
def _process_argvalues ( argnames , marked_argvalues , nb_params ) : p_ids , p_marks , argvalues = extract_parameterset_info ( argnames , marked_argvalues , check_nb = False ) fixture_indices = [ ] if nb_params == 1 : for i , v in enumerate ( argvalues ) : if is_lazy_value ( v ) : _mks = v . get_marks ( as_decorators = True ) if len ( _mks ) > 0 : if p_marks [ i ] is None : p_marks [ i ] = [ ] p_marks [ i ] = list ( p_marks [ i ] ) + _mks marked_argvalues [ i ] = ParameterSet ( values = ( argvalues [ i ] , ) , id = p_ids [ i ] , marks = p_marks [ i ] ) del _mks if isinstance ( v , fixture_ref ) : fixture_indices . append ( ( i , None ) ) elif nb_params > 1 : for i , v in enumerate ( argvalues ) : if is_lazy_value ( v ) : argvalues [ i ] = v . as_lazy_tuple ( nb_params ) assert p_ids [ i ] is None _id = v . get_id ( ) if not has_pytest_param : warn ( "The custom id %r in `lazy_value` will be ignored as this version of pytest is too old to" " support `pytest.param`." % _id ) _id = None _mks = v . get_marks ( as_decorators = True ) if len ( _mks ) > 0 : assert p_marks [ i ] is None p_marks [ i ] = _mks marked_argvalues [ i ] = ParameterSet ( values = argvalues [ i ] , id = _id , marks = _mks ) p_ids [ i ] = _id del _id , _mks elif isinstance ( v , fixture_ref ) : fixture_indices . append ( ( i , None ) ) elif len ( v ) == 1 and is_lazy_value ( v [ 0 ] ) : argvalues [ i ] = v [ 0 ] . as_lazy_tuple ( nb_params ) if p_ids [ i ] is None : p_ids [ i ] = v [ 0 ] . get_id ( ) _mks = v [ 0 ] . get_marks ( as_decorators = True ) if len ( _mks ) > 0 : if p_marks [ i ] is None : p_marks [ i ] = [ ] p_marks [ i ] = list ( p_marks [ i ] ) + _mks del _mks marked_argvalues [ i ] = ParameterSet ( values = argvalues [ i ] , id = p_ids [ i ] , marks = p_marks [ i ] ) elif len ( v ) == 1 and isinstance ( v [ 0 ] , fixture_ref ) : fixture_indices . append ( ( i , None ) ) argvalues [ i ] = v [ 0 ] else : if len ( v ) != len ( argnames ) : raise ValueError ( "Inconsistent number of values in pytest parametrize: %s items found while the " "number of parameters is %s: %s." % ( len ( v ) , len ( argnames ) , v ) ) fix_pos_list = [ j for j , _pval in enumerate ( v ) if isinstance ( _pval , fixture_ref ) ] if len ( fix_pos_list ) > 0 : fixture_indices . append ( ( i , fix_pos_list ) ) return p_ids , p_marks , argvalues , fixture_indices
Internal method to use in _pytest_parametrize_plus
Processes the provided marked_argvalues (possibly marked with pytest.param) and returns
p_ids, p_marks, argvalues (not marked with pytest.param), fixture_indices
Internal method to use in _pytest_parametrize_plus Processes the provided marked_argvalues ( possibly marked with pytest . param ) and returns p_ids p_marks argvalues ( not marked with pytest . param ) fixture_indices
"""Internal method to use in _pytest_parametrize_plus

    Processes the provided marked_argvalues (possibly marked with pytest.param) and returns
    p_ids, p_marks, argvalues (not marked with pytest.param), fixture_indices

    Note: `marked_argvalues` is modified in the process if a `lazy_value` is found with a custom id or marks.

    :param argnames:
    :param marked_argvalues:
    :param nb_params:
    :return:
    """ # find if there are fixture references or lazy values in the values provided # Note: no need to modify the id, it will be ok thanks to the lazy_value class design # handle marks # merge with the mark decorators possibly already present with pytest.param # update the marked_argvalues # a lazy value is used for several parameters at the same time, and is NOT between pytest.param() # TUPLE usage: we HAVE to set an id to prevent too early access to the value by _idmaker # note that on pytest 2 we cannot set an id here, the lazy value wont be too lazy # handle marks # merge with the mark decorators possibly already present with pytest.param # note that here argvalues[i] IS a tuple-like so we do not create a tuple around it # a fixture ref is used for several parameters at the same time # same than above but it was in a pytest.mark # valueref_indices.append((i, None)) # unpack it # force-use the id from the lazy value (do not have pytest request for it, that would unpack it) # handle marks # merge with the mark decorators possibly already present with pytest.param # same than above but it was in a pytest.mark # unpack it # check for consistency # let's dig into the tuple # there is at least one fixture ref inside the tuple # let's dig into the tuple # has_val_ref = any(isinstance(_pval, lazy_value) for _pval in v) # val_pos_list = [j for j, _pval in enumerate(v) if isinstance(_pval, lazy_value)] # if len(val_pos_list) > 0: #     # there is at least one value ref inside the tuple #     argvalues[i] = tuple_with_value_refs(v, theoreticalsize=nb_params, positions=val_pos_list)
None
argnames
None
marked_argvalues
None
nb_params
None