Make testing style more consistent (#168)
Several overall style changes:
1. Avoid plain `Mock()` and `Mock(spec=thing)`., prefer `mock.create_autospec()`.
1. Don't `mock.patch` without `autospec`.
1. Don't give mock instances special names. Prefer `thing` over `thing_mock` and `mock_thing`.
1. When using `mock.patch`, use the same name as the item being patched to refer to the mock.
```python
with mock.patch('module.thing') as thing:
...
```
and
```
@mock.patch('module.thing')
def test(thing):
...
```
1. Test helper factories should follow the naming convention `make_thing()`.
1. Use `ThingStub` when creating semi-functioning subclasses for testing purposes.
14 files changed