2026-07-14 18:20:32 +08:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
2026-07-18 18:16:06 +08:00
|
|
|
from plyngent.tools.workspace import (
|
|
|
|
|
clear_workspace_allowlist,
|
|
|
|
|
clear_workspace_root,
|
|
|
|
|
set_workspace_root,
|
|
|
|
|
)
|
2026-07-14 18:20:32 +08:00
|
|
|
|
|
|
|
|
if TYPE_CHECKING:
|
|
|
|
|
from collections.abc import Iterator
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
|
def workspace(tmp_path: Path) -> Iterator[Path]:
|
|
|
|
|
clear_workspace_root()
|
2026-07-18 18:16:06 +08:00
|
|
|
clear_workspace_allowlist()
|
2026-07-14 18:20:32 +08:00
|
|
|
root = set_workspace_root(tmp_path)
|
|
|
|
|
yield root
|
2026-07-18 18:16:06 +08:00
|
|
|
clear_workspace_allowlist()
|
2026-07-14 18:20:32 +08:00
|
|
|
clear_workspace_root()
|