Reputation: 2002
I've a TransactionTest which tries to operate on a different default_storage:
settings.py:
MEDIA_ROOT='/srv/http/my_proj/media'
tests.py:
@override_settings(MEDIA_ROOT='/srv/http/my_proj/test')
class OutputDataModule(TransactionTestCase):
def test_01(self):
myFunc()
views.py:
def myFunc():
print default_storage.path('')
Why during test phase this gives to me directory media, instead of directory test?
Thanks in advance.
Upvotes: 0
Views: 115
Reputation: 2002
I solved using:
tests.py
class OutputDataModule(TransactionTestCase):
def test_01(self):
with self.settings(MEDIA_ROOT='/srv/http/my_proj/test'):
myFunc()
Maybe it's a bug of the ovverride_settings() decorator only...
Upvotes: 0
Reputation: 25164
This was a bug in Django which appears to be fixed on the current master (1.7dev), the 1.6 pre-releases and the 1.5.X stable (1.5.4) https://code.djangoproject.com/ticket/17744
Upvotes: 1