Skip to content

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

3 participants