Skip to content
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

Use assertEqual instead of assertEquals for Python 3.11 compatibility. #775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stacker/blueprints/testutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def assertRenderedBlueprint(self, blueprint): # noqa: N802
expected_dict = json.loads(fd.read())
expected_text = json.dumps(expected_dict, indent=4, sort_keys=True)

self.assertEquals(rendered_dict, expected_dict,
self.assertEqual(rendered_dict, expected_dict,
diff(rendered_text, expected_text))


Expand Down
4 changes: 2 additions & 2 deletions stacker/tests/actions/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,5 +422,5 @@ def test_resolve_parameters_booleans(self):
}
params = {"a": True, "b": False}
p = _resolve_parameters(params, self.bp)
self.assertEquals("true", p["a"])
self.assertEquals("false", p["b"])
self.assertEqual("true", p["a"])
self.assertEqual("false", p["b"])
2 changes: 1 addition & 1 deletion stacker/tests/actions/test_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ def test_diff_parameters_no_changes(self):
}

param_diffs = diff_parameters(old_params, new_params)
self.assertEquals(param_diffs, [])
self.assertEqual(param_diffs, [])
4 changes: 2 additions & 2 deletions stacker/tests/blueprints/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class TestBuildParameter(unittest.TestCase):
def test_base_parameter(self):
p = build_parameter("BasicParam", {"type": "String"})
p.validate()
self.assertEquals(p.Type, "String")
self.assertEqual(p.Type, "String")


class TestBlueprintRendering(unittest.TestCase):
Expand Down Expand Up @@ -175,7 +175,7 @@ def create_template(self):
blueprint = TestBlueprint(name="test", context=context,
description=description)
blueprint.render_template()
self.assertEquals(description, blueprint.template.description)
self.assertEqual(description, blueprint.template.description)

