Skip to content

Commit

Permalink
Fix test groups issue when re-running test failures
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Algarvio <[email protected]>
  • Loading branch information
s0undt3ch committed Oct 25, 2023
1 parent bb86351 commit 6cb08d6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,17 @@ def groups_collection_modifyitems(config, items):
# Just one group, don't do any filtering
return

terminal_reporter = config.pluginmanager.get_plugin("terminalreporter")

if config.getoption("--last-failed") or config.getoption("--failed-first"):
# This is a test failure rerun, applying test groups would break this
terminal_reporter.write(
"\nNot splitting collected tests into chunks since --lf/--last-failed or "
"-ff/--failed-first was passed on the CLI.\n",
yellow=True,
)
return

total_items = len(items)

# Devide into test groups
Expand All @@ -828,7 +839,6 @@ def groups_collection_modifyitems(config, items):
if deselected:
config.hook.pytest_deselected(items=deselected)

terminal_reporter = config.pluginmanager.get_plugin("terminalreporter")
terminal_reporter.write(
f"Running test group #{group_id}(out of #{group_count}) ({len(items)} out of {total_items} tests)\n",
yellow=True,
Expand Down

0 comments on commit 6cb08d6

Please sign in to comment.