1
- # Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2017-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
#
3
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
# may not use this file except in compliance with the License. A copy of
18
18
import pytest
19
19
from sagemaker .tensorflow import TensorFlow
20
20
21
- from test .integration .docker_utils import Container
22
-
23
21
RESOURCE_PATH = os .path .join (os .path .dirname (__file__ ), '..' , '..' , 'resources' )
24
22
TF_CHECKPOINT_FILES = ['graph.pbtxt' , 'model.ckpt-0.index' , 'model.ckpt-0.meta' ]
25
23
@@ -32,10 +30,23 @@ def py_full_version(py_version):
32
30
return '3.6'
33
31
34
32
35
- def test_py_versions (docker_image , processor , py_full_version ):
36
- with Container (docker_image , processor ) as c :
37
- output = c .execute_command (['python' , '--version' ])
38
- assert output .strip ().startswith ('Python {}' .format (py_full_version ))
33
+ def test_py_versions (sagemaker_local_session , docker_image , py_full_version , framework_version , tmpdir ):
34
+ output_path = 'file://{}' .format (tmpdir )
35
+ run_tf_training (script = os .path .join (RESOURCE_PATH , 'test_py_version' , 'entry.py' ),
36
+ instance_type = 'local' ,
37
+ instance_count = 1 ,
38
+ sagemaker_local_session = sagemaker_local_session ,
39
+ docker_image = docker_image ,
40
+ framework_version = framework_version ,
41
+ output_path = output_path ,
42
+ training_data_path = None )
43
+
44
+ with tarfile .open (os .path .join (str (tmpdir ), 'output.tar.gz' )) as tar :
45
+ output_file = tar .getmember ('py_version' )
46
+ tar .extractall (path = str (tmpdir ), members = [output_file ])
47
+
48
+ with open (os .path .join (str (tmpdir ), 'py_version' )) as f :
49
+ assert f .read ().strip () == py_full_version
39
50
40
51
41
52
@pytest .mark .skip_gpu
0 commit comments