Orchestrata Ultimate › Tests › Reference › session › test_session_hooks

Tests reference — tests/session/test_session_hooks.py

Module of tests/session, split out because the directory page would be too large.

Prose pending.

tests/session/test_session_hooks.py

source · 24 tests · 384 lines

Tests for session hooks — fact hook, auto-start hook, pre-close hook.

Covers: session.context, session.hooks.session_fact_hook, session.hooks.session_pre_close_hook, session.session

Kind Name Line Description
class TestExtractFacts 31 Tests for extract_facts function.
method TestExtractFacts.test_read_context_md 34 Test extracting fact from Read tool on context.md.
method TestExtractFacts.test_read_claude_md 43 Test extracting fact from Read tool on CLAUDE.md.
method TestExtractFacts.test_read_other_file 52 Test no facts extracted from reading arbitrary file.
method TestExtractFacts.test_bash_pytest_success 61 Test detecting successful test run.
method TestExtractFacts.test_bash_pytest_failure 72 Test detecting failed test run.
method TestExtractFacts.test_bash_git_status_clean 83 Test detecting clean git status.
method TestExtractFacts.test_bash_git_status_dirty 92 Test detecting dirty git status.
method TestExtractFacts.test_bash_git_commit 101 Test detecting successful git commit.
method TestExtractFacts.test_bash_git_push 111 Test detecting successful git push.
method TestExtractFacts.test_write_context_md 121 Test detecting context.md write.
method TestExtractFacts.test_edit_handover 130 Test detecting handover file edit.
method TestExtractFacts.test_edit_handover_uppercase 139 Test detecting HANDOVER in path.
method TestExtractFacts.test_no_facts_for_unmatched_tool 148 Test no facts for an unrecognized tool.
class TestStoreFacts 158 Tests for store_facts function.
method TestStoreFacts.test_store_facts_creates_files 161 Test that facts are stored to a JSONL file.
method TestStoreFacts.test_store_empty_facts 187 Test that empty facts list is a no-op.
class TestGetSessionId 192 Tests for get_session_id function.
method TestGetSessionId.test_from_environment 195 Test getting session ID from environment variable.
method TestGetSessionId.test_from_file 201 Test getting session ID from .claude_session_id file.
method TestGetSessionId.test_generate_new 217 Test generating new session ID when none exists.
class TestCheckGitClean 237 Tests for check_git_clean from pre-close hook.
method TestCheckGitClean.test_clean_repo 240 Test clean git repo detection.
method TestCheckGitClean.test_dirty_repo 273 Test dirty git repo detection.
method TestCheckGitClean.test_untracked_only 307 Test repo with only untracked files is considered clean.
class TestValidateChecklist 320 Tests for validate_checklist from pre-close hook.
method TestValidateChecklist.test_no_active_session 323 Test validation fails with no active session.
method TestValidateChecklist.test_empty_session_fails 340 Test validation with empty session reports all failures.
method TestValidateChecklist.test_complete_session_passes 361 Test validation passes when all items are filled.