boto3.client is a convenience method which delegates to the client method of a global singleton instance of boto3.Session. By patching boto3.Session.client instead of boto3.client, all potential Session instances (including the global instance) are intercepted.
boto3.client is a convenience method which delegates to the client method of a global singleton instance of boto3.Session. By patching boto3.Session.client instead of boto3.client, all potential Session instances (including the global instance) are intercepted.
In many instances, SAM CLI does not use the global session (see https://github.com/aws/aws-sam-cli/blob/23beec68bf826ab646344be2cd858b1b4cf4ac7e/samcli/lib/utils/boto_utils.py).