The parallel item runs branches concurrently with sync:all or sync:any policy and optional per-branch wait_for synchronization. Each branch runs in its own daemon thread and produces a clean per-item entry in the SQLite report; the live output is prefixed [<branch_name>] so concurrent branches stay readable. Supporting changes: - StdoutProxy (lib/stdout_redirect.py): thread-aware sys.stdout/stderr with per-thread capture buffers and per-branch live-output prefix. Adds writeln() for Python 3.14 unittest compatibility. - TestItemContainer: shared base extracted from Group/Cycle for the sequential children execution pattern. - TestItemSleep: interruptible loop polling _is_stopped so sync:any can cancel slow branches quickly. - TestReport: thread-safe SQLite (check_same_thread=False + lock). Also drops the unused -m/--terminal mode and its module. Validation: 11 scenarios in test/validation/items/parallel covering sync:all/any, no_fail, wait_for + timeout, conditions, multi-branch, nested parallel, parallel inside loop, real branch failure. Documentation: new parallel_test_item.rst added to the manual. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
17 lines
349 B
Python
17 lines
349 B
Python
import time
|
|
import libs.testium as tm
|
|
|
|
|
|
def sleep_func(duration):
|
|
time.sleep(float(duration))
|
|
return 0
|
|
|
|
|
|
def check_duration(item_name, max_duration):
|
|
t0 = tm.gd(f"ts_start_{item_name}")
|
|
t1 = tm.gd(f"ts_end_{item_name}")
|
|
duration = tm.timestamp_as_sec(t1 - t0)
|
|
if duration < float(max_duration):
|
|
return 0
|
|
return 1
|