File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 2626mocked_libs_path = os .path .join (test_path , 'mocked_libs' )
2727sys .path .insert (0 , mocked_libs_path )
2828
29+ # --------------------------------------------------------------------
30+ # SonicV2Connector
31+ # --------------------------------------------------------------------
32+ class _DummySonicV2Connector (object ):
33+ def __init__ (self , use_unix_socket_path = True , ** kwargs ):
34+ self .use_unix_socket_path = use_unix_socket_path
35+ def connect (self , db_name ): # no-op
36+ return None
37+ def close (self ): # no-op
38+ return None
39+
40+ # Try to attach to whichever mocked swsscommon the testbed uses
41+ try :
42+ import swsscommon as _swsscommon_mod
43+ if not hasattr (_swsscommon_mod , "SonicV2Connector" ):
44+ _swsscommon_mod .SonicV2Connector = _DummySonicV2Connector
45+ except Exception :
46+ pass
47+
48+ try :
49+ import tests .mock_swsscommon as _tests_swsscommon_mod
50+ if not hasattr (_tests_swsscommon_mod , "SonicV2Connector" ):
51+ _tests_swsscommon_mod .SonicV2Connector = _DummySonicV2Connector
52+ except Exception :
53+ pass
54+
2955modules_path = os .path .dirname (test_path )
3056scripts_path = os .path .join (modules_path , "scripts" )
3157sys .path .insert (0 , modules_path )
You can’t perform that action at this time.
0 commit comments