Moto and boto3 mocks only when specifying the specific python file

103 views Asked by At

I'm using moto to mock my aws calls in my unit tests. When i run pytest tests/test_file.py the unit test will be successful and boto3 gets mocked.

When i run pytest tests/ to detect all the test files in the directory, boto3 doesnt get mocked by moto. Causing an error below.

botocore.exceptions.ClientError: An error occurred (ExpiredToken) when calling the CreateRole operation: The security token included in the request is expired

Is there a specific flag I need to use in pytest to let it act like im running an individual file?

0

There are 0 answers