Skip to content

Support skipping excluded tests across adapters - #938

Open
andrcuns wants to merge 4 commits into
masterfrom
muted-tests-skip-support
Open

andrcuns wants to merge 4 commits into
masterfrom
muted-tests-skip-support

Conversation

@andrcuns

@andrcuns andrcuns commented Nov 18, 2026 •

Copy link
Copy Markdown

Context

Support mutedTests in the JSON test plan for pytest, pytest-bdd, Behave, nose2, and Robot Framework. Tests that match an Allure ID or exact selector are skipped before their bodies run. When reported, they retain status: skipped and statusDetails.muted: true.

Muting respects runner filters and existing test-plan selection. The README documents selector formats and adapter behavior, and the test suite covers matching and adapter integration.

Checklist

@andrcuns andrcuns added the type:new feature Pull requests that introduce new features label Nov 18, 2026
@andrcuns andrcuns self-assigned this Nov 18, 2026
@andrcuns
andrcuns marked this pull request as ready for review November 18, 2026 11:55
@andrcuns

Copy link
Copy Markdown
Author

@delatrie Could you please take a look. It's mostly vibe coded given I haven't written a single python code line by hand during my career so it might require a bit more thorough review 😅

@andrcuns
andrcuns requested a review from delatrie November 18, 2026 11:56
@andrcuns andrcuns changed the title Support skipping muted tests across adapters Support skipping excluded tests across adapters Nov 24, 2026
@andrcuns
andrcuns force-pushed the muted-tests-skip-support branch from c76cb98 to 2634ba2 Compare November 24, 2026 15:04
Comment thread README.md Outdated
Status](https://img.shields.io/pypi/v/allure-nose2)](https://pypi.python.org/pypi/allure-nose2)
[![Downloads](https://img.shields.io/pypi/dm/allure-nose2)](https://pypi.python.org/pypi/allure-nose2)

## Skipping muted tests

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep README as is. The feature is too narrow and specific to document here.

Comment thread allure-pytest/src/plugin.py Outdated
selected, deselected_by_testcase = select_by_testcase(items, config)
selected, deselected_by_labels = select_by_labels(selected, config)

muted_tests = get_testplan("excludedTests")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and in other integrations, explicitly excluded tests should not produce skipped test results (as in a normal test plan).

The reason is that we cannot guarantee skipped test results across all frameworks, since many only provide a deselection API to prevent tests from running alongside their setup/teardown code.
In pytest, we can use pytest.mark.skip, which automatically disables fixtures once all tests in their scopes are marked as skipped. But in many other cases, no such luxury exists, and we end up with two options:

  1. Skip dynamically, which executes setup/teardown, including per-test (before/after each) code.
  2. Skip prematurely with the deselection API, which avoids the entire lifecycle of the test.

Option 1 has a major drawback: the very code that caused us to exclude the test might get running.
Option 2 often doesn't tell us whether the excluded test even exists in the code.

For test plans, keeping setup/teardown code from running is more important. Similarly, it's more important (to me) for muted tests too.

Hence, we cannot introduce any major policy regarding muted tests based on the presence or absence of skipped test results at the Allure 3 or TestOps level.

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

Labels

type:new feature Pull requests that introduce new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants