fix: isolate ICDB checks and recover scoped native sessions
This commit is contained in:
1 parent
1acfbd6374
commit
1bd7589fef
82 files changed
+7770
-1583
No files matched your search
@@ -134,6 +134,24 @@ def test_release_proof_checks_addresses_and_exclusive_databases(tmp_path, monkey
|
||||
assert proof['exclusive_files'] == [str(library)]
|
||||
|
||||
|
||||
def test_release_does_not_resolve_every_unrelated_generated_file(tmp_path, monkeypatch):
|
||||
from pathlib import Path
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
import cbb_refresh_verify.owner_probe as probe
|
||||
monkeypatch.setattr(probe, 'query_owners', lambda *_: [])
|
||||
library = tmp_path/'lib.lmc'; library.touch()
|
||||
outputs = tmp_path/'generated'; outputs.mkdir()
|
||||
for index in range(100): (outputs/f'{index}.log').touch()
|
||||
database = tmp_path/'database/icdb.dat'; database.parent.mkdir(); database.touch()
|
||||
resolve = Path.resolve
|
||||
def guarded(path, *a, **kw):
|
||||
assert path.parent != outputs, 'Release resolved unrelated generated content'
|
||||
return resolve(path, *a, **kw)
|
||||
monkeypatch.setattr(Path, 'resolve', guarded)
|
||||
with locks._prove_library_released(library) as proof:
|
||||
assert set(proof['exclusive_files']) == {str(library), str(database)}
|
||||
|
||||
|
||||
def test_scoped_release_ignores_another_cbb_address(tmp_path, monkeypatch):
|
||||
import cbb_refresh_verify.library_lock as locks
|
||||
import cbb_refresh_verify.owner_probe as probe
|
||||
@@ -261,7 +279,7 @@ def test_arbitrary_guard_filename_is_preserved_and_primary(tmp_path, monkeypatch
|
||||
assert marker.name in manifest['files']
|
||||
from contextlib import contextmanager
|
||||
@contextmanager
|
||||
def proof(*a): yield {'native_owners': [], 'addresses': [], 'exclusive_files': [str(library)]}
|
||||
def proof(*a, **kw): yield {'native_owners': [], 'addresses': [], 'exclusive_files': [str(library)]}
|
||||
monkeypatch.setattr(locks, '_prove_library_released', proof)
|
||||
with pytest.raises(locks.LibraryBusy):
|
||||
locks.release_retained_library(library, tmp_path/'release')
|
||||
|
||||
Reference in new issue
Block a user