31472b5413
CI / benchmark-publish (pull_request) Has been skipped
CI / build (pull_request) Successful in 21s
CI / helm (pull_request) Successful in 22s
CI / lint (pull_request) Successful in 3m20s
CI / quality (pull_request) Successful in 3m43s
CI / typecheck (pull_request) Successful in 3m58s
CI / security (pull_request) Successful in 4m8s
CI / integration_tests (pull_request) Successful in 9m33s
CI / unit_tests (pull_request) Successful in 10m12s
CI / docker (pull_request) Successful in 1m28s
CI / coverage (pull_request) Successful in 12m18s
CI / e2e_tests (pull_request) Successful in 19m51s
CI / status-check (pull_request) Successful in 1s
CI / build (push) Successful in 15s
CI / helm (push) Successful in 22s
CI / lint (push) Successful in 3m18s
CI / quality (push) Successful in 3m41s
CI / typecheck (push) Successful in 3m57s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 4m10s
CI / unit_tests (push) Failing after 6m58s
CI / docker (push) Has been skipped
CI / integration_tests (push) Successful in 9m15s
CI / coverage (push) Successful in 12m26s
CI / e2e_tests (push) Successful in 23m11s
CI / status-check (push) Failing after 1s
CI / benchmark-publish (push) Successful in 28m31s
CI / benchmark-regression (pull_request) Successful in 54m53s
Add Behave feature/step pairs that exercise uncovered branches across handlers, LSP, CLI, and service layers to reach the coverage gate. ISSUES CLOSED: #1232
93 lines
4.3 KiB
Gherkin
93 lines
4.3 KiB
Gherkin
Feature: Actor context commands – additional coverage (r3)
|
||
Exercise uncovered helper functions and edge-case branches
|
||
in actor_context.py (lines 41, 47, 53-58, 151-152, 155-160,
|
||
201-202, 209-210, 386, 390, 392, 395-396, 402).
|
||
|
||
Background:
|
||
Given accov3 a temporary context directory
|
||
|
||
# ── Helper: _default_context_base (line 41) ────────────────
|
||
|
||
Scenario: Default context base returns home path when context_dir is None
|
||
When accov3 I call _default_context_base with None
|
||
Then accov3 the result should be the home cleveragents context path
|
||
|
||
# ── Helper: _list_context_names (line 47) ───────────────────
|
||
|
||
Scenario: Listing context names for non-existent directory returns empty
|
||
When accov3 I call _list_context_names with a non-existent path
|
||
Then accov3 the result should be an empty list
|
||
|
||
# ── Helper: _context_size_kb (lines 53-58) ──────────────────
|
||
|
||
Scenario: Context size computation for a populated context
|
||
Given accov3 a context named "sizable" with some file content
|
||
When accov3 I call _context_size_kb for "sizable"
|
||
Then accov3 the size should be a non-negative number
|
||
|
||
# ── Remove --all on empty dir (lines 151-152) ──────────────
|
||
|
||
Scenario: Remove --all with no existing contexts prints message
|
||
When accov3 I run remove --all --yes on empty context dir
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the output should contain "No contexts found to remove"
|
||
|
||
# ── Remove --all without --yes, user cancels (lines 155-160) ─
|
||
|
||
Scenario: Remove --all prompts and user cancels
|
||
Given accov3 a context named "keepme" exists
|
||
When accov3 I run remove --all without --yes and answer no
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the output should contain "Remove cancelled"
|
||
And accov3 the context "keepme" should still exist
|
||
|
||
# ── Remove single without --yes, user cancels (lines 201-202) ─
|
||
|
||
Scenario: Remove single context prompts and user cancels
|
||
Given accov3 a context named "precious" exists
|
||
When accov3 I run remove "precious" without --yes and answer no
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the output should contain "Remove cancelled"
|
||
And accov3 the context "precious" should still exist
|
||
|
||
# ── Remove single with remaining contexts (lines 209-210) ──
|
||
|
||
Scenario: Remove single context computes remaining size from others
|
||
Given accov3 a context named "ctx-a" exists
|
||
And accov3 a context named "ctx-b" exists
|
||
When accov3 I run remove "ctx-a" with --yes
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the context "ctx-b" should still exist
|
||
|
||
# ── Import YAML file (line 386) ─────────────────────────────
|
||
|
||
Scenario: Import a context from a YAML file
|
||
Given accov3 a valid YAML context file named "from-yaml.yaml"
|
||
When accov3 I run import "yamlctx" from the YAML file
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the context "yamlctx" should still exist
|
||
|
||
# ── Import JSON-decode error falls back to YAML (lines 390, 392) ─
|
||
|
||
Scenario: Import a .json file with YAML content falls back to YAML parser
|
||
Given accov3 a .json file containing valid YAML but invalid JSON
|
||
When accov3 I run import "fallback" from the bad-json file
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the context "fallback" should still exist
|
||
|
||
# ── Import non-dict data (lines 394-396) ────────────────────
|
||
|
||
Scenario: Import a file containing a non-dict value fails
|
||
Given accov3 a .json file containing a JSON list
|
||
When accov3 I run import "listctx" from the list file
|
||
Then accov3 the result exit code should be 1
|
||
And accov3 the output should contain "must contain a JSON/YAML object"
|
||
|
||
# ── Import infers name from filename stem (line 402) ────────
|
||
|
||
Scenario: Import infers context name from filename when not in file data
|
||
Given accov3 a .json file named "stemname.json" without context_name key
|
||
When accov3 I run import without name from the stemname file
|
||
Then accov3 the result exit code should be 0
|
||
And accov3 the context "stemname" should still exist
|