'''
Offline replay integration fixtures.

'''
from pathlib import Path

import pytest


@pytest.fixture
def replay_scenario(
    request: pytest.FixtureRequest,
    monkeypatch: pytest.MonkeyPatch,
) -> Path:
    '''
    Select one tracked scenario for parent and child actors.

    '''
    inputs: Path = (
        Path(__file__).parents[1]
        / '_inputs'
        / 'replay'
    )
    path: Path = inputs / f'{request.param}.json'
    if not path.is_file():
        raise FileNotFoundError(path)
    monkeypatch.setenv(
        'PIKER_REPLAY_SCENARIO',
        str(path),
    )
    return path
