Mocking boto3 S3 client method Python
I'm trying to mock a singluar method from the boto3 s3 client object to throw an exception. But I need all other methods for this class to work as normal. This is so I can test a singular Exception test when and error occurs performing a upload_part_copy 1st Attempt import boto3 from mock import patch with patch('botocore.client.S3.upload_part_copy', side_effect=Exception('Error Uploading')) as mock: client = boto3.client('s3') # Should return actual result o = client.get_object(Bucket='my-bucket', Key='my-key') # Should return mocked exception e = client.upload_part_copy() However this gives