def test_validate_variable_type_cfntype(self):
var_name = "testVar"
Expand Down
4 changes: 2 additions & 2 deletions stacker/tests/providers/aws/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def test_select_update_method(self):
[{'force_interactive': True,
'force_change_set': True},
self.provider.interactive_update_stack]]:
self.assertEquals(
self.assertEqual(
self.provider.select_update_method(**i[0]),
i[1]
)
Expand Down Expand Up @@ -955,7 +955,7 @@ def test_select_update_method(self):
[{'force_interactive': True,
'force_change_set': True},
self.provider.interactive_update_stack]]:
self.assertEquals(
self.assertEqual(
self.provider.select_update_method(**i[0]),
i[1]
)
Expand Down
58 changes: 29 additions & 29 deletions stacker/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,20 @@ def test_render_yaml(self):
exp_dict = {'a': 1, 'b': 2, 'c': 3}
exp_list = ['a', 'b', 'c']

self.assertEquals(pc['namespace'], 'test')
self.assertEquals(pc['list_var'], exp_list)
self.assertEquals(pc['dict_var'], exp_dict)
self.assertEquals(pc['str_var'], 'Hello World!')
self.assertEquals(pc['nested_list'][0], exp_list)
self.assertEquals(pc['nested_list'][1], exp_dict)
self.assertEquals(pc['nested_list'][2], 'another str')
self.assertEquals(pc['nested_dict']['a'], exp_list)
self.assertEquals(pc['nested_dict']['b'], exp_dict)
self.assertEquals(pc['nested_dict']['c'], 'another str')
self.assertEquals(pc['empty'], '')
self.assertEquals(pc['substr'], 'prefix-another str-suffix')
self.assertEquals(pc['multiple'], 'another str-hello')
self.assertEquals(pc['dont_match_this'], '${output something}')
self.assertEqual(pc['namespace'], 'test')
self.assertEqual(pc['list_var'], exp_list)
self.assertEqual(pc['dict_var'], exp_dict)
self.assertEqual(pc['str_var'], 'Hello World!')
self.assertEqual(pc['nested_list'][0], exp_list)
self.assertEqual(pc['nested_list'][1], exp_dict)
self.assertEqual(pc['nested_list'][2], 'another str')
self.assertEqual(pc['nested_dict']['a'], exp_list)
self.assertEqual(pc['nested_dict']['b'], exp_dict)
self.assertEqual(pc['nested_dict']['c'], 'another str')
self.assertEqual(pc['empty'], '')
self.assertEqual(pc['substr'], 'prefix-another str-suffix')
self.assertEqual(pc['multiple'], 'another str-hello')
self.assertEqual(pc['dont_match_this'], '${output something}')

def test_render_yaml_errors(self):
# We shouldn't be able to substitute an object into a string
Expand Down Expand Up @@ -141,10 +141,10 @@ def test_config_validate_missing_stack_source(self):
config.validate()

stack_errors = ex.exception.errors['stacks'][0]
self.assertEquals(
self.assertEqual(
stack_errors['template_path'][0].__str__(),
"class_path or template_path is required.")
self.assertEquals(
self.assertEqual(
stack_errors['class_path'][0].__str__(),
"class_path or template_path is required.")

Expand All @@ -169,10 +169,10 @@ def test_config_validate_stack_class_and_template_paths(self):
config.validate()

stack_errors = ex.exception.errors['stacks'][0]
self.assertEquals(
self.assertEqual(
stack_errors['template_path'][0].__str__(),
"class_path cannot be present when template_path is provided.")
self.assertEquals(
self.assertEqual(
stack_errors['class_path'][0].__str__(),
"template_path cannot be present when class_path is provided.")

Expand All @@ -186,7 +186,7 @@ def test_config_validate_missing_name(self):
config.validate()

error = ex.exception.errors['stacks'][0]['name'].errors[0]
self.assertEquals(
self.assertEqual(
error.__str__(),
"This field is required.")

Expand All @@ -204,14 +204,14 @@ def test_config_validate_duplicate_stack_names(self):
config.validate()

error = ex.exception.errors['stacks'][0]
self.assertEquals(
self.assertEqual(
error.__str__(),
"Duplicate stack bastion found at index 0.")

def test_dump_unicode(self):
config = Config()
config.namespace = "test"
self.assertEquals(dump(config), b"""namespace: test
self.assertEqual(dump(config), b"""namespace: test
stacks: []
""")

Expand All @@ -220,7 +220,7 @@ def test_dump_unicode(self):
# python specific objects.
self.assertNotEquals(
dump(config), b"namespace: !!python/unicode 'test'\n")
self.assertEquals(dump(config), b"""namespace: test
self.assertEqual(dump(config), b"""namespace: test
stacks: []
""")

Expand All @@ -232,7 +232,7 @@ def test_parse_tags(self):
"hello": 1
simple_tag: simple value
""")
self.assertEquals(config.tags, {
self.assertEqual(config.tags, {
"a:b": "c",
"hello": "1",
"simple_tag": "simple value"})
Expand All @@ -250,7 +250,7 @@ def test_parse_with_arbitrary_anchors(self):
""")

stack = config.stacks[0]
self.assertEquals(stack.variables, {"Foo": "bar"})
self.assertEqual(stack.variables, {"Foo": "bar"})

def test_parse_with_deprecated_parameters(self):
config = parse("""
Expand All @@ -265,7 +265,7 @@ def test_parse_with_deprecated_parameters(self):
config.validate()

error = ex.exception.errors['stacks'][0]['parameters'][0]
self.assertEquals(
self.assertEqual(
error.__str__(),
"DEPRECATION: Stack definition vpc contains deprecated "
"'parameters', rather than 'variables'. You are required to update"
Expand All @@ -275,9 +275,9 @@ def test_parse_with_deprecated_parameters(self):
def test_config_build(self):
vpc = Stack({"name": "vpc", "class_path": "blueprints.VPC"})
config = Config({"namespace": "prod", "stacks": [vpc]})
self.assertEquals(config.namespace, "prod")
self.assertEquals(config.stacks[0].name, "vpc")
self.assertEquals(config["namespace"], "prod")
self.assertEqual(config.namespace, "prod")
self.assertEqual(config.stacks[0].name, "vpc")
self.assertEqual(config["namespace"], "prod")
config.validate()

def test_parse(self):
Expand Down Expand Up @@ -566,7 +566,7 @@ def test_render_parse_load_namespace_fallback(self):
config = render_parse_load(
conf, environment={"namespace": "prod"}, validate=False)
config.validate()
self.assertEquals(config.namespace, "prod")
self.assertEqual(config.namespace, "prod")

def test_allow_most_keys_to_be_duplicates_for_overrides(self):
yaml_config = """
Expand Down
16 changes: 8 additions & 8 deletions stacker/tests/test_plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def fn(stack, status=None):
description="Test", graph=graph)
plan.execute(walk)

self.assertEquals(calls, ['namespace-vpc.1', 'namespace-bastion.1'])
self.assertEqual(calls, ['namespace-vpc.1', 'namespace-bastion.1'])

def test_execute_plan_locked(self):
# Locked stacks still need to have their requires evaluated when
Expand All @@ -137,7 +137,7 @@ def fn(stack, status=None):
description="Test", graph=graph)
plan.execute(walk)

self.assertEquals(calls, ['namespace-vpc.1', 'namespace-bastion.1'])
self.assertEqual(calls, ['namespace-vpc.1', 'namespace-bastion.1'])

def test_execute_plan_filtered(self):
vpc = Stack(
Expand All @@ -164,7 +164,7 @@ def fn(stack, status=None):
targets=['db.1'])
plan.execute(walk)

self.assertEquals(calls, [
self.assertEqual(calls, [
'namespace-vpc.1', 'namespace-db.1'])

def test_execute_plan_exception(self):
Expand Down Expand Up @@ -192,8 +192,8 @@ def fn(stack, status=None):
with self.assertRaises(PlanFailed):
plan.execute(walk)

self.assertEquals(calls, ['namespace-vpc.1'])
self.assertEquals(vpc_step.status, FAILED)
self.assertEqual(calls, ['namespace-vpc.1'])
self.assertEqual(vpc_step.status, FAILED)

def test_execute_plan_skipped(self):
vpc = Stack(
Expand All @@ -218,7 +218,7 @@ def fn(stack, status=None):
plan = build_plan(description="Test", graph=graph)
plan.execute(walk)

self.assertEquals(calls, ['namespace-vpc.1', 'namespace-bastion.1'])
self.assertEqual(calls, ['namespace-vpc.1', 'namespace-bastion.1'])

def test_execute_plan_failed(self):
vpc = Stack(
Expand Down Expand Up @@ -251,7 +251,7 @@ def fn(stack, status=None):

calls.sort()

self.assertEquals(calls, ['namespace-db.1', 'namespace-vpc.1'])
self.assertEqual(calls, ['namespace-db.1', 'namespace-vpc.1'])

def test_execute_plan_cancelled(self):
vpc = Stack(
Expand All @@ -276,7 +276,7 @@ def fn(stack, status=None):
plan = build_plan(description="Test", graph=graph)
plan.execute(walk)

self.assertEquals(calls, ['namespace-vpc.1', 'namespace-bastion.1'])
self.assertEqual(calls, ['namespace-vpc.1', 'namespace-bastion.1'])

def test_build_graph_missing_dependency(self):
bastion = Stack(
Expand Down
6 changes: 3 additions & 3 deletions stacker/tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def test_stack_tags_default(self):
stack_id=1
)
stack = Stack(definition=definition, context=self.context)
self.assertEquals(stack.tags, {"environment": "prod"})
self.assertEqual(stack.tags, {"environment": "prod"})

def test_stack_tags_override(self):
self.config.tags = {"environment": "prod"}
Expand All @@ -95,7 +95,7 @@ def test_stack_tags_override(self):
tags={"environment": "stage"}
)
stack = Stack(definition=definition, context=self.context)
self.assertEquals(stack.tags, {"environment": "stage"})
self.assertEqual(stack.tags, {"environment": "stage"})

def test_stack_tags_extra(self):
self.config.tags = {"environment": "prod"}
Expand All @@ -105,7 +105,7 @@ def test_stack_tags_extra(self):
tags={"app": "graph"}
)
stack = Stack(definition=definition, context=self.context)
self.assertEquals(stack.tags, {"environment": "prod", "app": "graph"})
self.assertEqual(stack.tags, {"environment": "prod", "app": "graph"})


if __name__ == '__main__':
Expand Down