-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: unit tests for KIX and remove regional calls to boto #2640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
import pytest | ||
|
||
from sagemaker import image_uris | ||
from tests.unit.sagemaker.image_uris import expected_uris, regions | ||
from tests.unit.sagemaker.image_uris import expected_uris | ||
|
||
ALGO_NAMES = ( | ||
"blazingtext", | ||
|
@@ -33,6 +33,7 @@ | |
"randomcutforest", | ||
"semantic-segmentation", | ||
"seq2seq", | ||
"lda", | ||
) | ||
ALGO_REGIONS_AND_ACCOUNTS = ( | ||
{ | ||
|
@@ -176,21 +177,6 @@ def _accounts_for_algo(algo): | |
@pytest.mark.parametrize("algo", ALGO_NAMES) | ||
def test_algo_uris(algo): | ||
accounts = _accounts_for_algo(algo) | ||
|
||
for region in regions.regions(): | ||
for region in accounts: | ||
uri = image_uris.retrieve(algo, region) | ||
assert expected_uris.algo_uri(algo, accounts[region], region) == uri | ||
|
||
|
||
def test_lda(): | ||
algo = "lda" | ||
accounts = _accounts_for_algo(algo) | ||
|
||
for region in regions.regions(): | ||
if region in accounts: | ||
uri = image_uris.retrieve(algo, region) | ||
assert expected_uris.algo_uri(algo, accounts[region], region) == uri | ||
else: | ||
with pytest.raises(ValueError) as e: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing these if/else blocks because 1. The if is really filtering the regions and can be combined with the loop above, and since we are removing use of boto regions anyways this makes no sense. The ValueError raised in else is not something that should be done in a test, especially if we are checking only supported regions, and seems redundant. |
||
image_uris.retrieve(algo, region) | ||
assert "Unsupported region: {}.".format(region) in str(e.value) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,9 @@ | |
# ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
from __future__ import absolute_import | ||
|
||
import pytest | ||
|
||
from sagemaker import image_uris | ||
from tests.unit.sagemaker.image_uris import expected_uris, regions | ||
from tests.unit.sagemaker.image_uris import expected_uris | ||
|
||
ALGO_REGISTRIES = { | ||
"af-south-1": "455444449433", | ||
|
@@ -53,6 +51,7 @@ | |
"ap-east-1": "651117190479", | ||
"ap-northeast-1": "354813040037", | ||
"ap-northeast-2": "366743142698", | ||
"ap-northeast-3": "867004704886", | ||
"ap-south-1": "720646828776", | ||
"ap-southeast-1": "121021644041", | ||
"ap-southeast-2": "783357654285", | ||
|
@@ -78,7 +77,7 @@ | |
|
||
@pytest.mark.parametrize("xgboost_framework_version", XGBOOST_FRAMEWORK_CPU_GPU_VERSIONS) | ||
def test_xgboost_framework(xgboost_framework_version): | ||
for region in regions.regions(): | ||
for region in FRAMEWORK_REGISTRIES.keys(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are removing |
||
uri = image_uris.retrieve( | ||
framework="xgboost", | ||
region=region, | ||
|
@@ -98,7 +97,7 @@ def test_xgboost_framework(xgboost_framework_version): | |
|
||
@pytest.mark.parametrize("xgboost_framework_version", XGBOOST_FRAMEWORK_CPU_ONLY_VERSIONS) | ||
def test_xgboost_framework_cpu_only(xgboost_framework_version): | ||
for region in regions.regions(): | ||
for region in FRAMEWORK_REGISTRIES.keys(): | ||
uri = image_uris.retrieve( | ||
framework="xgboost", | ||
region=region, | ||
|
@@ -118,7 +117,7 @@ def test_xgboost_framework_cpu_only(xgboost_framework_version): | |
|
||
@pytest.mark.parametrize("xgboost_algo_version", ALGO_VERSIONS) | ||
def test_xgboost_algo(xgboost_algo_version): | ||
for region in regions.regions(): | ||
for region in ALGO_REGISTRIES.keys(): | ||
uri = image_uris.retrieve(framework="xgboost", region=region, version=xgboost_algo_version) | ||
|
||
expected = expected_uris.algo_uri( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactoring this test since it is a duplicacy and the LDA param can be instead pulled into the config and tested from above