원클릭으로
python-unit-tests
Use when writing, fixing, or reviewing Python pytest unit tests, fixtures, mocks, or test PR feedback.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Use when writing, fixing, or reviewing Python pytest unit tests, fixtures, mocks, or test PR feedback.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
| name | python-unit-tests |
| description | Use when writing, fixing, or reviewing Python pytest unit tests, fixtures, mocks, or test PR feedback. |
Use this skill before adding, changing, or reviewing Python unit tests. The goal is hermetic tests: behavior-focused, deterministic, isolated, and cheap to run.
Consult these only when the branch needs more context:
docs/coding-agents/testing.mddocs/coding-agents/code-quality-rules.mddocs/development/testing.mdmisc/auto-fixes/fix_template.mddimos/core/foo.py gets dimos/core/test_foo.py. Completion: every new or changed test has a named behavior target and lives beside the code it covers.mocker.patch, mocker.patch.object, or monkeypatch; no direct method assignment or __new__ fixture shells remain.assert result == expected over shape-only checks.tmp_path for temporary files and directories.stop(), close(), or cleanup calls at the end of a test body after assertions; an earlier failure skips them.with.try/finally.if hasattr(...), it probably does not know what it is testing.threading.Event, then assert the final values. Do not use fixed time.sleep() waits.mocker.patch(...) or mocker.patch.object(...) for patches and call assertions.monkeypatch for environment variables, paths, and module attributes that should be restored automatically.__new__ and fill in fields by hand. Construct normally and patch the one side effect you need to avoid.For call assertions, use the standard pattern: patch the target with mocker.patch.object(...), run the behavior, then assert with assert_called_once_with(...) or another precise mock assertion.
monkeypatch.setenv, monkeypatch.delenv, or fixtures instead of direct os.environ[...] mutation.global_config or other shared state after changing it.Focused test edit:
uv run pytest dimos/path/to/test_file.py -k test_name
Explicit default marker filter:
uv run pytest dimos/path/to/test_file.py -k test_name -m 'not (self_hosted or mujoco or self_hosted_large)'
Broader local check:
./bin/pytest-fast
Do not run mypy for test-only edits. Run uv run mypy when production source typing changed or before a broader quality gate. Run pre-commit run --all-files for broad/autofix/final review work, not after every small unit-test edit.
mocker or monkeypatch?