@@ -286,17 +286,20 @@ def test_run_tensorboard_locally_without_awscli_binary(time, strftime, popen, ca
286286 'following command: \n pip install awscli'
287287
288288
289+ @patch ('sagemaker.tensorflow.estimator.Tensorboard._sync_directories' )
289290@patch ('tempfile.mkdtemp' , return_value = '/my/temp/folder' )
291+ @patch ('shutil.rmtree' )
290292@patch ('os.access' , return_value = True )
291293@patch ('subprocess.call' )
292294@patch ('subprocess.Popen' )
293295@patch ('time.strftime' , return_value = TIMESTAMP )
294296@patch ('time.time' , return_value = TIME )
295- @pytest .mark .skip (reason = "this test fails sometimes and it needs further investigation" )
296- def test_run_tensorboard_locally (time , strftime , popen , call , access , sagemaker_session ):
297+ def test_run_tensorboard_locally (time , strftime , popen , call , access , rmtree , mkdtemp , sync , sagemaker_session ):
297298 tf = TensorFlow (entry_point = SCRIPT_PATH , role = ROLE , sagemaker_session = sagemaker_session ,
298299 train_instance_count = INSTANCE_COUNT , train_instance_type = INSTANCE_TYPE )
299300
301+ popen ().poll .return_value = None
302+
300303 tf .fit (inputs = 's3://mybucket/train' , run_tensorboard_locally = True )
301304
302305 popen .assert_called_with (['tensorboard' , '--logdir' , '/my/temp/folder' , '--host' , 'localhost' , '--port' , '6006' ],
@@ -305,19 +308,21 @@ def test_run_tensorboard_locally(time, strftime, popen, call, access, sagemaker_
305308 )
306309
307310
311+ @patch ('sagemaker.tensorflow.estimator.Tensorboard._sync_directories' )
308312@patch ('tempfile.mkdtemp' , return_value = '/my/temp/folder' )
313+ @patch ('shutil.rmtree' )
309314@patch ('socket.socket' )
310315@patch ('os.access' , return_value = True )
311316@patch ('subprocess.call' )
312317@patch ('subprocess.Popen' )
313318@patch ('time.strftime' , return_value = TIMESTAMP )
314319@patch ('time.time' , return_value = TIME )
315- @ pytest . mark . skip ( reason = "this test fails sometimes and it needs further investigation" )
316- def test_run_tensorboard_locally_port_in_use ( time , strftime , popen , call , access , socket , sagemaker_session ):
320+ def test_run_tensorboard_locally_port_in_use ( time , strftime , popen , call , access , socket , rmtree , mkdtemp , sync ,
321+ sagemaker_session ):
317322 tf = TensorFlow (entry_point = SCRIPT_PATH , role = ROLE , sagemaker_session = sagemaker_session ,
318323 train_instance_count = INSTANCE_COUNT , train_instance_type = INSTANCE_TYPE )
319324
320- popen ().poll .side_effect = [True , False ]
325+ popen ().poll .side_effect = [- 1 , None ]
321326
322327 tf .fit (inputs = 's3://mybucket/train' , run_tensorboard_locally = True )
323328
0 commit comments