Skip to content

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

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

Merged
merged 3 commits into from
Jul 9, 2025

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