test: keep release preview assertions scoped to the fixture
This commit is contained in:
1 parent
7d9a107921
commit
81a5d1ae4b
1 file changed
+7
-4
@@ -157,13 +157,16 @@ def test_residual_dialog_refresh_shows_runtime_blocker_without_releasing(qtbot,
|
||||
library = tmp_path/'library/lib.lmc'
|
||||
library.parent.mkdir(); library.touch()
|
||||
monkeypatch.setattr(locks, 'inspect_residual_sessions', lambda *_: {'library': str(library), 'sessions': []})
|
||||
release = locks.release_retained_library
|
||||
releases = []
|
||||
|
||||
def unexpected_release(*args, **kwargs):
|
||||
releases.append((args, kwargs))
|
||||
raise OSError('Preview started a release')
|
||||
def check_release(target, *args, **kwargs):
|
||||
if Path(target) == library:
|
||||
releases.append(target)
|
||||
raise OSError('Preview started a release')
|
||||
return release(target, *args, **kwargs)
|
||||
|
||||
monkeypatch.setattr(locks, 'release_retained_library', unexpected_release)
|
||||
monkeypatch.setattr(locks, 'release_retained_library', check_release)
|
||||
dialog = ResidualReleaseDialog(library, tmp_path/'release-checks')
|
||||
qtbot.addWidget(dialog)
|
||||
qtbot.waitUntil(lambda: not dialog.busy)
|
||||
|
||||
Reference in new issue
Block a user