codecraftai-integration-runtime 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.
- ccai/integrationruntime/__init__.py +27 -0
- ccai/integrationruntime/entrypoints.py +59 -0
- ccai/integrationruntime/initialize.py +100 -0
- ccai/integrationruntime/integratedtestjob.py +100 -0
- ccai/integrationruntime/integrationruntimedefaulttypefactory.py +51 -0
- ccai/integrationruntime/py.typed +0 -0
- ccai/integrationruntime/results/__init__.py +13 -0
- ccai/integrationruntime/results/concentrators/__init__.py +13 -0
- ccai/integrationruntime/results/concentrators/progressconcentratorservice.py +526 -0
- ccai/integrationruntime/results/recorders/__init__.py +22 -0
- ccai/integrationruntime/results/recorders/integrationjsonresultrecorder.py +126 -0
- ccai/integrationruntime/results/recorders/streamingresultrecorder.py +271 -0
- ccai/integrationruntime/results/streaming/__init__.py +25 -0
- ccai/integrationruntime/results/streaming/resultstreamer.py +581 -0
- ccai/integrationruntime/runtimeoutputcontext.py +68 -0
- ccai/integrationruntime/runtimerunmetadata.py +165 -0
- ccai/integrationruntime/templates/v2/static/images/test-report-banner-background-image.png +0 -0
- ccai/integrationruntime/templates/v2/static/javascript/d3.v7.js +20625 -0
- ccai/integrationruntime/templates/v2/static/javascript/icon-components.js +510 -0
- ccai/integrationruntime/templates/v2/static/javascript/mojo-components.js +1417 -0
- ccai/integrationruntime/templates/v2/static/javascript/prism.js +1789 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-accessibility.js +704 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-comparison.js +1287 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-components.js +3499 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-helpers.js +426 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary-responsive.js +493 -0
- ccai/integrationruntime/templates/v2/static/javascript/testsummary.js +1128 -0
- ccai/integrationruntime/templates/v2/static/javascript/webcomponent-helpers.js +112 -0
- ccai/integrationruntime/templates/v2/static/styles/branding-theme.css +144 -0
- ccai/integrationruntime/templates/v2/static/styles/icon-styles.css +9 -0
- ccai/integrationruntime/templates/v2/static/styles/mojo-components.css +384 -0
- ccai/integrationruntime/templates/v2/static/styles/prism.css +143 -0
- ccai/integrationruntime/templates/v2/static/styles/tabs-responsive.css +186 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary-accessibility.css +413 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary-comparison.css +746 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary-responsive.css +679 -0
- ccai/integrationruntime/templates/v2/static/styles/testsummary.css +1631 -0
- ccai/integrationruntime/templates/v2/tabs/tab-data.html +870 -0
- ccai/integrationruntime/templates/v2/tabs/tab-images.html +110 -0
- ccai/integrationruntime/templates/v2/tabs/tab-logs.html +594 -0
- ccai/integrationruntime/templates/v2/tabs/tab-sounds.html +112 -0
- ccai/integrationruntime/templates/v2/tabs/tab-timeseries.html +368 -0
- ccai/integrationruntime/templates/v2/tabs/tab-videos.html +372 -0
- ccai/integrationruntime/templates/v2/testsummary.html +81 -0
- codecraftai_integration_runtime-1.3.0.dist-info/METADATA +73 -0
- codecraftai_integration_runtime-1.3.0.dist-info/RECORD +48 -0
- codecraftai_integration_runtime-1.3.0.dist-info/WHEEL +4 -0
- codecraftai_integration_runtime-1.3.0.dist-info/licenses/LICENSE.md +204 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"""
|
|
2
|
+
.. module:: ccai.integrationruntime.runtimerunmetadata
|
|
3
|
+
:platform: Darwin, Linux, Unix, Windows
|
|
4
|
+
:synopsis: The integration :class:`IRunMetadata` that sources build / pipeline / job metadata
|
|
5
|
+
from the activated application's :class:`RuntimeVariables`.
|
|
6
|
+
|
|
7
|
+
Where the standalone :class:`ccai.testbase.output.runmetadata.StandaloneRunMetadata` fills the
|
|
8
|
+
CI/build/pipeline/job descriptors with ``(unknown)`` placeholders, :class:`RuntimeRunMetadata`
|
|
9
|
+
reads the resolved ``AM_*`` runtime variables (now owned by :mod:`ccai.thisapp.runtimevariables`)
|
|
10
|
+
— exactly the values the original ``testbase`` ``TestJob`` read directly before the decoupling.
|
|
11
|
+
|
|
12
|
+
:class:`ccai.integrationruntime.integratedtestjob.IntegratedTestJob` installs this by overriding
|
|
13
|
+
``TestJob._create_run_metadata``.
|
|
14
|
+
|
|
15
|
+
.. moduleauthor:: Myron Walker <myron.walker@gmail.com>
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
__author__ = "Myron Walker"
|
|
19
|
+
__copyright__ = "Copyright 2026, Code Craft AI LLC"
|
|
20
|
+
__credits__ = []
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
from datetime import datetime
|
|
24
|
+
from typing import Any, Optional
|
|
25
|
+
|
|
26
|
+
import uuid
|
|
27
|
+
|
|
28
|
+
from ccai.testbase.output.runmetadata import IRunMetadata
|
|
29
|
+
from ccai.testbase.results.model.buildinfo import BuildInfo
|
|
30
|
+
from ccai.testbase.results.model.pipelineinfo import PipelineInfo
|
|
31
|
+
from ccai.testbase.results.model.jobinfo import JobInfo
|
|
32
|
+
|
|
33
|
+
from ccai.thisapp.runtimevariables import RuntimeVariables
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
UNKNOWN = "(unknown)"
|
|
37
|
+
|
|
38
|
+
# The RuntimeVariables descriptors return the literal string "(not-set)" for an unresolved value
|
|
39
|
+
# (rather than None or the DefaultValue sentinel), so an unset CI variable must be detected by it.
|
|
40
|
+
NOT_SET_SENTINEL = "(not-set)"
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _is_unset(value: Any) -> bool:
|
|
44
|
+
"""
|
|
45
|
+
Indicates whether a runtime-variable value should be treated as unset.
|
|
46
|
+
|
|
47
|
+
:param value: The value read from a :class:`RuntimeVariables` descriptor.
|
|
48
|
+
|
|
49
|
+
:returns: ``True`` when the value is ``None``, empty, the ``"(not-set)"`` sentinel, or the
|
|
50
|
+
``DefaultValue`` sentinel.
|
|
51
|
+
"""
|
|
52
|
+
if value is None:
|
|
53
|
+
return True
|
|
54
|
+
if value == "":
|
|
55
|
+
return True
|
|
56
|
+
if value == NOT_SET_SENTINEL:
|
|
57
|
+
return True
|
|
58
|
+
if type(value).__name__ == "DefaultValue":
|
|
59
|
+
return True
|
|
60
|
+
return False
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _resolve_val(value: Any) -> Any:
|
|
64
|
+
"""
|
|
65
|
+
Resolves a runtime-variable value to a display value, substituting ``(unknown)`` for unset.
|
|
66
|
+
|
|
67
|
+
:param value: The value read from a :class:`RuntimeVariables` descriptor.
|
|
68
|
+
|
|
69
|
+
:returns: The value, or ``"(unknown)"`` when it is unset.
|
|
70
|
+
"""
|
|
71
|
+
if _is_unset(value):
|
|
72
|
+
return UNKNOWN
|
|
73
|
+
return value
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class RuntimeRunMetadata(IRunMetadata):
|
|
77
|
+
"""
|
|
78
|
+
Integration run metadata sourced from the activated application's :class:`RuntimeVariables`.
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
def __init__(self, title: str = "Test Run"):
|
|
82
|
+
"""
|
|
83
|
+
Constructor for a :class:`RuntimeRunMetadata`.
|
|
84
|
+
|
|
85
|
+
:param title: A fallback title used when ``AM_JOB_NAME`` is not set.
|
|
86
|
+
"""
|
|
87
|
+
self._fallback_title = title
|
|
88
|
+
self._job_seed = None
|
|
89
|
+
return
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def run_id(self) -> str:
|
|
93
|
+
run_id_value = RuntimeVariables.AM_RUN_ID
|
|
94
|
+
if _is_unset(run_id_value):
|
|
95
|
+
run_id_value = str(uuid.uuid4())
|
|
96
|
+
return str(run_id_value)
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def apod(self) -> Optional[str]:
|
|
100
|
+
apod_value = RuntimeVariables.AM_AUTOMATION_POD
|
|
101
|
+
if _is_unset(apod_value):
|
|
102
|
+
return None
|
|
103
|
+
return apod_value
|
|
104
|
+
|
|
105
|
+
@property
|
|
106
|
+
def title(self) -> str:
|
|
107
|
+
job_name = RuntimeVariables.AM_JOB_NAME
|
|
108
|
+
if _is_unset(job_name):
|
|
109
|
+
return self._fallback_title
|
|
110
|
+
return job_name
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def starttime(self) -> datetime:
|
|
114
|
+
start_value = RuntimeVariables.AM_STARTTIME
|
|
115
|
+
if _is_unset(start_value):
|
|
116
|
+
start_value = datetime.now()
|
|
117
|
+
return start_value
|
|
118
|
+
|
|
119
|
+
@property
|
|
120
|
+
def testrun_timeout(self) -> Optional[int]:
|
|
121
|
+
timeout_value = RuntimeVariables.AM_TESTRUN_TIMEOUT
|
|
122
|
+
if _is_unset(timeout_value):
|
|
123
|
+
return None
|
|
124
|
+
return timeout_value
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def job_seed(self) -> str:
|
|
128
|
+
if self._job_seed is None:
|
|
129
|
+
seed_value = RuntimeVariables.AM_JOB_SEED
|
|
130
|
+
if _is_unset(seed_value):
|
|
131
|
+
seed_value = str(uuid.uuid4())
|
|
132
|
+
self._job_seed = str(seed_value)
|
|
133
|
+
return self._job_seed
|
|
134
|
+
|
|
135
|
+
def build_info(self) -> BuildInfo:
|
|
136
|
+
info = BuildInfo(
|
|
137
|
+
branch=_resolve_val(RuntimeVariables.AM_BUILD_BRANCH),
|
|
138
|
+
build=_resolve_val(RuntimeVariables.AM_BUILD_NAME),
|
|
139
|
+
flavor=_resolve_val(RuntimeVariables.AM_BUILD_FLAVOR),
|
|
140
|
+
release=_resolve_val(RuntimeVariables.AM_BUILD_RELEASE),
|
|
141
|
+
url=_resolve_val(RuntimeVariables.AM_BUILD_URL),
|
|
142
|
+
)
|
|
143
|
+
return info
|
|
144
|
+
|
|
145
|
+
def pipeline_info(self) -> PipelineInfo:
|
|
146
|
+
info = PipelineInfo(
|
|
147
|
+
id=_resolve_val(RuntimeVariables.AM_PIPELINE_ID),
|
|
148
|
+
name=_resolve_val(RuntimeVariables.AM_PIPELINE_NAME),
|
|
149
|
+
instance=_resolve_val(RuntimeVariables.AM_PIPELINE_INSTANCE),
|
|
150
|
+
)
|
|
151
|
+
return info
|
|
152
|
+
|
|
153
|
+
def job_info(self) -> JobInfo:
|
|
154
|
+
info = JobInfo(
|
|
155
|
+
id=_resolve_val(RuntimeVariables.AM_JOB_ID),
|
|
156
|
+
name=_resolve_val(RuntimeVariables.AM_JOB_NAME),
|
|
157
|
+
type=_resolve_val(RuntimeVariables.AM_JOB_TYPE),
|
|
158
|
+
owner=_resolve_val(RuntimeVariables.AM_JOB_OWNER),
|
|
159
|
+
label=_resolve_val(RuntimeVariables.AM_JOB_LABEL),
|
|
160
|
+
initiator=_resolve_val(RuntimeVariables.AM_JOB_INITIATOR),
|
|
161
|
+
venue=_resolve_val(RuntimeVariables.AM_JOB_VENUE),
|
|
162
|
+
seed=self.job_seed,
|
|
163
|
+
tag=_resolve_val(RuntimeVariables.AM_JOB_TAG),
|
|
164
|
+
)
|
|
165
|
+
return info
|