caneta
caneta

Reputation: 2002

Wrong default_storage during tests

I've a TransactionTest which tries to operate on a different default_storage:

Why during test phase this gives to me directory media, instead of directory test?

Thanks in advance.

Upvotes: 0

Views: 115

Answers (2)

caneta
caneta

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

Mark Lavin
Mark Lavin

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

Related Questions