diff --git a/apps/afisha/tests/conftest.py b/apps/afisha/tests/conftest.py index 9e19ec7f9..0480bffc2 100644 --- a/apps/afisha/tests/conftest.py +++ b/apps/afisha/tests/conftest.py @@ -2,7 +2,8 @@ from zoneinfo import ZoneInfo import pytest -from django.conf import settings + +# from django.conf import settings from rest_framework.test import APIClient from apps.afisha.factories import EventFactory, PerformanceFactory, ReadingFactory @@ -21,8 +22,10 @@ def client(): @pytest.fixture(autouse=True) -def set_media_temp_folder(tmpdir): - settings.MEDIA_ROOT = tmpdir.mkdir("media") +def set_media_temp_folder(settings, tmp_path_factory): + settings.MEDIA_ROOT = tmp_path_factory.mktemp("media") + settings.HIDDEN_MEDIA_ROOT = tmp_path_factory.mktemp("hidden") + (settings.HIDDEN_MEDIA_ROOT / "plays").mkdir() @pytest.fixture diff --git a/apps/articles/tests/conftest.py b/apps/articles/tests/conftest.py index a9ea8392e..5dc2fe373 100644 --- a/apps/articles/tests/conftest.py +++ b/apps/articles/tests/conftest.py @@ -1,5 +1,4 @@ import pytest -from django.conf import settings from rest_framework.test import APIClient from apps.afisha.factories import EventFactory, PerformanceFactory @@ -16,8 +15,10 @@ def client(): @pytest.fixture(autouse=True) -def set_media_temp_folder(tmpdir): - settings.MEDIA_ROOT = tmpdir.mkdir("media") +def set_media_temp_folder(settings, tmp_path_factory): + settings.MEDIA_ROOT = tmp_path_factory.mktemp("media") + settings.HIDDEN_MEDIA_ROOT = tmp_path_factory.mktemp("hidden") + (settings.HIDDEN_MEDIA_ROOT / "plays").mkdir() @pytest.fixture diff --git a/apps/info/tests/conftest.py b/apps/info/tests/conftest.py index 1cebf2705..71b148778 100644 --- a/apps/info/tests/conftest.py +++ b/apps/info/tests/conftest.py @@ -1,5 +1,4 @@ import pytest -from django.conf import settings from rest_framework.test import APIClient from apps.core.factories import PersonFactory @@ -21,8 +20,10 @@ def set_show_settings(): @pytest.fixture(autouse=True) -def set_media_temp_folder(tmpdir): - settings.MEDIA_ROOT = tmpdir.mkdir("media") +def set_media_temp_folder(settings, tmp_path_factory): + settings.MEDIA_ROOT = tmp_path_factory.mktemp("media") + settings.HIDDEN_MEDIA_ROOT = tmp_path_factory.mktemp("hidden") + (settings.HIDDEN_MEDIA_ROOT / "plays").mkdir() @pytest.fixture(autouse=True) diff --git a/apps/library/tests/conftest.py b/apps/library/tests/conftest.py index 7b2fc57fb..0f3bf0ad2 100644 --- a/apps/library/tests/conftest.py +++ b/apps/library/tests/conftest.py @@ -7,6 +7,13 @@ pytestmark = [pytest.mark.django_db] +@pytest.fixture(autouse=True) +def set_media_temp_folder(settings, tmp_path_factory): + settings.MEDIA_ROOT = tmp_path_factory.mktemp("media") + settings.HIDDEN_MEDIA_ROOT = tmp_path_factory.mktemp("hidden") + (settings.HIDDEN_MEDIA_ROOT / "plays").mkdir() + + @pytest.fixture def program_types(): return ProgramTypeFactory.create_batch(5) diff --git a/apps/main/tests/conftest.py b/apps/main/tests/conftest.py index a7006aae2..542d6aeeb 100644 --- a/apps/main/tests/conftest.py +++ b/apps/main/tests/conftest.py @@ -1,7 +1,6 @@ from datetime import datetime import pytest -from django.conf import settings from django.urls import reverse from apps.afisha.factories import EventFactory, PerformanceFactory, ReadingFactory @@ -18,8 +17,10 @@ @pytest.fixture(autouse=True) -def set_media_temp_folder(tmpdir): - settings.MEDIA_ROOT = tmpdir.mkdir("media") +def set_media_temp_folder(settings, tmp_path_factory): + settings.MEDIA_ROOT = tmp_path_factory.mktemp("media") + settings.HIDDEN_MEDIA_ROOT = tmp_path_factory.mktemp("hidden") + (settings.HIDDEN_MEDIA_ROOT / "plays").mkdir() @pytest.fixture