feat: integrate native diagnostics and coordinated CBB transactions
This commit is contained in:
1 parent
9e230e1a46
commit
da67de026f
91 files changed
+14370
-435
No files matched your search
@@ -0,0 +1,66 @@
|
||||
"""Real EE7.9.5 PRJ shape: PCB pcb.prj may use LayoutDB without iCDBDir."""
|
||||
import pytest
|
||||
|
||||
from cbb_refresh_verify.management import source_project, engineering_identity
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def healthy_source(tmp_path):
|
||||
(tmp_path/'database').mkdir()
|
||||
(tmp_path/'database/icdb.dat').write_bytes(b'schematic database')
|
||||
(tmp_path/'PCB/Layout').mkdir(parents=True)
|
||||
(tmp_path/'PCB/Layout/LayoutDB.lyt').write_bytes(b'layout database')
|
||||
source = tmp_path/'IP101GR.prj'
|
||||
source.write_text('KEY RootBlock "IP101GR"\nKEY FlowType "DX"\n'
|
||||
'KEY iCDBDir ".\\database"\nKEY PCBDesignPath "PCB\\IP101GR.pcb"\n', encoding='utf-8')
|
||||
(tmp_path/'PCB/IP101GR.pcb').write_text('KEY ProjectFile "..\\IP101GR.prj"\n', encoding='utf-8')
|
||||
(tmp_path/'PCB/pcb.prj').write_text('SECTION Project\nKEY CentralLibrary "old.lmc"\nENDSECTION\n', encoding='utf-8')
|
||||
return source
|
||||
|
||||
|
||||
def test_layout_based_pcb_without_independent_icdb_directory_is_complete(healthy_source):
|
||||
source, pcb, top = source_project(healthy_source)
|
||||
assert source == healthy_source
|
||||
assert pcb == healthy_source.parent/'PCB/IP101GR.pcb'
|
||||
assert top == 'IP101GR'
|
||||
assert engineering_identity(source)['top_level_block'] == 'IP101GR'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('missing', ['database/icdb.dat', 'PCB/Layout/LayoutDB.lyt'])
|
||||
def test_optional_pcb_icdb_does_not_relax_required_engineering_files(healthy_source, missing):
|
||||
(healthy_source.parent/missing).unlink()
|
||||
with pytest.raises(ValueError):
|
||||
source_project(healthy_source)
|
||||
|
||||
|
||||
def test_linked_legacy_pcb_uses_explicit_main_project_without_guessing_template(healthy_source):
|
||||
(healthy_source.parent/'PCB/pcb.prj').rename(healthy_source.parent/'PCB/template.prj')
|
||||
assert source_project(healthy_source)[0] == healthy_source
|
||||
(healthy_source.parent/'PCB/IP101GR.pcb').write_text('KEY ProjectFile "../wrong.prj"\n')
|
||||
with pytest.raises(ValueError, match='PCB'):
|
||||
source_project(healthy_source)
|
||||
|
||||
|
||||
def test_main_schematic_icdb_declaration_remains_required(healthy_source):
|
||||
text = healthy_source.read_text(encoding='utf-8').replace('KEY iCDBDir ".\\database"\n', '')
|
||||
healthy_source.write_text(text, encoding='utf-8')
|
||||
with pytest.raises(ValueError, match='iCDBDir'):
|
||||
source_project(healthy_source)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('declared', [
|
||||
'KEY iCDBDir "missing"\n',
|
||||
'KEY iCDBDir "..\\..\\outside"\n',
|
||||
'KEY iCDBDir "C:\\external"\n',
|
||||
'KEY iCDBDir ""\n',
|
||||
'KEY iCDBDir "..\\database"\nKEY iCDBDir "..\\database"\n',
|
||||
])
|
||||
def test_explicit_pcb_icdb_reference_must_be_unique_contained_and_exist(healthy_source, declared):
|
||||
(healthy_source.parent/'PCB/pcb.prj').write_text(declared, encoding='utf-8')
|
||||
with pytest.raises(ValueError):
|
||||
source_project(healthy_source)
|
||||
|
||||
|
||||
def test_valid_explicit_pcb_icdb_directory_remains_supported(healthy_source):
|
||||
(healthy_source.parent/'PCB/pcb.prj').write_text('KEY iCDBDir "..\\database"\n', encoding='utf-8')
|
||||
assert source_project(healthy_source)[0] == healthy_source
|
||||
Reference in new issue
Block a user