fix: preserve bound project paths through progress and health checkpoints
Core regression / Python core and release configuration (push) Successful in 33s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 31s
Core regression / JavaScript syntax (pull_request) Successful in 3s
Core regression / Python core and release configuration (push) Successful in 33s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Successful in 31s
Core regression / JavaScript syntax (pull_request) Successful in 3s
This commit is contained in:
1 parent
960c66b196
commit
e78cdd3c97
4 files changed
+59
-3
No files matched your search
@@ -4,6 +4,9 @@ from pathlib import Path
|
||||
import subprocess
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
from threading import Event
|
||||
|
||||
from test_nonblocking_items import component_case
|
||||
|
||||
|
||||
def test_windows_project_keys_remain_case_insensitive_on_portable_host(tmp_path, monkeypatch):
|
||||
@@ -32,3 +35,47 @@ assert not any(name.startswith(('PySide6', 'shiboken6')) for name in sys.modules
|
||||
result = subprocess.run([sys.executable, '-c', script], capture_output=True, text=True,
|
||||
env=os.environ | {'PYTHONPATH': str(source)}, timeout=15)
|
||||
assert result.returncode == 0, result.stderr
|
||||
|
||||
|
||||
def test_progress_uses_same_project_keys_as_the_execution_queue(component_case, monkeypatch):
|
||||
from dx_productivity.trial_task_center import quick_run
|
||||
from dx_productivity.trial_task_center.task_queue import execute_task_queue
|
||||
monkeypatch.setattr(quick_run.os.path, 'normcase', lambda path: path)
|
||||
service, _, tasks, _, outcomes = component_case
|
||||
task_id = tasks[0].task_id
|
||||
outcomes[(task_id, ('R1',))] = 'batch_failed'
|
||||
result = execute_task_queue(service, (task_id,), stop_event=Event())
|
||||
assert not result.paused
|
||||
progress = service.quick_run_progress(task_id)
|
||||
assert progress.queue_complete and progress.failed_items == progress.saved_items == 1
|
||||
|
||||
|
||||
def test_source_checkpoint_reads_the_original_project_spelling(component_case, monkeypatch):
|
||||
from dx_productivity.trial_task_center import project_session_health
|
||||
from dx_productivity.trial_task_center.task_queue import execute_task_queue
|
||||
service, _, tasks, _, outcomes = component_case
|
||||
task_id = tasks[0].task_id
|
||||
project = str(service.projects(task_id)[0].path)
|
||||
assert project != project.casefold()
|
||||
original = project_session_health.verified_source_checkpoint
|
||||
reads = []
|
||||
def checkpoint(data_root, row, *args, **kwargs):
|
||||
reads.append(row['project_path'])
|
||||
assert str(row['project_path']) == project
|
||||
return original(data_root, row, *args, **kwargs)
|
||||
monkeypatch.setattr(project_session_health, 'verified_source_checkpoint', checkpoint)
|
||||
outcomes[(task_id, ('R1',))] = 'batch_failed'
|
||||
def saved(count):
|
||||
if count != 2:
|
||||
return
|
||||
from dx_productivity.trial_task_center.execution_journal import read_command_rows
|
||||
from dx_productivity.trial_task_center.quick_run import _encode_vbs_field
|
||||
root = service.for_project_task(task_id)._quick_run_preparer.data_root / 'quick-run'
|
||||
row = read_command_rows(root / 'current-command.tsv')[0]
|
||||
fields = ('job_id', 'project_path', 'schematic_name', 'sheet_number', 'semantic_state')
|
||||
values = (row['job_id'], project, 'MAIN', '1', 'S\tfull_sheet_v1\r\nverified R2')
|
||||
(root / ('post-state-' + row['job_id'] + '.tsv')).write_text('\t'.join(fields) + '\n' +
|
||||
'\t'.join(_encode_vbs_field(value) for value in values) + '\n', encoding='utf-8')
|
||||
outcomes['after_call'] = saved
|
||||
result = execute_task_queue(service, (task_id,), stop_event=Event())
|
||||
assert not result.paused and reads == [project]
|
||||
Reference in new issue
Block a user