Skip to content

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

Description

@delatrie

Suppose we have the following test:

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

When we run the test with Allure Pytest, the following result file is created:

{
  "name": "test_baz",
  "status": "passed",
  "start": 1752068326285,
  "stop": 1752068326285,
  "uuid": "782b1e04-dfc2-44bc-bfc0-774373b3c98f",
  "historyId": "248833ed6b12c59f5bf2306c42651294",
  "testCaseId": "248833ed6b12c59f5bf2306c42651294",
  "fullName": "tests.test_foo.TestBar#test_baz",
  "labels": [
    {"name": "parentSuite", "value": "tests"},
    {"name": "suite", "value": "test_foo"},
    {"name": "subSuite", "value": "TestFoo"},
    {"name": "host", "value": "*.*.*.*"},
    {"name": "thread", "value": "*"},
    {"name": "framework", "value": "pytest"},
    {"name": "language", "value": "cpython3"},
    {"name": "package", "value": "tests.test_foo"}
  ]
}

The result has the following issues:

  • TestFoo is missing in fullName.
  • TestFoo is not taken into account by testCaseId and historyId.
  • TestBar is missing in the subSuite label.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions