perf(execution): close readback and no-match projects without resaving
This commit is contained in:
1 parent
5a0f62f0de
commit
e5ebc5d14e
2 files changed
+41
-4
No files matched your search
@@ -909,9 +909,11 @@ Sub QPFinishBatchItem()
|
||||
ValueStates.Item(CStr(Index)).Add "custom_value", QPCustomValue(Command)
|
||||
Next
|
||||
End If
|
||||
If FinalState = "restored_ok" Or Not QP_SessionMode Then
|
||||
If FinalState = "restored_ok" Then
|
||||
QPCloseBatchProject TargetPath, True
|
||||
QP_BatchSaveCommitted = True
|
||||
ElseIf Not QP_SessionMode Then
|
||||
QPCloseBatchProject TargetPath, False
|
||||
End If
|
||||
If FinalState = "restored_ok" Then
|
||||
QPProgress "verify_saved_project", 0, 1
|
||||
@@ -927,7 +929,7 @@ Sub QPFinishBatchItem()
|
||||
Plans.Add CStr(Index), Candidate
|
||||
Next
|
||||
QPVerifyRestoredPlans Command, Records, Plans, ValueStates
|
||||
If Not QP_SessionMode Then QPCloseBatchProject TargetPath, True
|
||||
If Not QP_SessionMode Then QPCloseBatchProject TargetPath, False
|
||||
FinalState = "saved_ok"
|
||||
If QP_SessionMode Then
|
||||
QP_BatchMessage = QP_BatchMessage & " Saved and reopened for readback; owned project checkpoint verified."
|
||||
|
||||
@@ -77,7 +77,7 @@ Class ValuePin
|
||||
End Class
|
||||
Class ValueApp
|
||||
Public Components, Pins, ProjectPath, UndoCount, PinQueries, TransactionOpen, TransactionCount
|
||||
Public DocumentCount, CloseCount, SaveCalled, RefuseClose
|
||||
Public DocumentCount, CloseCount, SaveCalled, SaveCount, RefuseClose
|
||||
Public Function SchematicSheetDocuments()
|
||||
Set SchematicSheetDocuments=Me
|
||||
End Function
|
||||
@@ -90,7 +90,10 @@ Class ValueApp
|
||||
End Function
|
||||
Public Sub Close(ByVal SaveChanges,ByVal FileName)
|
||||
CloseCount=CloseCount+1
|
||||
If SaveChanges Then SaveCalled=True
|
||||
If SaveChanges Then
|
||||
SaveCalled=True
|
||||
SaveCount=SaveCount+1
|
||||
End If
|
||||
End Sub
|
||||
Public Sub CloseProject()
|
||||
Require CloseCount=1,"project closed before document"
|
||||
@@ -327,6 +330,38 @@ Require SnapshotReads=1,"same boundary parsed its snapshot twice"
|
||||
''', routines_transform=count_reads)
|
||||
|
||||
|
||||
def test_non_session_batch_saves_once_and_closes_disk_readback_without_saving(tmp_path):
|
||||
run_vbs(tmp_path, 'part_number', '''
|
||||
Dim FullChecks
|
||||
FullChecks=0
|
||||
Command.Add "project_path",QPProjectPath()
|
||||
QP_BatchMode=True: QP_SessionMode=False
|
||||
QP_OwnedProject=True: QP_OwnedProjectPath=QPProjectPath()
|
||||
QPRestoreAfterOperatorReplace Command,SnapshotPath
|
||||
QPFinishBatchItem
|
||||
Require QP_App.SaveCount=1,"read-only disk verification saved the project again"
|
||||
Require Len(QP_App.ProjectPath)=0,"batch did not close the readback project"
|
||||
Require QP_BatchSaveCommitted,"real replacement save was not recorded"
|
||||
Require InStr(QPReadUtf8(QP_Fso.BuildPath(QP_Root,"status.tsv")),"saved_ok")>0,"no completion proof"
|
||||
''', routines_transform=_batch_readback_fixture)
|
||||
|
||||
|
||||
def test_non_session_no_match_closes_without_any_save(tmp_path):
|
||||
run_vbs(tmp_path, 'part_number', '''
|
||||
Dim FullChecks
|
||||
FullChecks=0
|
||||
Command.Add "project_path",QPProjectPath()
|
||||
QP_BatchMode=True: QP_SessionMode=False
|
||||
QP_OwnedProject=True: QP_OwnedProjectPath=QPProjectPath()
|
||||
QPCaptureAndSelect Command,SnapshotPath
|
||||
QPFinishBatchItem
|
||||
Require Not QP_App.SaveCalled,"no-match project was saved despite no replacement writes"
|
||||
Require Not QP_BatchSaveCommitted,"no-match was recorded as a save"
|
||||
Require Len(QP_App.ProjectPath)=0,"no-match owned project did not close"
|
||||
Require InStr(QPReadUtf8(QP_Fso.BuildPath(QP_Root,"status.tsv")),"no_match")>0,"no-match proof missing"
|
||||
''', routines_transform=_batch_readback_fixture)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('mode', ['preserve', 'part_label', 'part_number'])
|
||||
def test_recovery_repairs_attributes_without_native_replace(tmp_path, mode):
|
||||
run_vbs(tmp_path, mode, '''
|
||||
|
||||
Reference in new issue
Block a user