Skip to main content

pytester

Write and run isolated pytester-based plugin tests.

소스 정보

저장소
ethereum/execution-specs
최근 소스 활동
2026년 9월 3일 10:31
감지된 SKILL.md 언어
영어
스타
1,207
포크
528

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
pytester
description
Write and run isolated pytester-based plugin tests.
# Pytester Guide for pytester-based plugin/CLI tests. Run before writing or modifying these tests. ## Which execution mode to use - **`runpytest()`** — default. In-process, fast, full `RunResult` API (`assert_outcomes()`, `fnmatch_lines()`). - **`runpytest_subprocess()`** — use only when in-process causes state leakage (Pydantic cache pollution, global mutation in `pytest_configure`). Same `RunResult` API. - **Raw `subprocess.run()`** — never use alongside pytester. Use `runpytest_subprocess()` instead. Subprocess isolation masks bugs rather than fixing them. Prefer fixing the root cause and use subprocess as defense-in-depth. ## Expected inner failures `runpytest_subprocess()` replays inner output to outer stdout (by design). Suppress with `capsys.readouterr()`: ```python def test_expected_failure(pytester: Any, capsys: Any, pytestconfig: Any) -> None: result = pytester.runpytest_subprocess(...) capsys.readouterr() # suppress inner failure bleed assert result.ret != 0 output = "\n".join(result.outlines + result.errlines) # conditional print for -s debugging if pytestconfig.getoption("capture") == "no": with capsys.disabled(): print(output) ``` ## RunResult API Prefer `assert_outcomes()` and `fnmatch_lines()` over manual `any(... in line ...)` — better failure messages. - `result.ret` — exit code - `result.outlines` / `result.errlines` — line lists - `result.assert_outcomes(passed=N, failed=N)` - `result.stdout.fnmatch_lines(["*pattern*"])`
GitHub에서 보기