Orchestrata Ultimate › Tests › Reference › session › cli
Tests reference — tests/session/cli
tests/session/cli — 3 test modules, 112 test functions. Source tree: tests/session/cli at commit 8a2cb42ad. Generated from the tests AST snapshot by scripts/gen-data-pages.py.
Prose pending.
Modules
| Module | Tests | Covers |
|---|---|---|
test_lifecycle.py |
64 | 4 |
test_main_pytest_guard.py |
5 | 1 |
test_overview.py |
43 | 4 |
Module details
tests/session/cli/test_lifecycle.py
source · 64 tests · 1203 lines
Tests for orchestrata_ultimate.session.cli.lifecycle.
Covers: session.cli.lifecycle, session.cli.main, session.models, session.session
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_begin_without_objectives |
95 | begin with no --objective prints purpose only, no Objectives section. |
| function | test_begin_with_objectives |
104 | begin with repeated --objective lists each one. |
| function | test_work_without_active_session_exits_1 |
128 | work with no session started exits 1 with the standard message. |
| function | test_work_logs_entry_for_active_session |
137 | work logs a work entry (with details) against the auto-resumed session. |
| function | test_artifact_without_active_session_exits_1 |
166 | artifact with no session started exits 1. |
| function | test_artifact_logs_entry_with_lines_and_summary |
175 | artifact with --lines/--summary records both on the FileArtifact. |
| function | test_artifact_logs_entry_without_lines_or_summary |
204 | artifact without --lines/--summary leaves those fields None. |
| function | test_choice_without_active_session_exits_1 |
221 | choice with no session started exits 1. |
| function | test_choice_logs_decision |
232 | choice records the decision and its rationale. |
| function | test_handoff_without_active_session_exits_1 |
252 | handoff with no session started exits 1. |
| function | test_handoff_sets_all_fields_when_options_given |
261 | handoff with every option populates the corresponding HandoffData list. |
| function | test_handoff_sets_empty_lists_when_no_options_given |
302 | handoff with no options still sets a HandoffData with all-empty lists. |
| function | test_resume_no_session_exits_1 |
326 | resume on a project with no session history exits 1. |
| function | test_resume_existing_session |
333 | resume reports the seq and purpose of the latest session. |
| function | test_summary_without_active_session_exits_1 |
345 | summary with no session started exits 1. |
| function | test_summary_full_session_renders_all_populated_sections |
354 | summary renders objectives, work log, artifacts, choices and handoff. |
| function | test_end_without_active_session_exits_1 |
404 | end with no session started exits 1. |
| function | test_end_validate_default_fails_and_lists_reasons |
413 | end with default (strict) validation and an empty checklist exits 1. |
| function | test_end_no_validate_flag_succeeds_without_checklist |
431 | end --no-validate ends the session even with an empty checklist. |
| function | test_end_full_checklist_validated_success |
444 | end with default validation succeeds once the whole checklist is met. |
| function | test_end_smart_flag_invokes_auto_detect |
478 | end --smart runs auto-detection without erroring, even with real git state. |
| function | test_end_interactive_flag_prompts_for_achievements_and_upcoming |
511 | end -i drives the interactive achievement/upcoming/handoff/commit prompts. |
| function | test_end_commit_flag_commits_real_git_changes |
528 | end --commit stages, commits (prompted message) and reports success. |
| function | test_count_lines_existing_file |
555 | _count_lines returns the number of lines for a real text file. |
| function | test_count_lines_missing_file_returns_none |
562 | _count_lines returns None when the file doesn't exist. |
| function | test_count_lines_invalid_encoding_returns_none |
567 | _count_lines returns None (not an exception) on undecodable bytes. |
| function | test_detect_modified_artifacts_logs_modified_not_untracked |
577 | Regression test: modified (tracked) files are logged with the correct, |
| function | test_detect_modified_artifacts_not_a_git_repo_is_a_noop |
611 | _detect_modified_artifacts does nothing when root isn't a git repo. |
| function | test_detect_modified_artifacts_nonexistent_root_is_a_noop |
622 | _detect_modified_artifacts swallows FileNotFoundError for a bad cwd. |
| function | test_detect_test_state_success_records_collected_count |
636 | _detect_test_state records "N collected" from a real pytest --co run. |
| function | test_detect_test_state_no_tests_dir_leaves_state_unset |
650 | _detect_test_state is a no-op when pytest collection fails (no tests/). |
| function | test_detect_test_state_nonexistent_root_is_a_noop |
660 | _detect_test_state swallows FileNotFoundError for a bad cwd. |
| function | test_detect_recent_commits_no_active_session_is_a_noop |
671 | _detect_recent_commits returns immediately when there's no active session. |
| function | test_detect_recent_commits_not_a_git_repo_is_a_noop |
680 | _detect_recent_commits logs nothing when root isn't a git repo. |
| function | test_detect_recent_commits_nonexistent_root_is_a_noop |
689 | _detect_recent_commits swallows FileNotFoundError for a bad cwd. |
| function | test_detect_recent_commits_logs_commits_made_since_session_start |
698 | _detect_recent_commits logs each commit made after the session began. |
| function | test_auto_detect_session_data_runs_all_three_detectors |
719 | _auto_detect_session_data wires modified-artifact, test-state and |
| function | test_commit_code_changes_not_a_git_repo_prints_no_changes |
752 | _commit_code_changes reports "no changes" when root isn't a git repo. |
| function | test_commit_code_changes_clean_repo_prints_no_changes |
760 | _commit_code_changes reports "no changes" for a clean git working tree. |
| function | test_commit_code_changes_default_message_from_git_log_no_push |
774 | Accepting the default commit message (from git log -1) with no push. |
| function | test_commit_code_changes_custom_message_with_push |
798 | A custom commit message and an accepted push both take effect. |
| function | test_commit_code_changes_commit_failure_reports_error |
814 | A failing commit (forced via a rejecting pre-commit hook) prints |
| function | test_prompt_lines_collects_until_blank_line |
839 | _prompt_lines collects values until an empty line is entered. |
| function | test_prompt_achievements_prepends_existing_items |
849 | _prompt_achievements shows existing items and appends newly typed ones. |
| function | test_prompt_upcoming_prepends_existing_items |
859 | _prompt_upcoming shows existing items and appends newly typed ones. |
| function | test_prompt_handoff_sets_all_six_fields |
869 | _prompt_handoff prompts for and sets every HandoffData field. |
| function | test_run_end_interactive_declines_handoff_and_toggles_commit |
893 | Declining the handoff prompt skips it; declining commit keeps it False. |
| function | test_run_end_interactive_accepts_handoff_and_skips_commit_prompt_if_already_true |
914 | Accepting the handoff prompt logs it; an already-true commit flag skips |
| function | test_finalize_session_no_validate_ends_directly |
940 | _finalize_session(validate=False) ends the session without checking |
| function | test_finalize_session_validate_true_exits_on_failed_checklist |
951 | _finalize_session(validate=True) prints failures and exits(1) on an |
| function | test_finalize_session_validate_true_succeeds_on_full_checklist |
969 | _finalize_session(validate=True) ends the session once the whole |
| function | test_report_ended_session_none_exits_1 |
990 | _report_ended_session(None) reports failure and exits 1. |
| function | test_report_ended_session_prints_counts |
1000 | _report_ended_session prints achievement/upcoming counts when present. |
| function | test_report_ended_session_no_achievements_or_upcoming_omits_lines |
1020 | _report_ended_session omits the Achievements/Upcoming lines when empty. |
| function | test_echo_summary_objectives_empty_and_populated |
1041 | _echo_summary_objectives is silent when empty, lists items when set. |
| function | test_echo_summary_work_log_empty_and_populated |
1057 | _echo_summary_work_log is silent when empty, lists entries and details. |
| function | test_echo_summary_artifacts_empty_and_populated |
1074 | _echo_summary_artifacts renders the line-count suffix only when set. |
| function | test_echo_summary_choices_empty_and_populated |
1094 | _echo_summary_choices is silent when empty, lists choice + reason. |
| function | test_echo_summary_handoff_empty_and_populated |
1110 | _echo_summary_handoff is silent with no handoff, renders every block |
| function | test_echo_summary_achievements_empty_and_populated |
1141 | _echo_summary_achievements is silent when empty, lists items when set. |
| function | test_echo_handoff_block_empty_and_populated |
1156 | _echo_handoff_block is silent for an empty list, renders a labelled |
| function | test_get_active_session_returns_in_memory_session_without_disk_read |
1174 | _get_active_session returns the in-memory active session directly. |
| function | test_get_active_session_auto_resumes_unclosed_session_from_disk |
1183 | A fresh controller (simulating a new CLI process) auto-resumes the |
| function | test_get_active_session_no_context_files_returns_none |
1198 | _get_active_session returns None when no context files exist at all. |
tests/session/cli/test_main_pytest_guard.py
source · 5 tests · 82 lines
Tests for the session CLI's SPEC-023 pytest live-repo guard.
Covers: session.cli.main
| Kind | Name | Line | Description |
|---|---|---|---|
| class | TestPytestGuard |
34 | |
| method | TestPytestGuard.test_refuses_auto_detected_tracked_root_under_pytest |
35 | |
| method | TestPytestGuard.test_explicit_root_stays_allowed_under_pytest |
48 | |
| method | TestPytestGuard.test_allow_env_var_opts_back_in |
58 | |
| method | TestPytestGuard.test_untracked_cwd_fallback_is_not_refused |
67 | |
| method | TestPytestGuard.test_outside_pytest_auto_detection_is_unchanged |
77 |
tests/session/cli/test_overview.py
source · 43 tests · 526 lines
Tests for orchestrata_ultimate.session.cli.overview — the
session overviewdigest.
Covers: session.cli.main, session.cli.overview, session.context, session.models
| Kind | Name | Line | Description |
|---|---|---|---|
| function | test_overview_real_repo_exits_zero_and_has_all_sections |
88 | The verification demanded by the plan: exits 0, all section headers present. |
| function | test_overview_never_crashes_even_from_a_bare_project_root |
101 | No context.json, no git repo, no scripts/ tree -- still exits 0, all headers present. |
| function | test_overview_rulings_env_seam |
112 | RULINGS_DIR is honoured through the ctx.obj["env"] injection seam. |
| function | test_section_infra_real_repo_reports_services |
134 | |
| function | test_section_infra_missing_script |
140 | |
| function | test_section_infra_timeout |
145 | |
| function | test_section_infra_bad_json |
154 | |
| function | test_section_session_no_context |
166 | |
| function | test_section_session_reports_pending_tasks |
170 | |
| function | test_section_last_test_verdict_no_artifacts |
186 | |
| function | test_section_last_test_verdict_flake_recoveries |
191 | |
| function | test_section_last_test_verdict_prefers_newest |
204 | |
| function | test_tail_last_line_empty_file |
222 | |
| function | test_tail_last_line_large_file_reads_tail_only |
228 | |
| function | test_section_rulings_unavailable_when_dir_missing |
241 | |
| function | test_section_rulings_parses_table_rows |
246 | |
| function | test_section_rulings_empty_index_reports_no_rows |
261 | |
| function | test_section_rulings_default_when_env_unset |
269 | No RULINGS_DIR in the env at all -- falls back to the documented default. |
| function | test_newest_tag_date_no_tags |
278 | |
| function | test_section_stale_tracking_no_tags |
282 | |
| function | test_section_stale_tracking_flags_old_files |
290 | |
| function | test_section_stale_tracking_fresh_files_are_ok |
310 | |
| function | test_ruling_drift_staleness_no_reports_dir |
331 | |
| function | test_ruling_drift_staleness_fresh_report_is_none |
338 | |
| function | test_ruling_drift_staleness_old_report_is_stale |
345 | |
| function | test_ruling_drift_staleness_uses_newest_of_several_reports |
361 | |
| function | test_section_git_reports_branch_and_clean |
380 | |
| function | test_section_git_reports_dirty_count |
387 | |
| function | test_section_git_real_repo_has_upstream |
394 | The real repo's feat/arch-canvas branch tracks origin. |
| function | test_section_project_status_missing_script |
404 | |
| function | test_section_project_status_real_repo |
409 | |
| function | test_fmt_age_minutes |
418 | |
| function | test_fmt_age_hours |
422 | |
| function | test_fmt_age_days |
426 | |
| function | test_fmt_age_future_is_just_now |
430 | |
| function | test_overview_via_installed_entrypoint |
437 | Run the real session console-script entrypoint, not just CliRunner. |
| function | test_tail_last_line_missing_file_returns_none |
467 | .stat() on a nonexistent path raises OSError -- caught, returns None. |
| function | test_run_git_timeout_returns_none |
472 | A timeout too small for the process to even spawn -> None, not a raise. |
| function | test_section_session_invalid_context_json_reports_error |
477 | A deferred_work item missing its required text field fails pydantic |
| function | test_section_last_test_verdict_malformed_last_line |
490 | A non-JSON last line in .flake_recoveries.ndjson -- detail is dropped, no crash. |
| function | test_section_rulings_unreadable_index_file |
499 | read_text() raising PermissionError (OSError) degrades to 'unavailable'. |
| function | test_section_project_status_timeout |
513 | |
| function | test_section_project_status_empty_output |
521 |