Skip to content

fix(pytest): properly include nested classes in fullName, historyId, testCaseId, and subSuite#869

Merged
delatrie merged 3 commits intomasterfrom
issue-868-nested-classes
Jul 9, 2025
Merged

fix(pytest): properly include nested classes in fullName, historyId, testCaseId, and subSuite#869
delatrie merged 3 commits intomasterfrom
issue-868-nested-classes

Conversation

@delatrie
Copy link
Contributor

@delatrie delatrie commented Jul 9, 2025

Context

Pytest supports nested test classes:

class TestFoo:
    class TestBar:
        def test_baz(self):
            pass

Currently, Allure Pytest incorrectly assumes there is zero or one test class in every given nodeid when calculating fullName and subSuite. Since the test above has nodeid module_test.py::TestFoo::TestBar::test_baz, the calculations become invalid.

Given that testCaseId and historyId depend on fullName, these properties are calculated incorrectly as well.

The PR fixes how Allure Pytest handles such cases:

  • All test classes are now included in fullName (joined with .).
  • All test classes are now included in the value of the subSuite label (joined with >).

Fixes #868.

Checklist

@delatrie delatrie added theme:pytest type:bug Pull requests that fix bugs labels Jul 9, 2025
@delatrie delatrie merged commit 0f7da56 into master Jul 9, 2025
49 checks passed
@delatrie delatrie deleted the issue-868-nested-classes branch July 9, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme:pytest type:bug Pull requests that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pytest: nested classes break fullName, testCaseId, historyId, and subSuite

2 participants