File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 55
66import mock
77
8- import test_util
9-
10- os .environ ["SAGEMAKER_BASE_DIR" ] = os .path .join (os .path .dirname (__file__ ), "opt_ml" )
11- from sagemaker_training import environment as training_environment , params as training_parameters
8+ from sagemaker_training import params as training_parameters
129
13- from sagemaker_training . cli . train import main as train_main
10+ import test_util
1411
1512
13+ @mock .patch .dict (
14+ os .environ , {
15+ "SAGEMAKER_BASE_DIR" : os .path .join (os .path .dirname (__file__ ), "opt_ml" ),
16+ training_parameters .USER_PROGRAM_ENV : Path ('source_dir/training_clean/train_clean.py' ).name
17+ }
18+ )
1619def test_local_training ():
20+ from sagemaker_training import environment as training_environment
21+ from sagemaker_training .cli .train import main as train_main
22+
1723 logging .info ("Starting training" )
1824
1925 f"""
@@ -25,10 +31,6 @@ def test_local_training():
2531 test_util ._clean_training_opt_ml_dir ()
2632 distutils .dir_util .copy_tree ("./source_dir/training_clean/" , "./opt_ml/code/" )
2733
28- os .environ = {
29- training_parameters .USER_PROGRAM_ENV : Path ('source_dir/training_clean/train_clean.py' ).name ,
30- }
31-
3234 try :
3335 # Note: it will start the subprocess, so we don't have the code coverage
3436 # TODO: https://coverage.readthedocs.io/en/latest/subprocess.html
You can’t perform that action at this time.
0 commit comments