| @@ 51-64 (lines=14) @@ | ||
| 48 | for obj in objs: |
|
| 49 | obj.image.delete_variations() |
|
| 50 | assert not any([os.path.exists(f) for f in file_names]) |
|
| 51 | call_command( |
|
| 52 | 'rendervariations', |
|
| 53 | 'tests.ThumbnailModel.image' |
|
| 54 | ) |
|
| 55 | assert any([os.path.exists(f) for f in file_names]) |
|
| 56 | ||
| 57 | def test_no_replace(self, image_upload_file): |
|
| 58 | obj = ThumbnailModel.objects.create(image=image_upload_file) |
|
| 59 | file_path = obj.image.thumbnail.path |
|
| 60 | assert os.path.exists(file_path) |
|
| 61 | before = os.path.getmtime(file_path) |
|
| 62 | time.sleep(1) |
|
| 63 | call_command( |
|
| 64 | 'rendervariations', |
|
| 65 | 'tests.ThumbnailModel.image', |
|
| 66 | ) |
|
| 67 | assert os.path.exists(file_path) |
|
| @@ 37-49 (lines=13) @@ | ||
| 34 | ) |
|
| 35 | assert os.path.exists(file_path) |
|
| 36 | ||
| 37 | def test_multiprocessing(self, image_upload_file): |
|
| 38 | objs = [ |
|
| 39 | ThumbnailModel.objects.create( |
|
| 40 | image=image_upload_file |
|
| 41 | ) |
|
| 42 | for _ in range(100) |
|
| 43 | ] |
|
| 44 | file_names = [ |
|
| 45 | obj.image.thumbnail.path |
|
| 46 | for obj in objs |
|
| 47 | ] |
|
| 48 | for obj in objs: |
|
| 49 | obj.image.delete_variations() |
|
| 50 | assert not any([os.path.exists(f) for f in file_names]) |
|
| 51 | call_command( |
|
| 52 | 'rendervariations', |
|