# moto-mock-issues

## Packages Not Compatible

**Problem:** [New pip dependency resolver behavior](https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-2-2020) prevents installation of packages when running ows-users locally.

```
$ python -m venv env
$ source env/bin/activate
$ pip install --upgrade pip==20.2
$ pip install -r requirements-upstream.txt --use-feature=2020-resolver
...
ERROR: Cannot install boto3 1.9.48 and moto 1.3.6 because these package versions have conflicting dependencies.

The conflict is caused by:
    boto3 1.9.48 depends on botocore<1.13.0 and >=1.12.48
    moto 1.3.6 depends on botocore<1.11 and >=1.9.16
```

**Solution:**
```
boto3==1.15.2
moto==1.3.16
```
**But:** moto behavior has changed, decorator may break, see next section...

## Decorators Broken

**Problem:** [Upgrading botocore library](https://github.com/spulec/moto/issues/1793#issuecomment-416053411) changes when patching can occur. You cannot apply patch after boto client is created.
```
$ python -m venv env
$ source env/bin/activate
$ pip install --upgrade pip==20.2
$ pip install -r requirements-feature.txt --use-feature=2020-resolver
$ vi ~/.aws/credentials
... change "aws_secret_access_key" you are using to something invalid
$ pytest test_1.py
...
botocore.exceptions.ClientError: An error occurred (InvalidClientTokenId) when calling the CreateTopic operation: The security token included in the request is invalid.
1 failed in 1.30 seconds
$ pytest test_2.py
...
1 passed in 0.93 seconds
```

**Solution:** Follow [recommended usage of moto](https://github.com/spulec/moto/blob/master/README.md#very-important----recommended-usage) and add fixtures **or** import modules with boto client inside of decorated function.


