TechDebt - remove warnings from tests (#5390)
This commit is contained in:
parent
28963a273b
commit
9e1d78d44e
@ -1,5 +1,6 @@
|
|||||||
import base64
|
import base64
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
import warnings
|
||||||
from unittest import SkipTest, mock
|
from unittest import SkipTest, mock
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
@ -2303,15 +2304,14 @@ def test_create_instance_with_launch_template_id_produces_no_warning(
|
|||||||
LaunchTemplateName=str(uuid4()), LaunchTemplateData={"ImageId": EXAMPLE_AMI_ID}
|
LaunchTemplateName=str(uuid4()), LaunchTemplateData={"ImageId": EXAMPLE_AMI_ID}
|
||||||
)["LaunchTemplate"]
|
)["LaunchTemplate"]
|
||||||
|
|
||||||
with pytest.warns(None) as captured_warnings:
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("error")
|
||||||
resource.create_instances(
|
resource.create_instances(
|
||||||
MinCount=1,
|
MinCount=1,
|
||||||
MaxCount=1,
|
MaxCount=1,
|
||||||
LaunchTemplate={launch_template_kind: template[launch_template_kind]},
|
LaunchTemplate={launch_template_kind: template[launch_template_kind]},
|
||||||
)
|
)
|
||||||
|
|
||||||
assert len(captured_warnings) == 0
|
|
||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_create_instance_from_launch_template__process_tags():
|
def test_create_instance_from_launch_template__process_tags():
|
||||||
|
@ -297,6 +297,7 @@ def test_get_all_spot_instance_requests_filtering():
|
|||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
|
@pytest.mark.filterwarnings("ignore")
|
||||||
def test_request_spot_instances_instance_lifecycle():
|
def test_request_spot_instances_instance_lifecycle():
|
||||||
if settings.TEST_SERVER_MODE:
|
if settings.TEST_SERVER_MODE:
|
||||||
# Currently no easy way to check which instance was created by request_spot_instance
|
# Currently no easy way to check which instance was created by request_spot_instance
|
||||||
@ -312,6 +313,7 @@ def test_request_spot_instances_instance_lifecycle():
|
|||||||
|
|
||||||
|
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
|
@pytest.mark.filterwarnings("ignore")
|
||||||
def test_request_spot_instances_with_tags():
|
def test_request_spot_instances_with_tags():
|
||||||
client = boto3.client("ec2", region_name="us-east-1")
|
client = boto3.client("ec2", region_name="us-east-1")
|
||||||
request = client.request_spot_instances(
|
request = client.request_spot_instances(
|
||||||
|
@ -74,6 +74,7 @@ input_instance_groups = [
|
|||||||
|
|
||||||
|
|
||||||
@mock_emr
|
@mock_emr
|
||||||
|
@pytest.mark.filterwarnings("ignore")
|
||||||
def test_describe_cluster():
|
def test_describe_cluster():
|
||||||
region_name = "us-east-1"
|
region_name = "us-east-1"
|
||||||
client = boto3.client("emr", region_name=region_name)
|
client = boto3.client("emr", region_name=region_name)
|
||||||
@ -251,6 +252,7 @@ def test_describe_job_flows():
|
|||||||
|
|
||||||
|
|
||||||
@mock_emr
|
@mock_emr
|
||||||
|
@pytest.mark.filterwarnings("ignore")
|
||||||
def test_describe_job_flow():
|
def test_describe_job_flow():
|
||||||
client = boto3.client("emr", region_name="us-east-1")
|
client = boto3.client("emr", region_name="us-east-1")
|
||||||
|
|
||||||
|
@ -589,10 +589,12 @@ def test_thing_group_already_exists_with_same_properties_returned():
|
|||||||
current_thing_group = client.create_thing_group(
|
current_thing_group = client.create_thing_group(
|
||||||
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
|
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
|
||||||
)
|
)
|
||||||
|
current_thing_group.pop("ResponseMetadata")
|
||||||
|
|
||||||
thing_group = client.create_thing_group(
|
thing_group = client.create_thing_group(
|
||||||
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
|
thingGroupName=thing_group_name, thingGroupProperties=thing_group_properties
|
||||||
)
|
)
|
||||||
|
thing_group.pop("ResponseMetadata")
|
||||||
assert thing_group == current_thing_group
|
assert thing_group == current_thing_group
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user