From 807aa26bafdcc04090e97450cb4cc7408b3730d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=99=BD=E5=8F=94?= <11794527+absfan@user.noreply.gitee.com> Date: Fri, 6 Nov 2026 11:41:00 +0800 Subject: [PATCH] test: guard actual reads of unrelated CBB content --- tests/test_review_backend_followup.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_review_backend_followup.py b/tests/test_review_backend_followup.py index c270507..fdfd2fe 100644 --- a/tests/test_review_backend_followup.py +++ b/tests/test_review_backend_followup.py @@ -1,5 +1,6 @@ import json from dataclasses import replace +from pathlib import Path import pytest @@ -60,18 +61,17 @@ def test_management_preserves_release_context_before_first_native_call(setup, mo def test_management_records_scoped_changes_without_hashing_unrelated_cbb(setup, monkeypatch): - from cbb_refresh_verify import scoped_manifest request, adapter, _ = setup root = request.library.parent target = root/'ReusableBlocksLP/Block/Work/Block.prj' deleted = root/'ReusableBlocksLP/Block/Work/obsolete.dat'; deleted.write_bytes(b'old') shared = root/'SymbolLibs/shared/icdb.dat'; shared.parent.mkdir(parents=True); shared.write_bytes(b'old') foreign = root/'ReusableBlocksLP/Other/Work/private.dat'; foreign.parent.mkdir(parents=True); foreign.write_bytes(b'other') - original_hash = scoped_manifest.hash_file - def hashed(path): + original_open = Path.open + def opened(path, *args, **kwargs): assert path != foreign, 'Post-write report must not add whole-library hashing' - return original_hash(path) - monkeypatch.setattr(scoped_manifest, 'hash_file', hashed) + return original_open(path, *args, **kwargs) + monkeypatch.setattr(Path, 'open', opened) remove = adapter.remove def mutate(req, evidence): target.write_bytes(target.read_bytes()+b'# updated\n')