Skip to content

Commit 54b6660

Browse files
authored
Fix unit test stability with testing job name generation (#248)
Since the job name generation depends on timestamps being unique, if the two names were generated quickly enough, the names could end up being the same despite the code's logic being correct. Adding a sleep statement in the test should fix this.
1 parent 91c4e20 commit 54b6660

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tests/unit/test_estimator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import logging
1616
import json
1717
import os
18+
from time import sleep
1819

1920
import pytest
2021
from mock import Mock, patch
@@ -386,6 +387,7 @@ def test_prepare_for_training_unique_job_name_generation(sagemaker_session):
386387
fw._prepare_for_training()
387388
first_job_name = fw._current_job_name
388389

390+
sleep(0.1)
389391
fw._prepare_for_training()
390392
second_job_name = fw._current_job_name
391393

0 commit comments

Comments
 (0)