mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
[1.8.x] Guaranteed removal of temporary files during tests.
Dropped the DJANGO_TEST_TEMP_DIR environment variable.
Before this change, proper removal depended on the developer passing
dir=os.environ['DJANGO_TEST_TMP_DIR'] to tempfile functions.
Backport of 934400759d from master
This commit is contained in:
committed by
Tim Graham
parent
a752a2c951
commit
fae31f2348
@@ -241,8 +241,8 @@ class InconsistentGetImageDimensionsBug(unittest.TestCase):
|
||||
|
||||
class FileMoveSafeTests(unittest.TestCase):
|
||||
def test_file_move_overwrite(self):
|
||||
handle_a, self.file_a = tempfile.mkstemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
|
||||
handle_b, self.file_b = tempfile.mkstemp(dir=os.environ['DJANGO_TEST_TEMP_DIR'])
|
||||
handle_a, self.file_a = tempfile.mkstemp()
|
||||
handle_b, self.file_b = tempfile.mkstemp()
|
||||
|
||||
# file_move_safe should raise an IOError exception if destination file exists and allow_overwrite is False
|
||||
self.assertRaises(IOError, lambda: file_move_safe(self.file_a, self.file_b, allow_overwrite=False))
|
||||
|
||||
Reference in New Issue
Block a user