| 123456789101112131415161718192021222324252627282930313233343536373839 |
- from pathlib import Path
- import shutil
- import pytest
- from tools.source_package_closure import current_cpld_paths
- ROOT=Path(__file__).resolve().parents[2]
- def test_current_closure_contains_public_replay_dependencies():
- paths=current_cpld_paths(ROOT)
- required={'tools/fw_targets.py','tools/source_identity.py','tools/source_package_closure.py',
- 'contracts/mrdimm-status.yaml','contracts/ct7428-format.json','config/current-product-tests.json',
- 'generated/mrdimm/snapshot-layout.json','tools/_vendor/prod2u_status.py',
- 'tests/sim/i2c_master_tasks.vh','tests/sim/motor_queue_storage_tb.v','tools/td2026',
- 'docs/current-analysis-status.md','docs/audits/mrdimm-header-word-copy.md',
- 'tests/sim/motor_control_hold_monitor.vh','tools/prod2u_gui.py',
- 'tools/remote/prod2u-remote.ps1','tools/windows/remote-doctor.ps1',
- 'tests/unit/test_windows_remote_entrypoints.py'}
- assert required<=set(paths)
- assert len(paths)==len(set(paths))
- assert not any('/legacy/' in p or p.startswith('src/generated/') for p in paths)
- assert not {'ACTIVE_GOAL_LOCK.yaml','PHASE_STATE.json','EVIDENCE_INDEX.json'} & set(paths)
- def copy_closure(destination):
- for relative in current_cpld_paths(ROOT):
- path=destination/relative;path.parent.mkdir(parents=True,exist_ok=True)
- shutil.copy2(ROOT/relative,path)
- def test_missing_local_import_fails_instead_of_disappearing(tmp_path):
- copy_closure(tmp_path)
- path=tmp_path/'tools/fw_cli.py'
- path.write_text(path.read_text()+'\nfrom tools.missing_required_replay_module import run\n')
- with pytest.raises(ValueError,match='required local Python import missing'):
- current_cpld_paths(tmp_path)
- def test_missing_generated_dependency_fails(tmp_path):
- copy_closure(tmp_path)
- (tmp_path/'generated/mrdimm/snapshot-layout.json').unlink()
- with pytest.raises(ValueError,match='required source dependency missing'):
- current_cpld_paths(tmp_path)
|