fix: keep portable execution identities and core imports consistent
Core regression / Python core and release configuration (push) Failing after 32s
Core regression / JavaScript syntax (push) Successful in 3s
Core regression / Python core and release configuration (pull_request) Failing after 32s
Core regression / JavaScript syntax (pull_request) Successful in 3s

This commit is contained in:
阿白叔 committed 2026-11-06 15:16:11 +08:00
1 parent 5d461ffc6c
commit 960c66b196
6 files changed
+59 -3

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
"""Portable core reads must not depend on a Qt installation or host casing."""
import os
from pathlib import Path
import subprocess
import sys
from types import SimpleNamespace
def test_windows_project_keys_remain_case_insensitive_on_portable_host(tmp_path, monkeypatch):
from dx_productivity.trial_task_center import quick_run
monkeypatch.setattr(quick_run.os.path, 'normcase', lambda path: path)
project = tmp_path / 'Board-A' / 'BOARD.prj'
target = SimpleNamespace(project_path=Path(str(project).casefold()), schematic_name='MAIN', sheet_number='1')
rule = SimpleNamespace(scope='targets', targets=(target,))
quick_run._validate_target_scope((SimpleNamespace(path=project),), (rule,),
{quick_run._path_key(project): (('MAIN', '1'),)})
def test_core_ui_projections_can_import_without_qt():
source = Path(__file__).resolve().parents[2] / 'src'
script = '''import importlib.abc,sys
class NoQt(importlib.abc.MetaPathFinder):
def find_spec(self, fullname, path=None, target=None):
if fullname.split('.')[0] in {'PySide6', 'shiboken6'}:
raise ImportError('Qt must not be loaded by a pure core projection')
sys.meta_path.insert(0, NoQt())
from dx_productivity.trial_task_center.ui.execution_state import execution_state
from dx_productivity.trial_task_center.ui.messages import replacement_result_rows
assert execution_state(None).editable is False
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
@@ -1,4 +1,5 @@
from dataclasses import replace
from importlib.util import find_spec
from types import SimpleNamespace
import pytest
@@ -81,6 +82,8 @@ def test_partial_selection_rejects_changed_source_and_edited_rows(batch, tmp_pat
assert all(not store.list_target_plan(task.task_id) for task in tasks)
@pytest.mark.skipif(find_spec('PySide6') is None or find_spec('pytestqt') is None,
reason='Qt dialog acceptance runs on the Windows UI host')
def test_partial_ui_stages_only_user_selected_passed_projects(batch, tmp_path, qtbot):
from dx_productivity.trial_task_center.bom_import_report import inspect_batch
from dx_productivity.trial_task_center.ui.main_window import TrialTaskCenterWindow