mirror of
https://github.com/django/django.git
synced 2024-12-26 11:06:07 +00:00
[1.8.x] Prevented some tests from writing in the CWD.
Backport of 90b069c33f
from master
This commit is contained in:
parent
1ae2df6bfc
commit
311b880fa9
3
tests/fixtures/tests.py
vendored
3
tests/fixtures/tests.py
vendored
@ -1,6 +1,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import tempfile
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
@ -46,6 +47,8 @@ class DumpDataAssertMixin(object):
|
|||||||
natural_foreign_keys=False, natural_primary_keys=False,
|
natural_foreign_keys=False, natural_primary_keys=False,
|
||||||
use_base_manager=False, exclude_list=[], primary_keys=''):
|
use_base_manager=False, exclude_list=[], primary_keys=''):
|
||||||
new_io = six.StringIO()
|
new_io = six.StringIO()
|
||||||
|
if filename:
|
||||||
|
filename = os.path.join(tempfile.gettempdir(), filename)
|
||||||
management.call_command('dumpdata', *args, **{'format': format,
|
management.call_command('dumpdata', *args, **{'format': format,
|
||||||
'stdout': new_io,
|
'stdout': new_io,
|
||||||
'stderr': new_io,
|
'stderr': new_io,
|
||||||
|
Loading…
Reference in New Issue
Block a user