mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Cleaned up temporary test directories in tests.
This commit is contained in:
		
				
					committed by
					
						 Sarah Boyce
						Sarah Boyce
					
				
			
			
				
	
			
			
			
						parent
						
							2ff917fd06
						
					
				
				
					commit
					b06cf62c88
				
			| @@ -259,6 +259,7 @@ class FormsModelTestCase(TestCase): | |||||||
|             m.file.name, |             m.file.name, | ||||||
|             "tests/\u6211\u96bb\u6c23\u588a\u8239\u88dd\u6eff\u6652\u9c54.txt", |             "tests/\u6211\u96bb\u6c23\u588a\u8239\u88dd\u6eff\u6652\u9c54.txt", | ||||||
|         ) |         ) | ||||||
|  |         m.file.delete() | ||||||
|         m.delete() |         m.delete() | ||||||
|  |  | ||||||
|     def test_boundary_conditions(self): |     def test_boundary_conditions(self): | ||||||
|   | |||||||
| @@ -135,7 +135,7 @@ class WriterProfile(models.Model): | |||||||
|  |  | ||||||
|  |  | ||||||
| class Document(models.Model): | class Document(models.Model): | ||||||
|     myfile = models.FileField(upload_to="unused", blank=True) |     myfile = models.FileField(storage=temp_storage, upload_to="unused", blank=True) | ||||||
|  |  | ||||||
|  |  | ||||||
| class TextFile(models.Model): | class TextFile(models.Model): | ||||||
|   | |||||||
| @@ -1,5 +1,6 @@ | |||||||
| import datetime | import datetime | ||||||
| import os | import os | ||||||
|  | import shutil | ||||||
| from decimal import Decimal | from decimal import Decimal | ||||||
| from unittest import mock, skipUnless | from unittest import mock, skipUnless | ||||||
|  |  | ||||||
| @@ -72,6 +73,7 @@ from .models import ( | |||||||
|     Triple, |     Triple, | ||||||
|     Writer, |     Writer, | ||||||
|     WriterProfile, |     WriterProfile, | ||||||
|  |     temp_storage_dir, | ||||||
|     test_images, |     test_images, | ||||||
| ) | ) | ||||||
|  |  | ||||||
| @@ -2482,6 +2484,12 @@ class ModelOneToOneFieldTests(TestCase): | |||||||
|  |  | ||||||
|  |  | ||||||
| class FileAndImageFieldTests(TestCase): | class FileAndImageFieldTests(TestCase): | ||||||
|  |     def setUp(self): | ||||||
|  |         if os.path.exists(temp_storage_dir): | ||||||
|  |             shutil.rmtree(temp_storage_dir) | ||||||
|  |         os.mkdir(temp_storage_dir) | ||||||
|  |         self.addCleanup(shutil.rmtree, temp_storage_dir) | ||||||
|  |  | ||||||
|     def test_clean_false(self): |     def test_clean_false(self): | ||||||
|         """ |         """ | ||||||
|         If the ``clean`` method on a non-required FileField receives False as |         If the ``clean`` method on a non-required FileField receives False as | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user