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.
Files changed (48) hide show
  1. ccai/integrationruntime/__init__.py +27 -0
  2. ccai/integrationruntime/entrypoints.py +59 -0
  3. ccai/integrationruntime/initialize.py +100 -0
  4. ccai/integrationruntime/integratedtestjob.py +100 -0
  5. ccai/integrationruntime/integrationruntimedefaulttypefactory.py +51 -0
  6. ccai/integrationruntime/py.typed +0 -0
  7. ccai/integrationruntime/results/__init__.py +13 -0
  8. ccai/integrationruntime/results/concentrators/__init__.py +13 -0
  9. ccai/integrationruntime/results/concentrators/progressconcentratorservice.py +526 -0
  10. ccai/integrationruntime/results/recorders/__init__.py +22 -0
  11. ccai/integrationruntime/results/recorders/integrationjsonresultrecorder.py +126 -0
  12. ccai/integrationruntime/results/recorders/streamingresultrecorder.py +271 -0
  13. ccai/integrationruntime/results/streaming/__init__.py +25 -0
  14. ccai/integrationruntime/results/streaming/resultstreamer.py +581 -0
  15. ccai/integrationruntime/runtimeoutputcontext.py +68 -0
  16. ccai/integrationruntime/runtimerunmetadata.py +165 -0
  17. ccai/integrationruntime/templates/v2/static/images/test-report-banner-background-image.png +0 -0
  18. ccai/integrationruntime/templates/v2/static/javascript/d3.v7.js +20625 -0
  19. ccai/integrationruntime/templates/v2/static/javascript/icon-components.js +510 -0
  20. ccai/integrationruntime/templates/v2/static/javascript/mojo-components.js +1417 -0
  21. ccai/integrationruntime/templates/v2/static/javascript/prism.js +1789 -0
  22. ccai/integrationruntime/templates/v2/static/javascript/testsummary-accessibility.js +704 -0
  23. ccai/integrationruntime/templates/v2/static/javascript/testsummary-comparison.js +1287 -0
  24. ccai/integrationruntime/templates/v2/static/javascript/testsummary-components.js +3499 -0
  25. ccai/integrationruntime/templates/v2/static/javascript/testsummary-helpers.js +426 -0
  26. ccai/integrationruntime/templates/v2/static/javascript/testsummary-responsive.js +493 -0
  27. ccai/integrationruntime/templates/v2/static/javascript/testsummary.js +1128 -0
  28. ccai/integrationruntime/templates/v2/static/javascript/webcomponent-helpers.js +112 -0
  29. ccai/integrationruntime/templates/v2/static/styles/branding-theme.css +144 -0
  30. ccai/integrationruntime/templates/v2/static/styles/icon-styles.css +9 -0
  31. ccai/integrationruntime/templates/v2/static/styles/mojo-components.css +384 -0
  32. ccai/integrationruntime/templates/v2/static/styles/prism.css +143 -0
  33. ccai/integrationruntime/templates/v2/static/styles/tabs-responsive.css +186 -0
  34. ccai/integrationruntime/templates/v2/static/styles/testsummary-accessibility.css +413 -0
  35. ccai/integrationruntime/templates/v2/static/styles/testsummary-comparison.css +746 -0
  36. ccai/integrationruntime/templates/v2/static/styles/testsummary-responsive.css +679 -0
  37. ccai/integrationruntime/templates/v2/static/styles/testsummary.css +1631 -0
  38. ccai/integrationruntime/templates/v2/tabs/tab-data.html +870 -0
  39. ccai/integrationruntime/templates/v2/tabs/tab-images.html +110 -0
  40. ccai/integrationruntime/templates/v2/tabs/tab-logs.html +594 -0
  41. ccai/integrationruntime/templates/v2/tabs/tab-sounds.html +112 -0
  42. ccai/integrationruntime/templates/v2/tabs/tab-timeseries.html +368 -0
  43. ccai/integrationruntime/templates/v2/tabs/tab-videos.html +372 -0
  44. ccai/integrationruntime/templates/v2/testsummary.html +81 -0
  45. codecraftai_integration_runtime-1.3.0.dist-info/METADATA +73 -0
  46. codecraftai_integration_runtime-1.3.0.dist-info/RECORD +48 -0
  47. codecraftai_integration_runtime-1.3.0.dist-info/WHEEL +4 -0
  48. codecraftai_integration_runtime-1.3.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,581 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.results.streaming.resultstreamer
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: Module for result streaming to external services.
5
+
6
+ This module provides classes for streaming test results to external services
7
+ in real-time. It supports both REST endpoint streaming and WebSocket-based
8
+ streaming.
9
+
10
+ The streaming functionality allows test results to be sent to external
11
+ monitoring services as they are generated, enabling real-time dashboards
12
+ and alerting systems.
13
+
14
+ .. moduleauthor:: CodeCraftX
15
+ """
16
+
17
+
18
+
19
+ __author__ = "CodeCraftX"
20
+ __copyright__ = "Copyright 2025, Code Craft AI LLC"
21
+ __credits__ = []
22
+
23
+
24
+ from typing import Optional, List, Any
25
+ from abc import ABC, abstractmethod
26
+
27
+ import json
28
+ import queue
29
+ import threading
30
+ import time
31
+ import traceback
32
+
33
+ from datetime import datetime
34
+
35
+ from ccai.xmodules.xlogging.enhancedloggers import getEnhancedLogger
36
+
37
+ from ccai.testbase.results.model.streaminginfo import (
38
+ StreamingInfo,
39
+ StreamingProtocol,
40
+ StreamingCallback
41
+ )
42
+
43
+ # Bound the streaming POST so an unresponsive endpoint cannot wedge the
44
+ # result-streamer daemon thread indefinitely.
45
+ STREAMING_POST_TIMEOUT_SECONDS = 30
46
+
47
+
48
+ class StreamingJsonEncoder(json.JSONEncoder):
49
+ """
50
+ A custom JSON encoder for streaming result data.
51
+
52
+ This encoder handles datetime serialization and other non-standard
53
+ types that may appear in result data.
54
+ """
55
+
56
+ def default(self, obj) -> Any:
57
+ """
58
+ Converts non-serializable objects to JSON-compatible representations.
59
+
60
+ :param obj: The object to serialize.
61
+ :returns: A JSON-compatible representation of the object.
62
+ """
63
+ if isinstance(obj, datetime):
64
+ return obj.isoformat()
65
+ return json.JSONEncoder.default(self, obj)
66
+
67
+
68
+ class ResultStreamer(ABC):
69
+ """
70
+ Abstract base class for result streaming implementations.
71
+
72
+ This class defines the interface for streaming test results to external
73
+ services. Concrete implementations handle specific protocols (REST, WebSocket).
74
+
75
+ The streamer operates in a background thread to avoid blocking test execution.
76
+ Results are queued and sent asynchronously.
77
+
78
+ Thread Safety:
79
+ The streamer is designed for concurrent access from multiple threads.
80
+ Results can be queued from any thread, and the streaming thread handles
81
+ delivery to the external service.
82
+ """
83
+
84
+ def __init__(self, streaming_info: StreamingInfo,
85
+ callback: Optional[StreamingCallback] = None):
86
+ """
87
+ Initializes the result streamer.
88
+
89
+ :param streaming_info: Configuration for the streaming connection.
90
+ :param callback: Optional callback for custom result handling.
91
+ """
92
+ self._streaming_info = streaming_info
93
+ self._callback = callback
94
+ self._logger = getEnhancedLogger()
95
+
96
+ self._result_queue: queue.Queue = queue.Queue()
97
+ self._streaming_thread: Optional[threading.Thread] = None
98
+ self._running = False
99
+ self._connected = False
100
+
101
+ self._lock = threading.Lock()
102
+ self._stats = {
103
+ "previews_sent": 0,
104
+ "results_sent": 0,
105
+ "errors": 0,
106
+ "reconnects": 0
107
+ }
108
+
109
+ @property
110
+ def is_running(self) -> bool:
111
+ """Returns True if the streaming thread is running."""
112
+ return self._running
113
+
114
+ @property
115
+ def is_connected(self) -> bool:
116
+ """Returns True if connected to the external service."""
117
+ return self._connected
118
+
119
+ @property
120
+ def stats(self) -> dict:
121
+ """Returns a copy of streaming statistics."""
122
+ with self._lock:
123
+ return dict(self._stats)
124
+
125
+ def start(self):
126
+ """
127
+ Starts the streaming thread.
128
+
129
+ This method initializes the connection to the external service
130
+ and starts the background thread that processes the result queue.
131
+ """
132
+ if self._running:
133
+ return
134
+
135
+ self._running = True
136
+
137
+ # Create and start the streaming thread
138
+ self._streaming_thread = threading.Thread(
139
+ target=self._streaming_thread_entry,
140
+ name="result-streamer",
141
+ daemon=True
142
+ )
143
+ self._streaming_thread.start()
144
+
145
+ # Wait for connection to be established
146
+ start_time = time.time()
147
+ while not self._connected and time.time() - start_time < 5.0:
148
+ time.sleep(0.05)
149
+
150
+ def stop(self):
151
+ """
152
+ Stops the streaming thread.
153
+
154
+ This method signals the streaming thread to stop and waits for
155
+ it to complete. Any remaining queued results are discarded.
156
+ """
157
+ self._running = False
158
+
159
+ # Put a sentinel value to wake up the thread
160
+ self._result_queue.put(None)
161
+
162
+ if self._streaming_thread is not None:
163
+ self._streaming_thread.join(timeout=5.0)
164
+ self._streaming_thread = None
165
+
166
+ self._disconnect()
167
+
168
+ def stream_preview(self, result_dict: dict):
169
+ """
170
+ Queues a preview result for streaming.
171
+
172
+ :param result_dict: The result dictionary to stream.
173
+ """
174
+ if not self._streaming_info.stream_previews:
175
+ return
176
+
177
+ self._result_queue.put(("preview", result_dict))
178
+
179
+ def stream_result(self, result_dict: dict):
180
+ """
181
+ Queues a final result for streaming.
182
+
183
+ :param result_dict: The result dictionary to stream.
184
+ """
185
+ if not self._streaming_info.stream_results:
186
+ return
187
+
188
+ self._result_queue.put(("result", result_dict))
189
+
190
+ def _streaming_thread_entry(self):
191
+ """
192
+ Entry point for the streaming thread.
193
+
194
+ This method runs the main streaming loop, processing queued
195
+ results and sending them to the external service.
196
+ """
197
+ # Establish initial connection
198
+ self._connect()
199
+
200
+ batch: List[tuple] = []
201
+ last_batch_time = time.time()
202
+
203
+ while self._running:
204
+ try:
205
+ # Get next item from queue with timeout
206
+ timeout = self._streaming_info.batch_timeout
207
+ try:
208
+ item = self._result_queue.get(timeout=timeout)
209
+ except queue.Empty:
210
+ item = None
211
+
212
+ # Check for stop signal
213
+ if item is None:
214
+ # Send any remaining batch items
215
+ if batch:
216
+ self._send_batch(batch)
217
+ batch = []
218
+
219
+ if not self._running:
220
+ break
221
+ continue
222
+
223
+ # Add to batch
224
+ batch.append(item)
225
+
226
+ # Check if batch should be sent
227
+ batch_size = self._streaming_info.batch_size
228
+ batch_timeout = self._streaming_info.batch_timeout
229
+ time_since_batch = time.time() - last_batch_time
230
+
231
+ if len(batch) >= batch_size or time_since_batch >= batch_timeout:
232
+ self._send_batch(batch)
233
+ batch = []
234
+ last_batch_time = time.time()
235
+
236
+ except Exception:
237
+ errmsg = traceback.format_exc()
238
+ self._logger.error(f"Error in streaming thread: {errmsg}")
239
+
240
+ with self._lock:
241
+ self._stats["errors"] += 1
242
+
243
+ # Attempt reconnection if configured
244
+ if self._streaming_info.reconnect_on_failure:
245
+ self._reconnect()
246
+
247
+ # Final disconnect
248
+ self._disconnect()
249
+
250
+ def _send_batch(self, batch: List[tuple]):
251
+ """
252
+ Sends a batch of results to the external service.
253
+
254
+ :param batch: List of (type, result_dict) tuples to send.
255
+ """
256
+ for item_type, result_dict in batch:
257
+ is_preview = item_type == "preview"
258
+
259
+ try:
260
+ # Call custom callback if provided
261
+ if self._callback is not None:
262
+ success = self._callback.on_result(result_dict, is_preview)
263
+ if not success:
264
+ continue
265
+
266
+ # Send via protocol-specific implementation
267
+ self._send_result(result_dict, is_preview)
268
+
269
+ # Update stats
270
+ with self._lock:
271
+ if is_preview:
272
+ self._stats["previews_sent"] += 1
273
+ else:
274
+ self._stats["results_sent"] += 1
275
+
276
+ except Exception as err:
277
+ with self._lock:
278
+ self._stats["errors"] += 1
279
+
280
+ if self._callback is not None and self._callback.on_error is not None:
281
+ self._callback.on_error(err)
282
+
283
+ self._logger.error(f"Error sending result: {traceback.format_exc()}")
284
+
285
+ def _reconnect(self):
286
+ """
287
+ Attempts to reconnect to the external service.
288
+ """
289
+ self._disconnect()
290
+
291
+ with self._lock:
292
+ self._stats["reconnects"] += 1
293
+
294
+ time.sleep(self._streaming_info.reconnect_interval)
295
+ self._connect()
296
+
297
+ @abstractmethod
298
+ def _connect(self):
299
+ """
300
+ Establishes connection to the external service.
301
+
302
+ This method must be implemented by concrete subclasses.
303
+ """
304
+ pass
305
+
306
+ @abstractmethod
307
+ def _disconnect(self):
308
+ """
309
+ Closes connection to the external service.
310
+
311
+ This method must be implemented by concrete subclasses.
312
+ """
313
+ pass
314
+
315
+ @abstractmethod
316
+ def _send_result(self, result_dict: dict, is_preview: bool):
317
+ """
318
+ Sends a single result to the external service.
319
+
320
+ :param result_dict: The result dictionary to send.
321
+ :param is_preview: True if this is a preview, False for final result.
322
+ """
323
+ pass
324
+
325
+
326
+
327
+ class RestResultStreamer(ResultStreamer):
328
+ """
329
+ Result streamer that sends results to REST endpoints via HTTP POST.
330
+
331
+ This streamer sends each result as a JSON payload to the configured
332
+ REST endpoint. It supports custom headers for authentication and
333
+ other purposes.
334
+
335
+ Example Usage::
336
+
337
+ streaming_info = StreamingInfo(
338
+ protocol=StreamingProtocol.REST,
339
+ streaming_url="https://monitoring.example.com/api/results",
340
+ streaming_headers={"Authorization": "Bearer token123"},
341
+ stream_previews=True,
342
+ stream_results=True
343
+ )
344
+
345
+ streamer = RestResultStreamer(streaming_info)
346
+ streamer.start()
347
+
348
+ # Stream results
349
+ streamer.stream_preview(preview_dict)
350
+ streamer.stream_result(result_dict)
351
+
352
+ # Stop when done
353
+ streamer.stop()
354
+ """
355
+
356
+ def __init__(self, streaming_info: StreamingInfo,
357
+ callback: Optional[StreamingCallback] = None):
358
+ """
359
+ Initializes the REST result streamer.
360
+
361
+ :param streaming_info: Configuration for the REST endpoint.
362
+ :param callback: Optional callback for custom result handling.
363
+ """
364
+ super().__init__(streaming_info, callback)
365
+ self._session = None
366
+
367
+ def _connect(self):
368
+ """
369
+ Establishes connection to the REST endpoint.
370
+
371
+ For REST streaming, this creates a requests session for
372
+ connection pooling and sets up default headers.
373
+ """
374
+ try:
375
+ import requests
376
+
377
+ self._session = requests.Session()
378
+
379
+ # Set default headers
380
+ self._session.headers.update({
381
+ "Content-Type": "application/json"
382
+ })
383
+
384
+ # Add custom headers if configured
385
+ if self._streaming_info.streaming_headers:
386
+ self._session.headers.update(self._streaming_info.streaming_headers)
387
+
388
+ self._connected = True
389
+
390
+ if self._callback is not None and self._callback.on_connect is not None:
391
+ self._callback.on_connect()
392
+
393
+ except Exception:
394
+ self._connected = False
395
+ self._logger.error(f"Failed to initialize REST session: {traceback.format_exc()}")
396
+
397
+ def _disconnect(self):
398
+ """
399
+ Closes the REST session.
400
+ """
401
+ if self._session is not None:
402
+ try:
403
+ self._session.close()
404
+ except Exception:
405
+ # Best-effort close; the session is discarded either way and a close failure must not block the state reset.
406
+ pass
407
+ self._session = None
408
+
409
+ self._connected = False
410
+
411
+ if self._callback is not None and self._callback.on_disconnect is not None:
412
+ self._callback.on_disconnect()
413
+
414
+ def _send_result(self, result_dict: dict, is_preview: bool):
415
+ """
416
+ Sends a result to the REST endpoint via HTTP POST.
417
+
418
+ :param result_dict: The result dictionary to send.
419
+ :param is_preview: True if this is a preview, False for final result.
420
+ """
421
+ if self._session is None:
422
+ raise RuntimeError("REST session not initialized")
423
+
424
+ # Prepare payload
425
+ payload = {
426
+ "type": "preview" if is_preview else "result",
427
+ "data": result_dict,
428
+ "timestamp": datetime.now().isoformat()
429
+ }
430
+
431
+ # Send POST request
432
+ json_data = json.dumps(payload, cls=StreamingJsonEncoder)
433
+ response = self._session.post(
434
+ self._streaming_info.streaming_url,
435
+ data=json_data,
436
+ timeout=STREAMING_POST_TIMEOUT_SECONDS
437
+ )
438
+
439
+ # Check response
440
+ if response.status_code >= 400:
441
+ raise RuntimeError(
442
+ f"REST endpoint returned error: {response.status_code} - {response.text}"
443
+ )
444
+
445
+
446
+ class WebSocketResultStreamer(ResultStreamer):
447
+ """
448
+ Result streamer that sends results over a WebSocket connection.
449
+
450
+ This streamer maintains a persistent WebSocket connection to the
451
+ external service and sends results as JSON messages. It supports
452
+ automatic reconnection on connection failure.
453
+
454
+ Example Usage::
455
+
456
+ streaming_info = StreamingInfo(
457
+ protocol=StreamingProtocol.WEBSOCKET,
458
+ streaming_url="wss://monitoring.example.com/ws/results",
459
+ streaming_headers={"Authorization": "Bearer token123"},
460
+ stream_previews=True,
461
+ stream_results=True,
462
+ reconnect_on_failure=True,
463
+ reconnect_interval=5.0
464
+ )
465
+
466
+ streamer = WebSocketResultStreamer(streaming_info)
467
+ streamer.start()
468
+
469
+ # Stream results
470
+ streamer.stream_preview(preview_dict)
471
+ streamer.stream_result(result_dict)
472
+
473
+ # Stop when done
474
+ streamer.stop()
475
+ """
476
+
477
+ def __init__(self, streaming_info: StreamingInfo,
478
+ callback: Optional[StreamingCallback] = None):
479
+ """
480
+ Initializes the WebSocket result streamer.
481
+
482
+ :param streaming_info: Configuration for the WebSocket connection.
483
+ :param callback: Optional callback for custom result handling.
484
+ """
485
+ super().__init__(streaming_info, callback)
486
+ self._websocket = None
487
+
488
+ def _connect(self):
489
+ """
490
+ Establishes WebSocket connection to the external service.
491
+ """
492
+ try:
493
+ # Import websocket-client library
494
+ try:
495
+ import websocket
496
+ except ImportError:
497
+ self._logger.error(
498
+ "websocket-client library not installed. "
499
+ "Install with: pip install websocket-client"
500
+ )
501
+ self._connected = False
502
+ return
503
+
504
+ # Prepare headers
505
+ headers = {}
506
+ if self._streaming_info.streaming_headers:
507
+ headers = self._streaming_info.streaming_headers
508
+
509
+ # Create WebSocket connection
510
+ self._websocket = websocket.create_connection(
511
+ self._streaming_info.streaming_url,
512
+ header=headers
513
+ )
514
+
515
+ self._connected = True
516
+
517
+ if self._callback is not None and self._callback.on_connect is not None:
518
+ self._callback.on_connect()
519
+
520
+ except Exception:
521
+ self._connected = False
522
+ self._logger.error(f"Failed to connect WebSocket: {traceback.format_exc()}")
523
+
524
+ def _disconnect(self):
525
+ """
526
+ Closes the WebSocket connection.
527
+ """
528
+ if self._websocket is not None:
529
+ try:
530
+ self._websocket.close()
531
+ except Exception:
532
+ # Best-effort close; the WebSocket is discarded either way and a close failure must not block the state reset.
533
+ pass
534
+ self._websocket = None
535
+
536
+ self._connected = False
537
+
538
+ if self._callback is not None and self._callback.on_disconnect is not None:
539
+ self._callback.on_disconnect()
540
+
541
+ def _send_result(self, result_dict: dict, is_preview: bool):
542
+ """
543
+ Sends a result over the WebSocket connection.
544
+
545
+ :param result_dict: The result dictionary to send.
546
+ :param is_preview: True if this is a preview, False for final result.
547
+ """
548
+ if self._websocket is None:
549
+ raise RuntimeError("WebSocket not connected")
550
+
551
+ # Prepare message
552
+ message = {
553
+ "type": "preview" if is_preview else "result",
554
+ "data": result_dict,
555
+ "timestamp": datetime.now().isoformat()
556
+ }
557
+
558
+ # Send message
559
+ json_data = json.dumps(message, cls=StreamingJsonEncoder)
560
+ self._websocket.send(json_data)
561
+
562
+
563
+ def create_result_streamer(streaming_info: StreamingInfo,
564
+ callback: Optional[StreamingCallback] = None) -> ResultStreamer:
565
+ """
566
+ Factory function to create the appropriate result streamer.
567
+
568
+ This function creates a result streamer based on the protocol
569
+ specified in the streaming configuration.
570
+
571
+ :param streaming_info: Configuration for the streaming connection.
572
+ :param callback: Optional callback for custom result handling.
573
+ :returns: A ResultStreamer instance for the specified protocol.
574
+ :raises: ValueError if the protocol is not supported.
575
+ """
576
+ if streaming_info.protocol == StreamingProtocol.REST:
577
+ return RestResultStreamer(streaming_info, callback)
578
+ elif streaming_info.protocol == StreamingProtocol.WEBSOCKET:
579
+ return WebSocketResultStreamer(streaming_info, callback)
580
+ else:
581
+ raise ValueError(f"Unsupported streaming protocol: {streaming_info.protocol}")
@@ -0,0 +1,68 @@
1
+ """
2
+ .. module:: ccai.integrationruntime.runtimeoutputcontext
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: The integration :class:`IOutputContext` that resolves run artefact directories under
5
+ the activated application's well-known presence folder.
6
+
7
+ Where the standalone :class:`ccai.testbase.output.outputcontext.SimpleOutputContext` roots
8
+ everything under ``<cwd>/.output``, :class:`RuntimeOutputContext` delegates to the well-known
9
+ path helpers in :mod:`ccai.thisapp.paths` so that, when the process has been activated as a
10
+ test-run job, results / diagnostics / per-testcase by-products land under the presence folder
11
+ (``AM_PRESENCE_DIR`` / ``AM_RESULT_PATH_FOR_TESTS``). Those helpers are *activation-gated* — they
12
+ raise :class:`SemanticError` unless ``AM_JOB_TYPE`` has been set — which is exactly why plain
13
+ ``testbase`` must NOT use this context.
14
+
15
+ :class:`ccai.integrationruntime.integratedtestjob.IntegratedTestJob` installs this context by
16
+ overriding ``TestJob._create_output_context``.
17
+
18
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
19
+ """
20
+
21
+ __author__ = "Myron Walker"
22
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
23
+ __credits__ = []
24
+
25
+
26
+ from typing import Optional
27
+
28
+ from ccai.testbase.output.outputcontext import IOutputContext
29
+
30
+ from ccai.thisapp.paths import (
31
+ get_path_for_testresults,
32
+ get_path_for_testcase_by_products,
33
+ get_path_for_diagnostics,
34
+ get_summary_html_template_source,
35
+ get_summary_static_resource_src_dir,
36
+ get_summary_static_resource_dest_dir,
37
+ )
38
+
39
+
40
+ class RuntimeOutputContext(IOutputContext):
41
+ """
42
+ Integration output context that resolves artefact directories under the activated
43
+ application's well-known presence folder via :mod:`ccai.thisapp.paths`.
44
+ """
45
+
46
+ def get_test_results_dir(self) -> str:
47
+ results_dir = get_path_for_testresults()
48
+ return results_dir
49
+
50
+ def get_testcase_byproducts_dir(self, test_id: str) -> str:
51
+ byproducts_dir = get_path_for_testcase_by_products(test_id)
52
+ return byproducts_dir
53
+
54
+ def get_diagnostics_dir(self, label: str) -> str:
55
+ diagnostics_dir = get_path_for_diagnostics(label)
56
+ return diagnostics_dir
57
+
58
+ def get_summary_template_source(self) -> Optional[str]:
59
+ template_source = get_summary_html_template_source()
60
+ return template_source
61
+
62
+ def get_static_resource_source(self) -> Optional[str]:
63
+ resource_source = get_summary_static_resource_src_dir()
64
+ return resource_source
65
+
66
+ def get_static_resource_destination(self) -> Optional[str]:
67
+ resource_destination = get_summary_static_resource_dest_dir()
68
+ return resource_destination