Skip to content

marker_fields other than manual are not applied from the module level

Within my configuration, I have defined marker fields like so:

 marker_fields:
      caseimportance: "@pytest.mark.importance"
      caseautomation: "@pytest.mark.manual"
valid_values:
      caseimportance:
        - critical
        - high
        - medium
        - low

A test module assigning this mark with pytestmark = [] defined at the module level does not apply the marks for metadata to functions within the module.

import pytest

pytestmark = [
    pytest.mark.manual, 
    pytest.mark.importance("critical")
]


def test_deploy():
    """ This is an example
    
    Polarion:
        assignee: mshriver

Above test results in flake errors:

❯ flake8 --select P
./tests/deploy/test_deploy.py:9:5: P669 Missing required field "casecomponent"
./tests/deploy/test_deploy.py:9:5: P669 Missing required field "caseimportance"

I'm expecting marks that are part of marker_fields to work while being applied at the module, class, or function level.

The generated json lists the markers, but doesn't include the expected metadata field linked with marker_fields.

pytest --include-manual --generate-json --collect-only tests/deploy/test_deploy.py

Some json data has been scrubbed, but the caseimportance field is not set as expected from marker_fields.

Note that caseautomation was set to notautomated, though that mapping is nowhere in config. That mark is present on the module too, but is handled correctly on the function. caseimportance is not.

{
    "testcases": [
        {
            "id": "test_deploy_portal",
            "title": "test_deploy_portal",
            "description": " This scenario is to test AAP deployment on Azure from Azure Portal.",
            "markers": [
                "component",
                "manual",
                "importance"
            ],
            "caseautomation": "notautomated",
            "assignee-id": "mshriver",
            "interfacetype": null,
            "assignee": "mshriver",
        }
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information