|
19 | 19 | import pytest
|
20 | 20 | import docker
|
21 | 21 | import re
|
| 22 | +import sys |
22 | 23 |
|
23 | 24 | from sagemaker.utils import sagemaker_timestamp, _tmpdir, sts_regional_endpoint
|
24 | 25 |
|
|
87 | 88 |
|
88 | 89 |
|
89 | 90 | @pytest.fixture(scope="package")
|
90 |
| -def dummy_container_without_error(sagemaker_session): |
91 |
| - # TODO: the python version should be dynamically specified instead of hardcoding |
92 |
| - ecr_uri = _build_container(sagemaker_session, "3.7", DOCKERFILE_TEMPLATE) |
| 91 | +def compatible_python_version(): |
| 92 | + return "{}.{}".format(sys.version_info.major, sys.version_info.minor) |
| 93 | + |
| 94 | + |
| 95 | +@pytest.fixture(scope="package") |
| 96 | +def incompatible_python_version(): |
| 97 | + return "{}.{}".format(sys.version_info.major, sys.version_info.minor + 1) |
| 98 | + |
| 99 | + |
| 100 | +@pytest.fixture(scope="package") |
| 101 | +def dummy_container_without_error(sagemaker_session, compatible_python_version): |
| 102 | + ecr_uri = _build_container(sagemaker_session, compatible_python_version, DOCKERFILE_TEMPLATE) |
93 | 103 | return ecr_uri
|
94 | 104 |
|
95 | 105 |
|
96 | 106 | @pytest.fixture(scope="package")
|
97 |
| -def dummy_container_incompatible_python_runtime(sagemaker_session): |
98 |
| - ecr_uri = _build_container(sagemaker_session, "3.10", DOCKERFILE_TEMPLATE) |
| 107 | +def dummy_container_incompatible_python_runtime(sagemaker_session, incompatible_python_version): |
| 108 | + ecr_uri = _build_container(sagemaker_session, incompatible_python_version, DOCKERFILE_TEMPLATE) |
99 | 109 | return ecr_uri
|
100 | 110 |
|
101 | 111 |
|
102 | 112 | @pytest.fixture(scope="package")
|
103 |
| -def dummy_container_with_conda(sagemaker_session): |
104 |
| - ecr_uri = _build_container(sagemaker_session, "3.7", DOCKERFILE_TEMPLATE_WITH_CONDA) |
| 113 | +def dummy_container_with_conda(sagemaker_session, compatible_python_version): |
| 114 | + ecr_uri = _build_container( |
| 115 | + sagemaker_session, compatible_python_version, DOCKERFILE_TEMPLATE_WITH_CONDA |
| 116 | + ) |
105 | 117 | return ecr_uri
|
106 | 118 |
|
107 | 119 |
|
|
0 commit comments