Skip to content

Fix pytest node ID parsing for literal separators - #928

Open
bayandin wants to merge 3 commits into
allure-framework:masterfrom
bayandin:fix/pytest-nodeid-param-separators
Open

bayandin wants to merge 3 commits into
allure-framework:masterfrom
bayandin:fix/pytest-nodeid-param-separators

Conversation

@bayandin

@bayandin bayandin commented Sep 29, 2026 •

Copy link
Copy Markdown

Context

Pytest node IDs use :: as structural separators, but literal :: may also appear in parameter IDs and collected filesystem paths. Splitting raw node ID text therefore misclassified parameter IDs and truncated paths, causing incorrect fullName, titlePath, and suite metadata. Separately, stripping everything after [ from every item name truncated non-function items such as bracketed doctest filenames.

This correction intentionally changes fullName for affected tests and therefore changes the derived testCaseId and historyId values. Test-plan selectors that use the previously malformed names must also be updated.

The parser now derives class and function identity from pytest collector objects, takes filesystem identity from the nearest pytest.File ancestor while retaining the existing fallback for custom items, and preserves non-function item names verbatim.

Regression tests cover the parameter ID foo::bar, the file test_module::part.py, and the doctest file spec[foo].txt.

Checklist

@bayandin
bayandin marked this pull request as ready for review September 29, 2026 16:12
@bayandin bayandin changed the title Fix pytest node ID parsing for parameters containing :: Fix pytest node ID parsing for literal separators Sep 29, 2026
@bayandin
bayandin force-pushed the fix/pytest-nodeid-param-separators branch from ee4e58c to 8616ae1 Compare September 29, 2026 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant