Skip to content

to prevent saving marks with parameters as labels → tag #817

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

Open
1 of 3 tasks
cheshi-mantu opened this issue May 21, 2024 · 2 comments
Open
1 of 3 tasks

to prevent saving marks with parameters as labels → tag #817

cheshi-mantu opened this issue May 21, 2024 · 2 comments
Labels
task:improvement Change that improves some user experience but can't be considered a new feature theme:pytest

Comments

@cheshi-mantu
Copy link
Contributor

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

when pytest tests are being executed the content of marks with parameters is saved to labels section as a tag.

code like

@pytest.mark.skip("skip this test")
@allure.title(TestNames.FAILING_TEST.get_name())
def test_failing_test():
    f"""{TestNames.FAILING_TEST.get_description()}"""
    assert False

will result in

"labels": [
    {
      "name": "tag",
      "value": "@pytest.mark.skip('skip this test')"
    }
<snip>
]

the tag's text will contain spaces, which will result in errors in the integrations Allure Testops has, e.g. when trying to export the data to jira we'll get

response body {"errorMessages":[],"errors":{"labels":"The label '@pytest.mark.skip('Skipping the test because the tests are using token.')' contains spaces which is invalid."}}

as most of the system do not allow creation of tags/labels with spaces.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

N/A

What is the expected behaviour?

marks with parameters aren't transferred to the *-result.json files as tags.

What is the motivation / use case for changing the behavior?

tag is a 1 word label should not contain spaces.

Please tell us about your environment:

Other information

N/A

@delatrie delatrie added the task:improvement Change that improves some user experience but can't be considered a new feature label Jun 1, 2024
@delatrie
Copy link
Contributor

delatrie commented Apr 22, 2025

Built-in marks should also be ignored even without arguments. This includes skip, skipif, xfail, usefixtures, parametrize, and filterwarnings. We have other means to indicate their effect, and they aren't used for filtering in the vast majority of cases.

@sharovd
Copy link
Contributor

sharovd commented May 17, 2025

Hi everyone!

@delatrie, thanks for the context and the idea on how to fix this!
After applying the changes, all built-in pytest marks are now ignored, so the described issue is no longer reproducible. The labels field in the test result json file no longer contains a tag with the skip pytest marker.

The code and unit tests changes are available in the PR #862 - I’d appreciate your review when you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task:improvement Change that improves some user experience but can't be considered a new feature theme:pytest
Projects
None yet
Development

No branches or pull requests

3 participants