fix: validate library and data paths at the application boundary
This commit is contained in:
1 parent
47c2cfecc6
commit
6d2b6de027
10 files changed
+336
-36
No files matched your search
+16
-3
@@ -14,7 +14,20 @@ def test_spec_packages_adaptive_dialog_rules_and_uia_modules():
|
||||
assert 'pywinauto' in text
|
||||
|
||||
|
||||
def test_spec_analysis_includes_pywin32_timezone_dynamic_import():
|
||||
def test_spec_analysis_includes_pywin32_timezone_dynamic_import(tmp_path):
|
||||
captured = _capture_spec_analysis(tmp_path)
|
||||
assert 'win32timezone' in captured['hiddenimports']
|
||||
|
||||
|
||||
def test_spec_copies_quick_start_next_to_executable(tmp_path):
|
||||
target = tmp_path / 'CbbRefreshVerify-Background'
|
||||
target.mkdir()
|
||||
_capture_spec_analysis(target)
|
||||
guide = (target / '使用说明.txt').read_text(encoding='utf-8')
|
||||
assert 'CbbRefreshVerify.exe' in guide and '--data-root' in guide
|
||||
|
||||
|
||||
def _capture_spec_analysis(target):
|
||||
from types import SimpleNamespace
|
||||
captured = {}
|
||||
def analysis(*args, **kwargs):
|
||||
@@ -23,6 +36,6 @@ def test_spec_analysis_includes_pywin32_timezone_dynamic_import():
|
||||
path = Path('packaging/CbbRefreshVerify.spec')
|
||||
namespace = {'SPECPATH': str(path.parent.resolve()), 'Analysis': analysis,
|
||||
'PYZ': lambda *a, **k: None, 'EXE': lambda *a, **k: None,
|
||||
'COLLECT': lambda *a, **k: None}
|
||||
'COLLECT': lambda *a, **k: SimpleNamespace(name=str(target))}
|
||||
exec(compile(path.read_text(encoding='utf-8'), str(path), 'exec'), namespace)
|
||||
assert 'win32timezone' in captured['hiddenimports']
|
||||
return captured
|
||||
Reference in new issue
Block a user