-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Hi dear pytest maintainers,
I noticed that starting in pytest 5.4.0, CallSpec2.id does not automatically filter out ids that are empty strings from the ids list. So if in the ids list there is ['a', '', 'b'] in old versions that would lead to id 'a-b' and now it leads to 'a--b'. I understand the rationale: pytest should not hide anything from users, so if there is an empty string id somewhere, it should appear.
- In 5.3.0: CallSpec2.id has a filter
- In 5.4.0 and later: CallSpec2.id has no filter
Unfortunately I was relying on this undocumented mechanism in pytest-cases, because there is a specific situation with fixture unions induced by the new @parametrize, in which I wish to remove a useless piece of id from a callspec. I found an ugly workaround: to use a very long and unique string constant as a marker for "id to remove" and then have a specific cleaning hook in the plugin removing such constants from callspec ids lists.
I was wondering if there could be a better way for the future, baked in the pytest API. For example we could introduce an explicit pytest.NO_ID constant that would be filtered out in CallSpec2.id.
What do you think ? I can propose a PR if needed