44from unittest .mock import patch
55
66import py .path
7-
87import pytest
98
109from mapillary_tools import api_v4 , uploader
@@ -29,7 +28,9 @@ def setup_unittest_data(tmpdir: py.path.local):
2928def test_upload_images (setup_unittest_data : py .path .local , setup_upload : py .path .local ):
3029 mly_uploader = uploader .Uploader (
3130 uploader .UploadOptions (
32- {"user_upload_token" : "YOUR_USER_ACCESS_TOKEN" }, dry_run = True
31+ {"user_upload_token" : "YOUR_USER_ACCESS_TOKEN" },
32+ dry_run = True ,
33+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
3334 )
3435 )
3536 test_exif = setup_unittest_data .join ("test_exif.jpg" )
@@ -108,6 +109,7 @@ def test_upload_images_multiple_sequences(
108109 # will call the API for real
109110 # "MAPOrganizationKey": "3011753992432185",
110111 },
112+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
111113 dry_run = True ,
112114 ),
113115 )
@@ -179,6 +181,7 @@ def test_upload_zip(
179181 # will call the API for real
180182 # "MAPOrganizationKey": 3011753992432185,
181183 },
184+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
182185 dry_run = True ,
183186 ),
184187 emitter = emitter ,
@@ -263,6 +266,7 @@ def test_image_sequence_uploader_basic(self, setup_unittest_data: py.path.local)
263266 """Test basic functionality of ImageSequenceUploader."""
264267 upload_options = uploader .UploadOptions (
265268 {"user_upload_token" : "YOUR_USER_ACCESS_TOKEN" },
269+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
266270 dry_run = True ,
267271 )
268272 emitter = uploader .EventEmitter ()
@@ -309,6 +313,7 @@ def test_image_sequence_uploader_multithreading_with_cache_enabled(
309313 # Create upload options that enable cache
310314 upload_options_with_cache = uploader .UploadOptions (
311315 {"user_upload_token" : "YOUR_USER_ACCESS_TOKEN" },
316+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
312317 num_upload_workers = 4 , # This will be used internally for parallel image uploads
313318 dry_run = False , # Cache requires dry_run=False initially
314319 )
@@ -601,6 +606,7 @@ def test_image_sequence_uploader_multiple_sequences(
601606 """Test ImageSequenceUploader with multiple sequences."""
602607 upload_options = uploader .UploadOptions (
603608 {"user_upload_token" : "YOUR_USER_ACCESS_TOKEN" },
609+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
604610 dry_run = True ,
605611 )
606612 emitter = uploader .EventEmitter ()
@@ -681,6 +687,7 @@ def test_image_sequence_uploader_event_emission(
681687 """Test that ImageSequenceUploader properly emits events during upload."""
682688 upload_options = uploader .UploadOptions (
683689 {"user_upload_token" : "YOUR_USER_ACCESS_TOKEN" },
690+ upload_cache_path = Path (setup_unittest_data .join ("upload_cache" )),
684691 dry_run = True ,
685692 )
686693 emitter = uploader .EventEmitter ()
0 commit comments