Skip to content

Commit

Permalink
Try to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 committed Jan 9, 2025
1 parent aab5350 commit 2c6794a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cvat/apps/dataset_manager/cron.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _cleanup(self) -> None:
# In that case an exception is expected and is handled by the cron process.
# 2. A temporary file/directory can be removed by the cron job only when it is outdated.
# 3. Each temporary file/directory has a unique name, so the race condition when one process is creating an object
# and another is removing it - impossible.
# and another is removing it - impossible.
for child in os.scandir(TmpDirManager.TMP_ROOT):
# stop clean up process correctly before rq job timeout is ended
if self._stop_event.is_set():
Expand Down
4 changes: 2 additions & 2 deletions cvat/apps/dataset_manager/tests/test_formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _test_export(check, task, format_name, **export_args):
with tempfile.TemporaryDirectory() as temp_dir:
file_path = osp.join(temp_dir, format_name)
dm.task.export_task(task["id"], file_path,
format_name, **export_args)
format_name=format_name, **export_args)

check(file_path)

Expand Down Expand Up @@ -989,7 +989,7 @@ def _test_can_import_annotations(self, task, import_format):
if import_format == "CVAT 1.1":
export_format = "CVAT for images 1.1"

dm.task.export_task(task["id"], file_path, export_format)
dm.task.export_task(task["id"], file_path, export_format=export_format)
expected_ann = TaskAnnotation(task["id"])
expected_ann.init_from_db()

Expand Down
4 changes: 3 additions & 1 deletion cvat/apps/dataset_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ def export(

with TmpDirManager.get_tmp_directory_for_export(instance_type=instance_type) as temp_dir:
temp_file = osp.join(temp_dir, 'result')
temp_subdir = osp.join(temp_dir, 'subdir')
os.makedirs(temp_subdir, exist_ok=True)
export_fn(db_instance.id, temp_file, format_name=dst_format,
server_url=server_url, save_images=save_images, temp_dir=temp_dir)
server_url=server_url, save_images=save_images, temp_dir=temp_subdir)
with get_export_cache_lock(
output_path,
ttl=EXPORT_CACHE_LOCK_TTL,
Expand Down
1 change: 0 additions & 1 deletion cvat/apps/engine/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,6 @@ def _import(importer, request, queue, rq_id, Serializer, file_field_name, locati
return Response(serializer.data, status=status.HTTP_202_ACCEPTED)

def get_backup_dirname():
# FUTURE-FIXME
return TmpDirManager.TMP_ROOT

def import_project(request, queue_name, filename=None):
Expand Down

0 comments on commit 2c6794a

Please sign in to comment.