Skip to content

Prevent allure from force adding test folder name as parent suite name when parent suite is not specified #903

Open

Description

@kartnan

I have tests in several folders with all tests having a common allure.dynamic.suite name.
In my allure report all the tests get grouped under this name.

However, of late, the suites go under the folder name of the tests such that the folder name is taken as the Parent Suite.

Is there a way to prevent the folder names from being taken as Parent Suite name and simply group the tests under the suite names like how it used to be?

The only way i can think of currently to avoid this issue is to rename all allure.dynamic.suite to allure.dynamic.parent_suite in all of my tests.

But the reason this will be a problem is,
If I collect multiple allure artifacts and consolidate them into a single report, I would want to group them under a common parent suite name. But since each report will have a parent suite name, they will get overwritten.

What Operating System are you using (both controller, and any agents involved in the problem)?

Windows

Reproduction steps

  1. Have tests in two folders (Folder_A, Folder_B) with each of the tests having the same allure.dynamic.suite name("Tests")
  2. Run the tests and generate allure report

Expected Results

Report should display,

Image

Actual Results

Report is displaying,

Image

The name of the test folder is taken as the parent suite name although no parent suite has been specified.

Anything else?

Can we have,
A configuration option like --no-parent-suite or --disable-auto-parent-suite
Or a new pytest.ini option like allure_skip_parent_suite = true

Are you interested in contributing a fix?

Yes

Activity

  1. kartnan commented on Apr 17, 2026

    @kartnan
    Author

    I'm using this code in my conftest file to prevent parent suite from getting added automatically but it would be good to have this implemented in the package itself.

    import pytest
    from allure_commons.types import LabelType
    
    # Patch BEFORE allure_pytest is imported
    def patched_allure_suite_labels(item):
        """Modified version that skips parent_suite"""
        from allure_pytest.utils import parse_nodeid, allure_labels
        
        nodeid = parse_nodeid(item)
        
        default_suite_labels = {
            LabelType.SUITE: nodeid.module,
            LabelType.SUB_SUITE: " > ".join(nodeid.class_names),
        }
        
        existing_labels = dict(allure_labels(item))
        resolved_default_suite_labels = []
        for label, value in default_suite_labels.items():
            if label not in existing_labels and value:
                resolved_default_suite_labels.append((label, value))
        
        return resolved_default_suite_labels
    
    def patched_allure_title_path(item):
        """Modified version that skips folder path segments"""
        from allure_pytest.utils import parse_nodeid
        
        nodeid = parse_nodeid(item)
        # Only return filename and class names, skip parent directories
        return list(filter(None, [nodeid.module + ".py", *nodeid.class_names]))
    
    # Patch the module before listener imports it
    import allure_pytest.utils
    allure_pytest.utils.allure_suite_labels = patched_allure_suite_labels
    allure_pytest.utils.allure_title_path = patched_allure_title_path
    
    # Now patch the already-imported functions in listener
    import allure_pytest.listener
    allure_pytest.listener.allure_suite_labels = patched_allure_suite_labels
    allure_pytest.listener.allure_title_path = patched_allure_title_path
    
    # Other imports and rest of the code
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions