Port test suite from nose to pytest.

This just eliminates all errors on the tests collection. Elimination of
failures is left to the next commit.
This commit is contained in:
Matěj Cepl 2020-10-06 07:54:49 +02:00
commit 77dc60ea97
146 changed files with 1172 additions and 1277 deletions

View file

@ -12,9 +12,7 @@ import boto.cloudformation
from boto.exception import BotoServerError
import sure # noqa
# Ensure 'assert_raises' context manager support for Python 2.6
import tests.backport_assert_raises # noqa
from nose.tools import assert_raises
import pytest
from moto.core import ACCOUNT_ID
from moto import (
@ -319,7 +317,7 @@ def test_delete_stack_by_id():
conn.describe_stacks().should.have.length_of(1)
conn.delete_stack(stack_id)
conn.describe_stacks().should.have.length_of(0)
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.describe_stacks("test_stack")
conn.describe_stacks(stack_id).should.have.length_of(1)
@ -338,7 +336,7 @@ def test_delete_stack_with_resource_missing_delete_attr():
@mock_cloudformation_deprecated
def test_bad_describe_stack():
conn = boto.connect_cloudformation()
with assert_raises(BotoServerError):
with pytest.raises(BotoServerError):
conn.describe_stacks("bad_stack")
@ -519,7 +517,7 @@ def test_update_stack_when_rolled_back():
stack_id
].status = "ROLLBACK_COMPLETE"
with assert_raises(BotoServerError) as err:
with pytest.raises(BotoServerError) as err:
conn.update_stack("test_stack", dummy_template_json)
ex = err.exception

View file

@ -9,8 +9,7 @@ import boto3
from botocore.exceptions import ClientError
import sure # noqa
# Ensure 'assert_raises' context manager support for Python 2.6
from nose.tools import assert_raises
import pytest
from moto import mock_cloudformation, mock_s3, mock_sqs, mock_ec2
from moto.core import ACCOUNT_ID
@ -548,7 +547,7 @@ def test_boto3_list_stack_set_operations():
@mock_cloudformation
def test_boto3_bad_list_stack_resources():
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
with assert_raises(ClientError):
with pytest.raises(ClientError):
cf_conn.list_stack_resources(StackName="test_stack_set")
@ -1180,7 +1179,7 @@ def test_describe_updated_stack():
@mock_cloudformation
def test_bad_describe_stack():
cf_conn = boto3.client("cloudformation", region_name="us-east-1")
with assert_raises(ClientError):
with pytest.raises(ClientError):
cf_conn.describe_stacks(StackName="non_existent_stack")
@ -1332,7 +1331,7 @@ def test_delete_stack_with_export():
def test_export_names_must_be_unique():
cf = boto3.resource("cloudformation", region_name="us-east-1")
cf.create_stack(StackName="test_stack", TemplateBody=dummy_output_template_json)
with assert_raises(ClientError):
with pytest.raises(ClientError):
cf.create_stack(StackName="test_stack", TemplateBody=dummy_output_template_json)
@ -1373,7 +1372,7 @@ def test_boto3_create_duplicate_stack():
StackName="test_stack", TemplateBody=dummy_template_json,
)
with assert_raises(ClientError):
with pytest.raises(ClientError):
cf_conn.create_stack(
StackName="test_stack", TemplateBody=dummy_template_json,
)

View file

@ -3,7 +3,6 @@ import json
import yaml
import os
import boto3
from nose.tools import raises
import botocore
import sure # noqa