# Keep imports and all ephemeral test output within the delivered workspace.
import sys
import tempfile
from pathlib import Path
import pytest

ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(ROOT))


@pytest.fixture
def artifact_dir():
    """Create and clean a scratch directory beneath test/."""
    with tempfile.TemporaryDirectory(prefix='artifacts-', dir=ROOT / 'test') as directory:
        yield Path(directory)
