Finish porting from nose to pytest.
This commit is contained in:
parent
77dc60ea97
commit
ea489bce6c
72 changed files with 1289 additions and 1280 deletions
|
|
@ -38,7 +38,7 @@ def test_create_endpoint_config():
|
|||
EndpointConfigName=endpoint_config_name,
|
||||
ProductionVariants=production_variants,
|
||||
)
|
||||
assert e.exception.response["Error"]["Message"].startswith("Could not find model")
|
||||
assert e.value.response["Error"]["Message"].startswith("Could not find model")
|
||||
|
||||
_create_model(sagemaker, model_name)
|
||||
resp = sagemaker.create_endpoint_config(
|
||||
|
|
@ -88,11 +88,11 @@ def test_delete_endpoint_config():
|
|||
resp = sagemaker.delete_endpoint_config(EndpointConfigName=endpoint_config_name)
|
||||
with pytest.raises(ClientError) as e:
|
||||
sagemaker.describe_endpoint_config(EndpointConfigName=endpoint_config_name)
|
||||
assert e.exception.response["Error"]["Message"].startswith("Could not find endpoint configuration")
|
||||
assert e.value.response["Error"]["Message"].startswith("Could not find endpoint configuration")
|
||||
|
||||
with pytest.raises(ClientError) as e:
|
||||
sagemaker.delete_endpoint_config(EndpointConfigName=endpoint_config_name)
|
||||
assert e.exception.response["Error"]["Message"].startswith( "Could not find endpoint configuration")
|
||||
assert e.value.response["Error"]["Message"].startswith( "Could not find endpoint configuration")
|
||||
|
||||
|
||||
@mock_sagemaker
|
||||
|
|
@ -118,11 +118,11 @@ def test_create_endpoint_invalid_instance_type():
|
|||
EndpointConfigName=endpoint_config_name,
|
||||
ProductionVariants=production_variants,
|
||||
)
|
||||
assert e.exception.response["Error"]["Code"] == "ValidationException"
|
||||
assert e.value.response["Error"]["Code"] == "ValidationException"
|
||||
expected_message = "Value '{}' at 'instanceType' failed to satisfy constraint: Member must satisfy enum value set: [".format(
|
||||
instance_type
|
||||
)
|
||||
assert expected_message in e.exception.response["Error"]["Message"]
|
||||
assert expected_message in e.value.response["Error"]["Message"]
|
||||
|
||||
|
||||
@mock_sagemaker
|
||||
|
|
@ -134,7 +134,7 @@ def test_create_endpoint():
|
|||
sagemaker.create_endpoint(
|
||||
EndpointName=endpoint_name, EndpointConfigName="NonexistentEndpointConfig"
|
||||
)
|
||||
assert e.exception.response["Error"]["Message"].startswith("Could not find endpoint configuration")
|
||||
assert e.value.response["Error"]["Message"].startswith("Could not find endpoint configuration")
|
||||
|
||||
model_name = "MyModel"
|
||||
_create_model(sagemaker, model_name)
|
||||
|
|
@ -182,11 +182,11 @@ def test_delete_endpoint():
|
|||
sagemaker.delete_endpoint(EndpointName=endpoint_name)
|
||||
with pytest.raises(ClientError) as e:
|
||||
sagemaker.describe_endpoint(EndpointName=endpoint_name)
|
||||
assert e.exception.response["Error"]["Message"].startswith("Could not find endpoint")
|
||||
assert e.value.response["Error"]["Message"].startswith("Could not find endpoint")
|
||||
|
||||
with pytest.raises(ClientError) as e:
|
||||
sagemaker.delete_endpoint(EndpointName=endpoint_name)
|
||||
assert e.exception.response["Error"]["Message"].startswith("Could not find endpoint")
|
||||
assert e.value.response["Error"]["Message"].startswith("Could not find endpoint")
|
||||
|
||||
|
||||
def _create_model(boto_client, model_name):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue