Move src/lib/ → src/testium/runtime/ (internal plumbing)
Move src/testium/libs/ → src/testium/api/ (public SDK for test scripts)
Move src/py_func/ → src/testium/py_func/ (Python subprocess)
Move src/lua_func/ → src/testium/lua_func/ (Lua subprocess data)
The package now ships as a single coherent unit instead of four sibling
top-level packages (testium, lib, py_func, lua_func) — pip install
gives a clean site-packages/testium/ with no namespace pollution; .lua
files travel with the wheel via package_data; the wheel installs
cleanly and `testium -b` runs end-to-end including py_func subprocesses
and entry-point exporter plugins.
Naming:
- runtime/ (internal, no API guarantees) clearer than lib/
- api/ (public SDK consumed as `import api.testium as tm`) clearer than libs/
Imports updated en masse: from lib. → from runtime. and from libs. →
from api., plus the importlib.import_module("libs.*") strings in
test_item_console.py and test_item_runtime_plot.py. Test/example
scripts (helper_lib.py, parallel.py, post_execution.py) and the
fake_exporter test suite migrated too.
paths.py: subproc_path() now returns testium_path() — both point at
the testium package directory since the subprocesses live inside.
pyproject.toml: removed exclude=["lua_func", "py_func"] (no longer
needed), added package-data for testium.lua_func/*.lua, removed the
license classifier (PEP 639 conflict with license expression).
Subprocess isolation contract: py_func/ and lua_func/ may only import
runtime/ and their own modules — never interpreter/, main_win/, api/,
or testium/. Enforced by test/validation/items/isolation/ which runs a
py_func that statically scans subprocess source files for forbidden
imports. The contract holds today; the test prevents future drift.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
|
|
from interpreter.test_items.test_item import (TestItem, test_run)
|
|
from interpreter.test_items.test_result import (TestValue)
|
|
from runtime.tum_except import ETUMSyntaxError
|
|
from interpreter.utils.constants import TestItemType as cst
|
|
from interpreter.test_report.test_report import Export
|
|
|
|
class TestItemReport(TestItem):
|
|
def __init__(self, dict_item, parent = None, status_queue=None, filename=""):
|
|
self._name = cst.TYPE_REPORT.item_name
|
|
super().__init__(dict_item, parent, status_queue, filename=filename)
|
|
self._type = cst.TYPE_REPORT
|
|
self.is_container = False
|
|
|
|
if not 'export' in dict_item:
|
|
raise ETUMSyntaxError(
|
|
f"The '{self.cmd()}' test item named '{self.name()}' needs an 'export' section",
|
|
self.seqFilename()
|
|
)
|
|
|
|
self.tum_report = dict_item['export']
|
|
|
|
@test_run
|
|
def execute(self):
|
|
self.result.set(TestValue.FAILURE, 'an exception occured during report execution.')
|
|
|
|
dict_rep = self._prms.expanse(self.tum_report)
|
|
if not isinstance(dict_rep, list):
|
|
self.result.set(TestValue.FAILURE, 'Report item needs a "report" section')
|
|
return
|
|
rep_name = self._prms.expanse(self._name)
|
|
|
|
reports = []
|
|
for exp in dict_rep:
|
|
reports.append(Export(exp))
|
|
|
|
success = TestValue.SUCCESS
|
|
for rep in reports:
|
|
try:
|
|
rep.exec(self.report.db_connection, rep_name, no_header=True)
|
|
except Exception as e:
|
|
print(f"Error reporting '{rep.type}': {e}")
|
|
|
|
|
|
self.result.set(success)
|