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
@@ -8,7 +8,8 @@ from cbb_refresh_verify.runtime_timing import parse_save_progress
|
||||
|
||||
|
||||
@pytest.mark.parametrize('save_ok', [True, False])
|
||||
def test_packaged_vbs_measures_real_save_call_and_preserves_failure_gate(tmp_path, save_ok):
|
||||
@pytest.mark.parametrize('other_document', [True, False])
|
||||
def test_packaged_vbs_measures_real_save_call_and_preserves_failure_gate(tmp_path, save_ok, other_document):
|
||||
# Execute the real helper in its target 32-bit host. Only external COM
|
||||
# object creation is replaced; Save/Validate/Close order and timers are real.
|
||||
script = Path(__file__).parents[1] / 'src/cbb_refresh_verify/save_verified_block.vbs'
|
||||
@@ -39,14 +40,20 @@ Class FakeDoc
|
||||
IsSaved = True
|
||||
End Function
|
||||
Public Function Close(saveChanges)
|
||||
closedDoc = True
|
||||
Close = True
|
||||
End Function
|
||||
End Class
|
||||
Class FakeApp
|
||||
Public Property Get ActiveDocument
|
||||
Set ActiveDocument = New FakeDoc
|
||||
If closedDoc And Not OTHER_DOCUMENT Then
|
||||
Set ActiveDocument = Nothing
|
||||
Else
|
||||
Set ActiveDocument = New FakeDoc
|
||||
End If
|
||||
End Property
|
||||
Public Sub Quit()
|
||||
WScript.Echo "TEST_QUIT"
|
||||
End Sub
|
||||
End Class
|
||||
Class FakeLic
|
||||
@@ -55,7 +62,8 @@ Class FakeLic
|
||||
End Function
|
||||
End Class
|
||||
'''
|
||||
source = source.replace('Option Explicit', 'Option Explicit\n' + classes.replace('SAVE_RETURN', str(save_ok)))
|
||||
source = source.replace('Option Explicit', 'Option Explicit\nDim closedDoc\n'
|
||||
+ classes.replace('SAVE_RETURN', str(save_ok)).replace('OTHER_DOCUMENT', str(other_document)))
|
||||
source = source.replace('GetObject(, "MGCPCB.Application")', 'New FakeApp')
|
||||
source = source.replace('CreateObject("MGCPCBAutomationLicensing.Application")', 'New FakeLic')
|
||||
harness = tmp_path/'save_harness.vbs'
|
||||
@@ -66,11 +74,13 @@ End Class
|
||||
parsed = parse_save_progress(completed.stdout)
|
||||
assert parsed['timings_seconds']['save'] >= .08
|
||||
if save_ok:
|
||||
assert completed.returncode == 0, completed.stderr
|
||||
assert completed.returncode == (10 if other_document else 0), completed.stderr
|
||||
assert 'SAVE_OK' in parsed['markers']
|
||||
assert 'CLOSE_OK' in parsed['markers']
|
||||
assert parsed['timings_seconds']['post_save_check'] >= 0
|
||||
assert parsed['timings_seconds']['close'] >= 0
|
||||
assert ('TEST_QUIT' in completed.stdout) is (not other_document)
|
||||
assert ('APP_RETAINED_OTHER_DOCUMENT' in completed.stdout) is other_document
|
||||
else:
|
||||
assert completed.returncode == 4, completed.stderr
|
||||
assert 'SAVE_OK' not in parsed['markers']
|
||||
|
||||
Reference in new issue
Block a user