Prevented some tests from writing in the CWD.

This commit is contained in:
Aymeric Augustin 2015-02-21 21:09:30 +01:00
parent 9eab328444
commit 90b069c33f
1 changed files with 3 additions and 0 deletions

View File

@ -1,6 +1,7 @@
from __future__ import unicode_literals
import os
import tempfile
import warnings
from django.apps import apps
@ -46,6 +47,8 @@ class DumpDataAssertMixin(object):
natural_foreign_keys=False, natural_primary_keys=False,
use_base_manager=False, exclude_list=[], primary_keys=''):
new_io = six.StringIO()
if filename:
filename = os.path.join(tempfile.gettempdir(), filename)
management.call_command('dumpdata', *args, **{'format': format,
'stdout': new_io,
'stderr': new_io,