can't capture boto3 using python placebo

395 views Asked by At

I have some Python (v.3.x) that works like a charm on AWS using boto3 etc.. Now I'm asked to write some tests around that, so I found this to capture the response which I'll create the test around it:

https://github.com/garnaat/placebo

Using ptpython I'm able to run my code, but the recording is not happening (not that I can find), here's what I did:

session = boto3.Session()
pill = placebo.attach(session, data_path='/c/Users/myuser/placebo')
pill.record()
run my python code which does the job

The only thing I'm thinking right now is the fact I'm on Windows 7, maybe it's not accepting the path.
Any thoughts?

1

There are 1 answers

2
Naim Salameh On

I solved the issue, this step is not included in the documentation above I found it elsewhere:

session = boto3.Session()
pill = placebo.attach(session, data_path='.')
pill.record()
ec2 = session.client('ec2', region_name='us-west-2')
response = ec2.describe_instances()

that got me a recording, from here I can do whatever boto3 code I want - hope this helps anyone.