mirror of
https://github.com/NCBM/plyngent.git
synced 2026-07-25 08:04:57 +08:00
core/tools: drop process workspace/todo globals; require bound state
This commit is contained in:
@@ -4,6 +4,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
|
||||
from plyngent.tools.context import InstanceState, bind_instance
|
||||
from plyngent.tools.workspace import (
|
||||
clear_workspace_allowlist,
|
||||
clear_workspace_root,
|
||||
@@ -17,9 +18,11 @@ if TYPE_CHECKING:
|
||||
|
||||
@pytest.fixture
|
||||
def workspace(tmp_path: Path) -> Iterator[Path]:
|
||||
clear_workspace_root()
|
||||
clear_workspace_allowlist()
|
||||
root = set_workspace_root(tmp_path)
|
||||
yield root
|
||||
clear_workspace_allowlist()
|
||||
clear_workspace_root()
|
||||
"""Bind an InstanceState workspace for tool tests (no process globals)."""
|
||||
instance = InstanceState(workspace_root=tmp_path.resolve())
|
||||
with bind_instance(instance):
|
||||
clear_workspace_allowlist()
|
||||
root = set_workspace_root(tmp_path)
|
||||
yield root
|
||||
clear_workspace_allowlist()
|
||||
clear_workspace_root()
|
||||
|
||||
Reference in New Issue
Block a user