MCPcopy
hub / github.com/saltstack/salt / last_failed

Function last_failed

tools/testsuite/pytest.py:122–150  ·  view source on GitHub ↗

Re-run only the tests that failed in the last pytest run. Examples: * Re-run last failed tests: tools ts pytest last-failed * Re-run last failed with verbose output: tools ts pytest last-failed --args -v

(
    ctx: Context,
    venv: str = None,
    args: list[str] = None,
)

Source from the content-addressed store, hash-verified

120 },
121)
122def last_failed(
123 ctx: Context,
124 venv: str = None,
125 args: list[str] = None,
126):
127 """
128 Re-run only the tests that failed in the last pytest run.
129
130 Examples:
131
132 * Re-run last failed tests:
133
134 tools ts pytest last-failed
135
136 * Re-run last failed with verbose output:
137
138 tools ts pytest last-failed --args -v
139 """
140 pytest_bin = get_pytest_path(ctx, venv)
141 if pytest_bin is None:
142 ctx.exit(1)
143
144 cmd = [str(pytest_bin), "--lf"]
145 if args:
146 cmd.extend(args)
147
148 ctx.info(f"Running: {' '.join(cmd)}")
149 ret = ctx.run(*cmd, check=False, cwd=tools.utils.REPO_ROOT)
150 ctx.exit(ret.returncode)
151
152
153@pytest_cmd.command(

Callers

nothing calls this directly

Calls 5

get_pytest_pathFunction · 0.85
exitMethod · 0.80
extendMethod · 0.45
infoMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected