Address pytest warnings (#3629)
* Address `boto` deprecation warnings This commit eliminates the following warning: ../boto/ec2/connection.py:582: PendingDeprecationWarning: The current get_all_instances implementation will be replaced with get_all_reservations. `boto` isn't likely to ever make good on this warning, but doing the replacement will declutter the `moto` test output. * Remove `invoke_lambda` tracebacks from unit test logging If an exception is encountered, the details are returned in the response payload. Printing the traceback was just adding noise to the pytest output. * Use known AMIs in unit tests This commit eliminates the following warning in the pytest output: `PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.` Known, pre-loaded AMI image ids are used instead of random ids that don't actually exist in the moto backend. The integrity of the tests is unaffected by this change. A test has been added to provide explicit coverage of the PendingDeprecationWarning raised when an invalid AMI image id is passed to moto.
This commit is contained in:
parent
cd25ab7a16
commit
f4b81e69b8
17 changed files with 98 additions and 72 deletions
|
|
@ -12,6 +12,7 @@ from botocore.exceptions import ClientError
|
|||
import pytest
|
||||
|
||||
from moto import mock_ec2, mock_ssm
|
||||
from tests import EXAMPLE_AMI_ID
|
||||
|
||||
|
||||
@mock_ssm
|
||||
|
|
@ -1677,7 +1678,7 @@ def test_get_command_invocations_by_instance_tag():
|
|||
]
|
||||
num_instances = 3
|
||||
resp = ec2.run_instances(
|
||||
ImageId="ami-1234abcd",
|
||||
ImageId=EXAMPLE_AMI_ID,
|
||||
MaxCount=num_instances,
|
||||
MinCount=num_instances,
|
||||
TagSpecifications=tag_specifications,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import json
|
|||
|
||||
|
||||
from moto import mock_ssm, mock_cloudformation
|
||||
from tests import EXAMPLE_AMI_ID
|
||||
|
||||
|
||||
@mock_ssm
|
||||
|
|
@ -15,7 +16,7 @@ def test_get_command_invocations_from_stack():
|
|||
"EC2Instance1": {
|
||||
"Type": "AWS::EC2::Instance",
|
||||
"Properties": {
|
||||
"ImageId": "ami-test-image-id",
|
||||
"ImageId": EXAMPLE_AMI_ID,
|
||||
"KeyName": "test",
|
||||
"InstanceType": "t2.micro",
|
||||
"Tags": [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue