"""Project-wide pytest fixtures.

Tests share ``config.settings.development``, whose ``MEDIA_ROOT`` points at the
real ``uploads/`` tree. FileField writes (and SCORM extraction, which unpacks
into ``MEDIA_ROOT/scorm-extracted/<pk>``) must never touch — or read — dev
uploads: test-DB pks collide with dev pks, so a test package can "find" files a
dev import left behind (or worse, overwrite them). Point MEDIA_ROOT at a
session-scoped temp dir instead.
"""

import pytest
from django.test import override_settings


@pytest.fixture(scope="session", autouse=True)
def _isolated_media_root(tmp_path_factory):
    media_root = tmp_path_factory.mktemp("media")
    with override_settings(MEDIA_ROOT=str(media_root)):
        yield
