fix(packaging): include pywin32 timezone and verify frozen batch supervisor
This commit is contained in:
1 parent
46bcafd7a3
commit
9c4ccc5bf5
10 files changed
+141
-9
No files matched your search
@@ -4,6 +4,8 @@ from pathlib import Path
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
import pytest
|
||||
|
||||
|
||||
def test_default_data_root_uses_windows_known_folder_without_environment(tmp_path: Path, monkeypatch) -> None:
|
||||
@@ -189,3 +191,26 @@ def test_icon_uses_package_location_for_frozen_script_entrypoint(tmp_path, monke
|
||||
assert not qapp.windowIcon().isNull()
|
||||
assert not qapp.windowIcon().pixmap(32, 32).isNull()
|
||||
assert qapp.applicationVersion() == application.VERSION
|
||||
|
||||
|
||||
@pytest.mark.parametrize('missing_dependency', [False, True])
|
||||
def test_runtime_smoke_tracks_real_process_and_releases_on_failure(tmp_path, monkeypatch, missing_dependency):
|
||||
from dx_productivity.trial_task_center.application import _smoke_batch_runtime
|
||||
from dx_productivity.trial_task_center.logging_setup import configure_logging
|
||||
import win32process
|
||||
|
||||
if missing_dependency:
|
||||
def fail(_handle):
|
||||
raise ModuleNotFoundError("No module named 'win32timezone'")
|
||||
monkeypatch.setattr(win32process, 'GetProcessTimes', fail)
|
||||
with pytest.raises(ModuleNotFoundError, match='win32timezone'):
|
||||
_smoke_batch_runtime(tmp_path, configure_logging(tmp_path))
|
||||
else:
|
||||
_smoke_batch_runtime(tmp_path, configure_logging(tmp_path))
|
||||
paths = list((tmp_path / 'batch-resources').glob('*/session.json'))
|
||||
assert len(paths) == 1
|
||||
record = json.loads(paths[0].read_text(encoding='utf-8'))
|
||||
assert record['state'] == 'released' and record['cad_pid'] is None
|
||||
assert record['cleanup']['desktop_handle_closed']
|
||||
assert record['cleanup']['desktop_confirmation']['released']
|
||||
assert not record['cleanup']['errors']
|
||||
Reference in new issue
Block a user