diff options
author | 2020-02-12 09:16:46 -0800 | |
---|---|---|
committer | 2020-02-12 10:07:58 -0800 | |
commit | 22a55534ef13990815a6f69d361e2a12693075d5 (patch) | |
tree | 9740dc12eca3851c8885a3910e28b30a908508d5 /tests/base.py | |
parent | Sync tests: use async_test decorator (diff) |
Tests: fix unawaited error for MockAPIClient
This error is due to the use of an actual instance of APIClient as the
spec for the mock. recreate() is called in __init__ which in turn
creates a task for the _create_session coroutine.
The approach to the solution is to use the type for the spec rather than
and instance, thus avoiding any call of __init__. However, without an
instance, instance attributes will not be included in the spec.
Therefore, they are defined as class attributes on the actual APIClient
class definition and given default values.
Alternatively, a subclass of APIClient could have been made in the
tests.helpers module to define those class attributes. However, it
seems easier to maintain if the attributes are in the original class
definition.
Diffstat (limited to 'tests/base.py')
0 files changed, 0 insertions, 0 deletions