Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workaround for CallSpec2 attributes being frozen #253

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/pytest_cases/fixture_parametrize_plus.py
Expand Up @@ -550,14 +550,20 @@ def get_alternative_id(self):
EMPTY_ID = "<pytest_cases_empty_id>"


def _replace_list_contents(the_list, new_contents):
"""Replaces the contents of a list"""
the_list.clear()
the_list.extend(new_contents)


if has_pytest_param:
def remove_empty_ids(callspec):
# used by plugin.py to remove the EMPTY_ID from the callspecs
callspec._idlist = [c for c in callspec._idlist if not c.startswith(EMPTY_ID)]
_replace_list_contents(callspec._idlist, [c for c in callspec._idlist if not c.startswith(EMPTY_ID)])
else:
def remove_empty_ids(callspec):
# used by plugin.py to remove the EMPTY_ID from the callspecs
callspec._idlist = [c for c in callspec._idlist if not c.endswith(EMPTY_ID)]
_replace_list_contents(callspec._idlist, [c for c in callspec._idlist if not c.endswith(EMPTY_ID)])


# elif PYTEST421_OR_GREATER:
Expand Down