Skip to content

test_protocols.test_output_compliance: case should be copied #3490

@jakkdl

Description

@jakkdl

Describe the bug

The test_output_compliance test does copy.deepcopy on json_description, but not on case. This is despite both being shared among test function invocations and both being modified. This means that if the test gets parametrized, or is rerun due to pytest-rerunfailures, or similar, the test fails.

@pytest.mark.parametrize(
"json_description, case, basename", _compliance_tests(TestType.OUTPUT)
)
def test_output_compliance(json_description, case, basename):
service_description = copy.deepcopy(json_description)
operation_name = case.get('given', {}).get('name', 'OperationName')
service_description['operations'] = {
operation_name: case,
}
case['response']['context'] = {'operation_name': operation_name}

Regression Issue

  • Select this option if this issue appears to be a regression.

Possible Solution

Add

case = copy.deepcopy(case)

Additional Information/Context

This was noticed in aio-libs/aiobotocore#1085

Metadata

Metadata

Assignees

Labels

bugThis issue is a confirmed bug.p3This is a minor priority issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions