Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FinemechanicPub committed Oct 10, 2024
1 parent 41f1381 commit 2100a67
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
9 changes: 6 additions & 3 deletions apps/afisha/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions apps/articles/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from django.conf import settings
from rest_framework.test import APIClient

from apps.afisha.factories import EventFactory, PerformanceFactory
Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions apps/info/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from django.conf import settings
from rest_framework.test import APIClient

from apps.core.factories import PersonFactory
Expand All @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions apps/library/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 4 additions & 3 deletions apps/main/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2100a67

Please sign in to comment.