codecraftai-testbase 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. ccai/factories/py.typed +0 -0
  2. ccai/factories/testbasedefaulttypefactory.py +25 -0
  3. ccai/testbase/__init__.py +63 -0
  4. ccai/testbase/breakpoints.py +110 -0
  5. ccai/testbase/cli/__init__.py +13 -0
  6. ccai/testbase/cli/cmdtree/agents/__init__.py +28 -0
  7. ccai/testbase/cli/cmdtree/agents/config/__init__.py +24 -0
  8. ccai/testbase/cli/cmdtree/agents/config/extract.py +94 -0
  9. ccai/testbase/cli/cmdtree/agents/formatting.py +71 -0
  10. ccai/testbase/cli/cmdtree/agents/jsosparser.py +119 -0
  11. ccai/testbase/cli/cmdtree/agents/pathresolver.py +34 -0
  12. ccai/testbase/cli/cmdtree/agents/summary/__init__.py +26 -0
  13. ccai/testbase/cli/cmdtree/agents/summary/compare.py +128 -0
  14. ccai/testbase/cli/cmdtree/agents/summary/extract.py +91 -0
  15. ccai/testbase/cli/cmdtree/agents/testresult/__init__.py +28 -0
  16. ccai/testbase/cli/cmdtree/agents/testresult/extract.py +77 -0
  17. ccai/testbase/cli/cmdtree/agents/testresult/failures.py +73 -0
  18. ccai/testbase/cli/cmdtree/agents/testresult/list.py +63 -0
  19. ccai/testbase/cli/cmdtree/services/__init__.py +27 -0
  20. ccai/testbase/cli/cmdtree/services/results.py +66 -0
  21. ccai/testbase/cli/cmdtree/testing/__init__.py +30 -0
  22. ccai/testbase/cli/cmdtree/testing/jobs.py +175 -0
  23. ccai/testbase/cli/cmdtree/testing/query.py +131 -0
  24. ccai/testbase/cli/cmdtree/testing/run.py +263 -0
  25. ccai/testbase/cli/cmdtree/utilities/__init__.py +28 -0
  26. ccai/testbase/cli/cmdtree/utilities/timestamp.py +33 -0
  27. ccai/testbase/cli/options.py +370 -0
  28. ccai/testbase/cli/testbase_command.py +64 -0
  29. ccai/testbase/cli/utilities.py +31 -0
  30. ccai/testbase/configuration.py +324 -0
  31. ccai/testbase/constraints.py +998 -0
  32. ccai/testbase/coupling/__init__.py +569 -0
  33. ccai/testbase/coupling/basecoupling.py +69 -0
  34. ccai/testbase/coupling/configurationcoupling.py +138 -0
  35. ccai/testbase/coupling/integrationcoupling.py +842 -0
  36. ccai/testbase/coupling/validatorcoupling.py +127 -0
  37. ccai/testbase/debuggingext.py +281 -0
  38. ccai/testbase/debuglogging.py +407 -0
  39. ccai/testbase/debugports.py +469 -0
  40. ccai/testbase/declaration/__init__.py +13 -0
  41. ccai/testbase/declaration/attachments.py +222 -0
  42. ccai/testbase/declaration/originations.py +217 -0
  43. ccai/testbase/declaration/parameterization.py +160 -0
  44. ccai/testbase/declaration/registrations.py +476 -0
  45. ccai/testbase/diagnostic_level.py +197 -0
  46. ccai/testbase/diagnostic_streaming.py +1534 -0
  47. ccai/testbase/diagnostics.py +1685 -0
  48. ccai/testbase/entrypoints.py +485 -0
  49. ccai/testbase/environment.py +162 -0
  50. ccai/testbase/errors/testruntimeouterror.py +50 -0
  51. ccai/testbase/expressions.py +355 -0
  52. ccai/testbase/factories.py +277 -0
  53. ccai/testbase/factoryprotocols.py +35 -0
  54. ccai/testbase/features.py +913 -0
  55. ccai/testbase/initialize.py +210 -0
  56. ccai/testbase/injection/__init__.py +25 -0
  57. ccai/testbase/injection/injectiongroup.py +493 -0
  58. ccai/testbase/injection/injectionmoment.py +155 -0
  59. ccai/testbase/injection/injectionregistry.py +823 -0
  60. ccai/testbase/injection/injectionscope.py +2589 -0
  61. ccai/testbase/injection/introspection.py +514 -0
  62. ccai/testbase/markers.py +665 -0
  63. ccai/testbase/mocking.py +4856 -0
  64. ccai/testbase/origins/__init__.py +13 -0
  65. ccai/testbase/origins/resourceorigin.py +110 -0
  66. ccai/testbase/origins/validatororigin.py +111 -0
  67. ccai/testbase/output/__init__.py +17 -0
  68. ccai/testbase/output/outputcontext.py +201 -0
  69. ccai/testbase/output/runmetadata.py +184 -0
  70. ccai/testbase/properties/__init__.py +40 -0
  71. ccai/testbase/properties/assumptions.py +56 -0
  72. ccai/testbase/properties/decorators.py +173 -0
  73. ccai/testbase/properties/propertyrunner.py +449 -0
  74. ccai/testbase/properties/strategies.py +1592 -0
  75. ccai/testbase/properties/unittestsupport.py +87 -0
  76. ccai/testbase/py.typed +0 -0
  77. ccai/testbase/queries.py +95 -0
  78. ccai/testbase/resourcelifespan.py +24 -0
  79. ccai/testbase/results/__init__.py +35 -0
  80. ccai/testbase/results/exceptions.py +60 -0
  81. ccai/testbase/results/filtering/__init__.py +26 -0
  82. ccai/testbase/results/filtering/resultfilter.py +570 -0
  83. ccai/testbase/results/model/__init__.py +32 -0
  84. ccai/testbase/results/model/buildinfo.py +54 -0
  85. ccai/testbase/results/model/checkresult.py +183 -0
  86. ccai/testbase/results/model/forwardinginfo.py +30 -0
  87. ccai/testbase/results/model/jobcontainer.py +32 -0
  88. ccai/testbase/results/model/jobinfo.py +91 -0
  89. ccai/testbase/results/model/nestedprogressinfo.py +211 -0
  90. ccai/testbase/results/model/pipelineinfo.py +51 -0
  91. ccai/testbase/results/model/progressaggregator.py +551 -0
  92. ccai/testbase/results/model/progresscode.py +29 -0
  93. ccai/testbase/results/model/progressdelivery.py +51 -0
  94. ccai/testbase/results/model/progressinfo.py +84 -0
  95. ccai/testbase/results/model/progresstype.py +24 -0
  96. ccai/testbase/results/model/renderinfo.py +30 -0
  97. ccai/testbase/results/model/resultcode.py +28 -0
  98. ccai/testbase/results/model/resultcontainer.py +95 -0
  99. ccai/testbase/results/model/resultnode.py +258 -0
  100. ccai/testbase/results/model/resulttype.py +34 -0
  101. ccai/testbase/results/model/streaminginfo.py +111 -0
  102. ccai/testbase/results/model/taskinggroup.py +85 -0
  103. ccai/testbase/results/model/taskingresult.py +297 -0
  104. ccai/testbase/results/model/testcontainer.py +35 -0
  105. ccai/testbase/results/model/testresult.py +170 -0
  106. ccai/testbase/results/recorders/__init__.py +31 -0
  107. ccai/testbase/results/recorders/csvresultrecorder.py +414 -0
  108. ccai/testbase/results/recorders/jsonresultrecorder.py +467 -0
  109. ccai/testbase/results/recorders/resultrecorder.py +1472 -0
  110. ccai/testbase/results/recorders/stdoutresultrecorder.py +70 -0
  111. ccai/testbase/results/recorders/xmlresultrecorder.py +305 -0
  112. ccai/testbase/results/utilities.py +141 -0
  113. ccai/testbase/sequencing/__init__.py +13 -0
  114. ccai/testbase/sequencing/sequencermodulescope.py +96 -0
  115. ccai/testbase/sequencing/sequencerscopebase.py +91 -0
  116. ccai/testbase/sequencing/sequencersessionscope.py +84 -0
  117. ccai/testbase/sequencing/sequencertestscope.py +249 -0
  118. ccai/testbase/sequencing/sequencertestsetupscope.py +86 -0
  119. ccai/testbase/sequencing/testactivity.py +111 -0
  120. ccai/testbase/sequencing/testsequencer.py +3072 -0
  121. ccai/testbase/server/__init__.py +13 -0
  122. ccai/testbase/server/resultserver.py +599 -0
  123. ccai/testbase/sources/__init__.py +13 -0
  124. ccai/testbase/sources/configurationsource.py +32 -0
  125. ccai/testbase/sources/integrationsource.py +29 -0
  126. ccai/testbase/sources/resourcesource.py +27 -0
  127. ccai/testbase/sources/sourcebase.py +71 -0
  128. ccai/testbase/sources/unknownsource.py +30 -0
  129. ccai/testbase/sources/validatorsource.py +28 -0
  130. ccai/testbase/tandem/__init__.py +13 -0
  131. ccai/testbase/tandem/validators.py +286 -0
  132. ccai/testbase/testcollector.py +230 -0
  133. ccai/testbase/testgroup.py +54 -0
  134. ccai/testbase/testjob.py +600 -0
  135. ccai/testbase/testref.py +64 -0
  136. ccai/testbase/utilities.py +472 -0
  137. ccai/testbase/verification.py +768 -0
  138. codecraftai_testbase-1.3.0.dist-info/METADATA +99 -0
  139. codecraftai_testbase-1.3.0.dist-info/RECORD +142 -0
  140. codecraftai_testbase-1.3.0.dist-info/WHEEL +4 -0
  141. codecraftai_testbase-1.3.0.dist-info/entry_points.txt +3 -0
  142. codecraftai_testbase-1.3.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,128 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.agents.summary.compare
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Agent command for comparing two test summaries.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+ import json
14
+ import sys
15
+
16
+ from ccai.arcli import decorators as arcli
17
+
18
+ from ccai.testbase.cli.cmdtree.agents.formatting import (
19
+ format_kv,
20
+ format_section,
21
+ format_error,
22
+ )
23
+ from ccai.testbase.cli.cmdtree.agents.pathresolver import resolve_file_path
24
+
25
+
26
+ HELP_BASELINE = "Path to the baseline testrun_summary.json file."
27
+ HELP_CURRENT = "Path to the current testrun_summary.json file."
28
+
29
+
30
+ def _load_summary(filepath: str) -> dict:
31
+ """
32
+ Resolves, reads, and parses a summary JSON file.
33
+
34
+ :param filepath: The file path to load.
35
+ :returns: The parsed JSON data.
36
+ """
37
+ resolved = resolve_file_path(filepath)
38
+
39
+ with open(resolved, "r") as fh:
40
+ return json.load(fh)
41
+
42
+
43
+ def _format_delta(value: int) -> str:
44
+ """
45
+ Formats a delta integer with a sign prefix.
46
+
47
+ :param value: The delta value.
48
+ :returns: A string like '+2', '-1', or '0'.
49
+ """
50
+ if value > 0:
51
+ return f"+{value}"
52
+ return str(value)
53
+
54
+
55
+ @arcli.option("--current", required=True, help=HELP_CURRENT)
56
+ @arcli.option("--baseline", required=True, help=HELP_BASELINE)
57
+ @arcli.command("compare")
58
+ def command_agents_summary_compare(baseline: str, current: str):
59
+ """
60
+ Compares two test summary files and reports regressions or improvements.
61
+ """
62
+
63
+ try:
64
+ baseline_data = _load_summary(baseline)
65
+ except FileNotFoundError as err:
66
+ format_error(str(err))
67
+ sys.exit(1)
68
+ except json.JSONDecodeError:
69
+ format_error(f"Invalid JSON in baseline file")
70
+ sys.exit(1)
71
+
72
+ try:
73
+ current_data = _load_summary(current)
74
+ except FileNotFoundError as err:
75
+ format_error(str(err))
76
+ sys.exit(1)
77
+ except json.JSONDecodeError:
78
+ format_error(f"Invalid JSON in current file")
79
+ sys.exit(1)
80
+
81
+ lines = []
82
+
83
+ # Overall result comparison
84
+ baseline_result = baseline_data.get("result", "UNKNOWN")
85
+ current_result = current_data.get("result", "UNKNOWN")
86
+
87
+ if baseline_result == current_result:
88
+ lines.append(format_kv("overall", f"{current_result} (stable)"))
89
+ else:
90
+ # Determine regression or improvement
91
+ classification = _classify_change(baseline_data, current_data)
92
+ lines.append(format_kv("overall", f"{baseline_result}->{current_result} ({classification})"))
93
+
94
+ # Detail counter deltas
95
+ baseline_detail = baseline_data.get("detail") or {}
96
+ current_detail = current_data.get("detail") or {}
97
+
98
+ counter_fields = ("passed", "failed", "errors", "skipped", "total")
99
+ lines.append(format_section("delta"))
100
+ for field in counter_fields:
101
+ bval = baseline_detail.get(field, 0)
102
+ cval = current_detail.get(field, 0)
103
+ delta = cval - bval
104
+ lines.append(format_kv(field, _format_delta(delta), indent=2))
105
+
106
+ print("\n".join(lines))
107
+
108
+
109
+ def _classify_change(baseline_data: dict, current_data: dict) -> str:
110
+ """
111
+ Classifies the change between two runs as regression, improvement, or stable.
112
+
113
+ :param baseline_data: The baseline summary data.
114
+ :param current_data: The current summary data.
115
+ :returns: 'regression', 'improvement', or 'stable'.
116
+ """
117
+ baseline_detail = baseline_data.get("detail") or {}
118
+ current_detail = current_data.get("detail") or {}
119
+
120
+ baseline_failures = baseline_detail.get("failed", 0) + baseline_detail.get("errors", 0)
121
+ current_failures = current_detail.get("failed", 0) + current_detail.get("errors", 0)
122
+
123
+ if current_failures > baseline_failures:
124
+ return "regression"
125
+ elif current_failures < baseline_failures:
126
+ return "improvement"
127
+
128
+ return "stable"
@@ -0,0 +1,91 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.agents.summary.extract
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Agent command for extracting compact test summary information.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+ import json
14
+ import sys
15
+
16
+ from ccai.arcli import decorators as arcli
17
+
18
+ from ccai.testbase.cli.cmdtree.agents.formatting import (
19
+ format_kv,
20
+ format_section,
21
+ format_error,
22
+ omit_unset
23
+ )
24
+ from ccai.testbase.cli.cmdtree.agents.pathresolver import resolve_file_path
25
+
26
+
27
+ HELP_SUMMARY_FILE = "Path to a testrun_summary.json file."
28
+
29
+
30
+ @arcli.option("--summary-file", required=True, help=HELP_SUMMARY_FILE)
31
+ @arcli.command("extract")
32
+ def command_agents_summary_extract(summary_file: str):
33
+ """
34
+ Extracts compact test summary information from a testrun_summary.json file.
35
+ """
36
+
37
+ try:
38
+ resolved = resolve_file_path(summary_file)
39
+ except FileNotFoundError as err:
40
+ format_error(str(err))
41
+ sys.exit(1)
42
+
43
+ try:
44
+ with open(resolved, "r") as fh:
45
+ data = json.load(fh)
46
+ except json.JSONDecodeError:
47
+ format_error(f"Invalid JSON in file: {resolved}")
48
+ sys.exit(1)
49
+
50
+ lines = []
51
+
52
+ # Overall result and timing
53
+ lines.append(format_kv("result", data.get("result", "UNKNOWN")))
54
+ lines.append(format_kv("start", data.get("start", "")))
55
+ lines.append(format_kv("stop", data.get("stop", "")))
56
+
57
+ # Detail counters
58
+ detail = data.get("detail")
59
+ if detail is not None:
60
+ lines.append(format_section("detail"))
61
+ lines.append(format_kv("passed", detail.get("passed", 0), indent=2))
62
+ lines.append(format_kv("failed", detail.get("failed", 0), indent=2))
63
+ lines.append(format_kv("errors", detail.get("errors", 0), indent=2))
64
+ lines.append(format_kv("skipped", detail.get("skipped", 0), indent=2))
65
+ lines.append(format_kv("total", detail.get("total", 0), indent=2))
66
+
67
+ # Job metadata (omit unset fields)
68
+ job = data.get("job")
69
+ if job is not None:
70
+ job_lines = []
71
+ for field in ("id", "name", "type"):
72
+ val = omit_unset(job.get(field))
73
+ if val is not None:
74
+ job_lines.append(format_kv(field, val, indent=2))
75
+ if job_lines:
76
+ lines.append(format_section("job"))
77
+ lines.extend(job_lines)
78
+
79
+ # Build metadata (omit unset fields)
80
+ build = data.get("build")
81
+ if build is not None:
82
+ build_lines = []
83
+ for field in ("branch", "build"):
84
+ val = omit_unset(build.get(field))
85
+ if val is not None:
86
+ build_lines.append(format_kv(field, val, indent=2))
87
+ if build_lines:
88
+ lines.append(format_section("build"))
89
+ lines.extend(build_lines)
90
+
91
+ print("\n".join(lines))
@@ -0,0 +1,28 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.agents.testresult
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Test result subgroup for agent commands.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+ from ccai.arcli import decorators as arcli
14
+
15
+ from ccai.testbase.cli.cmdtree.agents.testresult.extract import command_agents_testresult_extract
16
+ from ccai.testbase.cli.cmdtree.agents.testresult.list import command_agents_testresult_list
17
+ from ccai.testbase.cli.cmdtree.agents.testresult.failures import command_agents_testresult_failures
18
+
19
+ @arcli.group("testresult")
20
+ def group_testbase_agents_testresult():
21
+ """
22
+ Commands for extracting and listing individual test results.
23
+ """
24
+ return
25
+
26
+ group_testbase_agents_testresult.add_command(command_agents_testresult_extract)
27
+ group_testbase_agents_testresult.add_command(command_agents_testresult_list)
28
+ group_testbase_agents_testresult.add_command(command_agents_testresult_failures)
@@ -0,0 +1,77 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.agents.testresult.extract
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Agent command for extracting a single test result by name.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+ import sys
14
+
15
+ from ccai.arcli import decorators as arcli
16
+
17
+ from ccai.testbase.cli.cmdtree.agents.formatting import (
18
+ format_kv,
19
+ format_section,
20
+ format_error,
21
+ )
22
+ from ccai.testbase.cli.cmdtree.agents.jsosparser import parse_file, get_final_results
23
+ from ccai.testbase.cli.cmdtree.agents.pathresolver import resolve_file_path
24
+
25
+
26
+ HELP_RESULTS_FILE = "Path to a testrun_results_stream.jsos file."
27
+ HELP_TESTNAME = "Fully qualified test name to extract (e.g., package.module#test_name)."
28
+
29
+
30
+ @arcli.option("--testname", required=True, help=HELP_TESTNAME)
31
+ @arcli.option("--results-file", required=True, help=HELP_RESULTS_FILE)
32
+ @arcli.command("extract")
33
+ def command_agents_testresult_extract(results_file: str, testname: str):
34
+ """
35
+ Extracts detailed result information for a specific test from the results stream.
36
+ """
37
+
38
+ try:
39
+ resolved = resolve_file_path(results_file)
40
+ except FileNotFoundError as err:
41
+ format_error(str(err))
42
+ sys.exit(1)
43
+
44
+ try:
45
+ entries = parse_file(resolved)
46
+ except ValueError as err:
47
+ format_error(str(err))
48
+ sys.exit(1)
49
+
50
+ final_results = get_final_results(entries)
51
+
52
+ if testname not in final_results:
53
+ format_error(f"Test '{testname}' not found in results file")
54
+ sys.exit(1)
55
+
56
+ entry = final_results[testname]
57
+
58
+ lines = []
59
+ lines.append(format_kv("name", entry.get("name", "")))
60
+ lines.append(format_kv("result", entry.get("result", "UNKNOWN")))
61
+ lines.append(format_kv("start", entry.get("start", "")))
62
+ lines.append(format_kv("stop", entry.get("stop", "")))
63
+
64
+ # Extract error details if present
65
+ detail = entry.get("detail")
66
+ if detail is not None:
67
+ errors = detail.get("errors", [])
68
+ if errors:
69
+ lines.append(format_section("errors"))
70
+ for error_item in errors:
71
+ if isinstance(error_item, dict):
72
+ msg = error_item.get("message", str(error_item))
73
+ lines.append(format_kv("-", msg, indent=2))
74
+ elif isinstance(error_item, str):
75
+ lines.append(format_kv("-", error_item, indent=2))
76
+
77
+ print("\n".join(lines))
@@ -0,0 +1,73 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.agents.testresult.failures
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Agent command for listing failed and errored tests.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+ import sys
14
+
15
+ from ccai.arcli import decorators as arcli
16
+
17
+ from ccai.testbase.cli.cmdtree.agents.formatting import (
18
+ format_kv,
19
+ format_error,
20
+ )
21
+ from ccai.testbase.cli.cmdtree.agents.jsosparser import parse_file, get_final_results
22
+ from ccai.testbase.cli.cmdtree.agents.pathresolver import resolve_file_path
23
+
24
+
25
+ HELP_RESULTS_FILE = "Path to a testrun_results_stream.jsos file."
26
+
27
+ FAILURE_RESULTS = {"FAILED", "ERRORED"}
28
+
29
+
30
+ @arcli.option("--results-file", required=True, help=HELP_RESULTS_FILE)
31
+ @arcli.command("failures")
32
+ def command_agents_testresult_failures(results_file: str):
33
+ """
34
+ Lists all failed and errored tests with error summaries from the results stream.
35
+ """
36
+
37
+ try:
38
+ resolved = resolve_file_path(results_file)
39
+ except FileNotFoundError as err:
40
+ format_error(str(err))
41
+ sys.exit(1)
42
+
43
+ try:
44
+ entries = parse_file(resolved)
45
+ except ValueError as err:
46
+ format_error(str(err))
47
+ sys.exit(1)
48
+
49
+ final_results = get_final_results(entries)
50
+
51
+ lines = []
52
+ for name, entry in final_results.items():
53
+ result = entry.get("result", "UNKNOWN")
54
+ if result not in FAILURE_RESULTS:
55
+ continue
56
+
57
+ lines.append(f"{name}: {result}")
58
+
59
+ # Include brief error summary if available
60
+ detail = entry.get("detail")
61
+ if detail is not None:
62
+ errors = detail.get("errors", [])
63
+ for error_item in errors:
64
+ if isinstance(error_item, dict):
65
+ msg = error_item.get("message", str(error_item))
66
+ lines.append(format_kv("error", msg, indent=2))
67
+ elif isinstance(error_item, str):
68
+ lines.append(format_kv("error", error_item, indent=2))
69
+
70
+ if lines:
71
+ print("\n".join(lines))
72
+ else:
73
+ print("All tests passed")
@@ -0,0 +1,63 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.agents.testresult.list
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Agent command for listing all test results.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
11
+ __credits__ = []
12
+
13
+ import sys
14
+
15
+ from typing import Optional
16
+
17
+ from ccai.arcli import decorators as arcli
18
+
19
+ from ccai.testbase.cli.cmdtree.agents.formatting import format_error
20
+ from ccai.testbase.cli.cmdtree.agents.jsosparser import parse_file, get_final_results
21
+ from ccai.testbase.cli.cmdtree.agents.pathresolver import resolve_file_path
22
+
23
+
24
+ HELP_RESULTS_FILE = "Path to a testrun_results_stream.jsos file."
25
+ HELP_RESULT_FILTER = "Filter results by result code (e.g., PASSED, FAILED, SKIPPED)."
26
+
27
+
28
+ @arcli.option("--result-filter", default=None, required=False, help=HELP_RESULT_FILTER)
29
+ @arcli.option("--results-file", required=True, help=HELP_RESULTS_FILE)
30
+ @arcli.command("list")
31
+ def command_agents_testresult_list(results_file: str, result_filter: Optional[str] = None):
32
+ """
33
+ Lists all tests and their final results from the results stream.
34
+ """
35
+
36
+ try:
37
+ resolved = resolve_file_path(results_file)
38
+ except FileNotFoundError as err:
39
+ format_error(str(err))
40
+ sys.exit(1)
41
+
42
+ try:
43
+ entries = parse_file(resolved)
44
+ except ValueError as err:
45
+ format_error(str(err))
46
+ sys.exit(1)
47
+
48
+ final_results = get_final_results(entries)
49
+
50
+ lines = []
51
+ for name, entry in final_results.items():
52
+ result = entry.get("result", "UNKNOWN")
53
+ if result_filter is not None and result != result_filter:
54
+ continue
55
+ lines.append(f"{name}: {result}")
56
+
57
+ if lines:
58
+ print("\n".join(lines))
59
+ else:
60
+ if result_filter is not None:
61
+ print(f"No tests with result '{result_filter}' found")
62
+ else:
63
+ print("No test results found")
@@ -0,0 +1,27 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.services
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module for services.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+
10
+
11
+ __author__ = "Myron Walker"
12
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
13
+ __credits__ = []
14
+
15
+ from ccai.arcli import decorators as arcli
16
+
17
+ from ccai.testbase.cli.cmdtree.services.results import command_testbase_services_results
18
+
19
+
20
+ @arcli.group("services")
21
+ def group_testbase_services():
22
+ """
23
+ Contains commands for running testing services.
24
+ """
25
+ return
26
+
27
+ group_testbase_services.add_command(command_testbase_services_results)
@@ -0,0 +1,66 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.services.results
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module for results.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+
10
+
11
+ __author__ = "Myron Walker"
12
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
13
+ __credits__ = []
14
+
15
+ from typing import Optional
16
+
17
+ import os
18
+
19
+ from ccai.arcli import decorators as arcli
20
+ from ccai.arcli.model.parameters.integerparameter import IntegerParameter
21
+
22
+ from ccai.thisapp.wellknown import ThisApplicationSingleton
23
+
24
+ from ccai.runtime.activation import activate_profile_service
25
+ from ccai.runtime.paths import get_presence_directory
26
+ from ccai.runtime.runtimevariables import RuntimeVariablesDesc
27
+
28
+ from ccai.testbase.server.resultserver import TestResultServer, TestResultRequestHandler, try_create_bug_server_interface_from_environment
29
+
30
+
31
+ HELP_DIRECTORY = "The root directory to serve the test results from."
32
+ HELP_BIND = 'The IP address to bind the server to (default: 127.0.0.1, loopback only). Pass "" to bind all interfaces.'
33
+ HELP_PORT = "The port to bind the server to."
34
+
35
+ @arcli.option("--port", default=8880, ptype=IntegerParameter, help=HELP_PORT)
36
+ @arcli.option("--bind", default="127.0.0.1", help=HELP_BIND)
37
+ @arcli.option("--directory", default=None, help=HELP_DIRECTORY)
38
+ @arcli.command("results")
39
+ def command_testbase_services_results(directory: Optional[str], bind: str, port: int):
40
+ """
41
+ Command used to launch the test results server.
42
+ """
43
+
44
+ this_app = ThisApplicationSingleton()
45
+
46
+ this_app.override_variable_value(RuntimeVariablesDesc.AM_SERVICE_NAME, "Test-Result-Service")
47
+
48
+ activate_profile_service()
49
+
50
+ svc_endpoint = (bind, port)
51
+
52
+ svc_directory = None
53
+ if directory is not None:
54
+ svc_directory = os.path.abspath(os.path.expandvars(os.path.expanduser(directory)))
55
+ else:
56
+ presence_dir = get_presence_directory()
57
+ svc_directory = os.path.join(presence_dir, "results")
58
+
59
+ bug_svc = try_create_bug_server_interface_from_environment()
60
+
61
+ print(f"Serving test results on port={port} from folder='{svc_directory}'")
62
+
63
+ server = TestResultServer(svc_directory, svc_endpoint, TestResultRequestHandler, bug_svc)
64
+ server.serve_forever()
65
+
66
+ return
@@ -0,0 +1,30 @@
1
+ """
2
+ .. module:: ccai.testbase.cli.cmdtree.testing
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module for testing.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+
10
+
11
+ __author__ = "Myron Walker"
12
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
13
+ __credits__ = []
14
+
15
+ from ccai.arcli import decorators as arcli
16
+
17
+ from ccai.testbase.cli.cmdtree.testing.jobs import group_testbase_testing_jobs
18
+ from ccai.testbase.cli.cmdtree.testing.query import command_testbase_testing_query
19
+ from ccai.testbase.cli.cmdtree.testing.run import command_testbase_testing_run
20
+
21
+ @arcli.group("testing")
22
+ def group_testbase_testing():
23
+ """
24
+ Contains command for working with tests and test results.
25
+ """
26
+ return
27
+
28
+ group_testbase_testing.add_command(group_testbase_testing_jobs)
29
+ group_testbase_testing.add_command(command_testbase_testing_query)
30
+ group_testbase_testing.add_command(command_testbase_testing_run)