Skip to content

Commit

Permalink
[unit tests] Remove sleep usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 committed Jan 3, 2025
1 parent a82db50 commit ea45933
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions cvat/apps/engine/tests/test_rest_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3096,7 +3096,7 @@ def test_can_remove_export_cache_automatically_after_successful_export(self):
task_id = self.tasks[0]["id"]
user = self.admin

TASK_CACHE_TTL = timedelta(seconds=5)
TASK_CACHE_TTL = timedelta(seconds=20)
with (
mock.patch('cvat.apps.dataset_manager.views.TASK_CACHE_TTL', new=TASK_CACHE_TTL),
mock.patch('cvat.apps.dataset_manager.views.TTL_CONSTS', new={'task': TASK_CACHE_TTL}),
Expand Down Expand Up @@ -3127,10 +3127,12 @@ def test_can_remove_export_cache_automatically_after_successful_export(self):
file_path = job.return_value()
self.assertTrue(os.path.isfile(file_path))

sleep(TASK_CACHE_TTL.total_seconds() + 1)

cron_export_cache_cleanup()
mock_clear_export_cache.assert_called_once()
with (
mock.patch('cvat.apps.dataset_manager.views.TASK_CACHE_TTL', new=timedelta(seconds=0)),
mock.patch('cvat.apps.dataset_manager.views.TTL_CONSTS', new={'task': timedelta(seconds=0)}),
):
cron_export_cache_cleanup()
mock_clear_export_cache.assert_called_once()
self.assertFalse(os.path.exists(file_path))


Expand Down

0 comments on commit ea45933

Please sign in to comment.