Already tried with:
Il giorno giovedì 20 settembre 2018 15:25:23 UTC+2, sandro dentella ha scritto:
--
class GeneraliDiscoverRunner(DiscoverRunner ):
def setup_test_environment(self, **kwargs):
settings.DEFAULT_FILE_STORAGE = 'web.storage.TestStorage'
super().setup_test_environment(**kwargs)?
otherwise, I'd say to run the test with a custom settings module like
./manage.py test --settings=test_settings
or
try to override that value in the setUp method of your TestCase class.
L
Hi,I have a storage that create some thumbnail and is declared in some models' fields. It's created inheriting from DEFAULT_FILE_STORAGE and it just works fine both in FileSystemStorage and in Aws.For this project need the aws Storage (from Django_storages) but when testing I prefer the local FileSystemStorage, so my TEST_RUNNER sets the desired one as follows:
from django.conf import settings
from django.test.runner import DiscoverRunner
class GeneraliDiscoverRunner(DiscoverRunner ):
def __init__(self, *args, **kwargs):
settings.DEFAULT_FILE_STORAGE = 'web.storage.TestStorage'
super().__init__(*args, **kwargs)It seems that this changes the Storage in all situations apart from the fields declared in the models via the storage=ThumbnailStorage. I guess when model are read the settings from the runner has not yet been set. Is there a way to set the Storage in due time?Thanks in advancesandro*:-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2245d393-9cd8-444e-8ddb-3dde294f008a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment