Skip to content
Snippets Groups Projects
Verified Commit d7adaf39 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Can now use nodb_factory fixtue in tests for faster tests

parent 367014f7
No related branches found
No related tags found
No related merge requests found
import factory
import tempfile import tempfile
import shutil import shutil
import pytest import pytest
from django.core.cache import cache as django_cache from django.core.cache import cache as django_cache
from dynamic_preferences.registries import global_preferences_registry from dynamic_preferences.registries import global_preferences_registry
from rest_framework.test import APIClient from rest_framework.test import APIClient
from rest_framework.test import APIRequestFactory from rest_framework.test import APIRequestFactory
...@@ -27,6 +30,16 @@ def cache(): ...@@ -27,6 +30,16 @@ def cache():
@pytest.fixture @pytest.fixture
def factories(db): def factories(db):
from funkwhale_api import factories from funkwhale_api import factories
for v in factories.registry.values():
v._meta.strategy = factory.CREATE_STRATEGY
yield factories.registry
@pytest.fixture
def nodb_factories():
from funkwhale_api import factories
for v in factories.registry.values():
v._meta.strategy = factory.BUILD_STRATEGY
yield factories.registry yield factories.registry
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment