Skip to content

Improve the error message when the name template is wrong in @cases_generator #39

@smarie

Description

@smarie

As of today the exception can be tricky to understand :)

(...)
..\..\..\..\..\_Libs_OpenSource\python-pytest-cases\pytest_cases\main_params.py:279: in get_all_cases
    for m in module:
E   TypeError: 'object' object is not iterable

During handling of the above exception, another exception occurred:
(...)
C:\Miniconda3\envs\baseenv\lib\site-packages\decopatch\utils_modes.py:132: in _apply_decorator
    return user_provided_applier(*new_args, **kwargs)
..\..\..\..\..\_Libs_OpenSource\python-pytest-cases\pytest_cases\main_params.py:210: in cases_data
    _cases = get_all_cases(cases, module, test_func, has_tag, filter)
..\..\..\..\..\_Libs_OpenSource\python-pytest-cases\pytest_cases\main_params.py:285: in get_all_cases
    _cases = extract_cases_from_module(m, has_tag=has_tag, filter=filter)
..\..\..\..\..\_Libs_OpenSource\python-pytest-cases\pytest_cases\main_params.py:344: in extract_cases_from_module
    _get_case_getter_s(f, code, cases_dct)
..\..\..\..\..\_Libs_OpenSource\python-pytest-cases\pytest_cases\main_params.py:398: in _get_case_getter_s
    gen_case_name = names(**gen_case_params_dct)
..\..\..\..\..\_Libs_OpenSource\python-pytest-cases\pytest_cases\main_params.py:384: in names
    return _formatter.format(**params)
E   IndexError: tuple index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions