diff --git a/tests/providers/amazon/aws/operators/test_emr_containers.py b/tests/providers/amazon/aws/operators/test_emr_containers.py index 99c8b067bdee37..fa5c4764b87ea8 100644 --- a/tests/providers/amazon/aws/operators/test_emr_containers.py +++ b/tests/providers/amazon/aws/operators/test_emr_containers.py @@ -152,8 +152,7 @@ def test_operator_defer_with_timeout(self, mock_submit_job, mock_check_query_sta self.emr_container.deferrable = True self.emr_container.max_polling_attempts = 1000 - error_match = "Waiter error: max attempts reached" - with pytest.raises(AirflowException, match=error_match): + with pytest.raises(TaskDeferred): self.emr_container.execute(context=None) assert mock_check_query_status.call_count == 1000 diff --git a/tests/providers/amazon/aws/sensors/test_emr_containers.py b/tests/providers/amazon/aws/sensors/test_emr_containers.py index 273b0c795115fc..048533cb60e6c6 100644 --- a/tests/providers/amazon/aws/sensors/test_emr_containers.py +++ b/tests/providers/amazon/aws/sensors/test_emr_containers.py @@ -92,8 +92,7 @@ def test_sensor_defer_with_timeout(self, mock_check_query_status): self.sensor.deferrable = True self.sensor.max_polling_attempts = 1000 - error_match = "Waiter error: max attempts reached" - with pytest.raises(TaskDeferred, match=error_match): + with pytest.raises(TaskDeferred): self.sensor.execute(context=None) assert mock_check_query_status.call_count == 1000