tests/system/cross-major-observability/test.py reuses the real-manager harness from tests/system/cross-major/test.py, because duplicating ~600 lines of ManagerProc / contract-source / mock-host plumbing would be worse. There is no blessed way to do that, so it currently does this:
def _load_cross_major_harness():
path = Path(__file__).parents[1] / 'cross-major' / 'test.py'
spec = importlib.util.spec_from_file_location('cross_major_system_harness', path)
...
and then reaches for base._contract_source, base._message, base._calldata, base._apply_storage_changes, base.CrossMajorStep, base.ManagerProc, base.SENDER, base.PY_GENLAYER_V03 — eight private names across a module boundary, plus a path coupling that breaks silently if the sibling directory is renamed.
It works and the case passes, but it is the wrong shape.
Suggested fix
Extract the generic parts into an importable module — tests/runner/gvm_extra/ is already on the test path (from gvm_extra.mock_host import MockStorage works today). Roughly:
- constants (
SENDER, TIMESTAMP, PY_GENLAYER_V03), _contract_source, _TestContext, ManagerProc, _message, _calldata, _apply_storage_changes, _descendants;
- the harness half of
CrossMajorStep (_new_host, _deploy, _replace_code) as a base class, leaving each case its own _execute and _assert_*.
Then both cases import it normally and the importlib loader goes away.
Deliberately not done in the same change: it is a real refactor of the 1452-line cross-major/test.py, and splitting that class is worth doing on its own rather than tacked onto a new test.
tests/system/cross-major-observability/test.pyreuses the real-manager harness fromtests/system/cross-major/test.py, because duplicating ~600 lines ofManagerProc/ contract-source / mock-host plumbing would be worse. There is no blessed way to do that, so it currently does this:and then reaches for
base._contract_source,base._message,base._calldata,base._apply_storage_changes,base.CrossMajorStep,base.ManagerProc,base.SENDER,base.PY_GENLAYER_V03— eight private names across a module boundary, plus a path coupling that breaks silently if the sibling directory is renamed.It works and the case passes, but it is the wrong shape.
Suggested fix
Extract the generic parts into an importable module —
tests/runner/gvm_extra/is already on the test path (from gvm_extra.mock_host import MockStorageworks today). Roughly:SENDER,TIMESTAMP,PY_GENLAYER_V03),_contract_source,_TestContext,ManagerProc,_message,_calldata,_apply_storage_changes,_descendants;CrossMajorStep(_new_host,_deploy,_replace_code) as a base class, leaving each case its own_executeand_assert_*.Then both cases import it normally and the
importlibloader goes away.Deliberately not done in the same change: it is a real refactor of the 1452-line
cross-major/test.py, and splitting that class is worth doing on its own rather than tacked onto a new test.