|
4 | 4 | import sys
|
5 | 5 |
|
6 | 6 | import mockredis
|
7 |
| -from swsssdk.interface import redis, DBInterface |
| 7 | +import redis |
| 8 | +import swsssdk |
8 | 9 | from swsssdk import SonicV2Connector
|
9 | 10 | from swsssdk import SonicDBConfig
|
| 11 | +from swsssdk.interface import DBInterface |
| 12 | +from swsscommon import swsscommon |
10 | 13 |
|
11 | 14 |
|
12 | 15 | if sys.version_info >= (3, 0):
|
@@ -91,7 +94,7 @@ def __init__(self, *args, **kwargs):
|
91 | 94 | # to identify the file path to load the db json files.
|
92 | 95 | namespace = kwargs.pop('namespace')
|
93 | 96 | db_name = kwargs.pop('db_name')
|
94 |
| - self.decode_responses = kwargs.pop('decode_responses') == True |
| 97 | + self.decode_responses = kwargs.pop('decode_responses', False) == True |
95 | 98 | fname = db_name.lower() + ".json"
|
96 | 99 | self.pubsub = MockPubSub()
|
97 | 100 |
|
@@ -143,3 +146,9 @@ def keys(self, pattern='*'):
|
143 | 146 | mockredis.MockRedis.config_set = config_set
|
144 | 147 | redis.StrictRedis = SwssSyncClient
|
145 | 148 | SonicV2Connector.connect = connect_SonicV2Connector
|
| 149 | +swsscommon.SonicV2Connector = SonicV2Connector |
| 150 | + |
| 151 | +# pytest case collecting will import some module before monkey patch, so reload |
| 152 | +from importlib import reload |
| 153 | +import sonic_ax_impl.mibs |
| 154 | +reload(sonic_ax_impl.mibs) |
0 commit comments