@@ -169,12 +169,16 @@ def mock_read(self):
169169 @return Curent mocking configuration (dictionary)
170170 """
171171 if os .path .isfile (self .MOCK_FILE_NAME ):
172+ if self .DEBUG_FLAG :
173+ self .debug (self .mock_read .__name__ , "reading %s" % self .MOCK_FILE_NAME )
172174 with open (self .MOCK_FILE_NAME , "r" ) as f :
173175 return json .load (f )
174176 return {}
175177
176178 def mock_write (self , mock_ids ):
177179 # Write current mocking structure
180+ if self .DEBUG_FLAG :
181+ self .debug (self .mock_write .__name__ , "writing %s" % self .MOCK_FILE_NAME )
178182 with open (self .MOCK_FILE_NAME , "w" ) as f :
179183 f .write (json .dumps (mock_ids , indent = 4 ))
180184
@@ -189,11 +193,17 @@ def mock_manufacture_ids(self, mid, platform_name, oper='+'):
189193 # Operations on mocked structure
190194 if oper == '+' :
191195 mock_ids [mid ] = platform_name
196+ if self .DEBUG_FLAG :
197+ self .debug (self .mock_manufacture_ids .__name__ , "mock_ids['%s'] = '%s'" % (mid , platform_name ))
192198 elif oper in ['-' , '!' ]:
193199 if mid in mock_ids :
194200 mock_ids .pop (mid )
201+ if self .DEBUG_FLAG :
202+ self .debug (self .mock_manufacture_ids .__name__ , "removing '%s' mock" % mid )
195203 elif mid == '*' :
196204 mock_ids = {} # Zero mocking set
205+ if self .DEBUG_FLAG :
206+ self .debug (self .mock_manufacture_ids .__name__ , "zero mocking set" )
197207
198208 self .mock_write (mock_ids )
199209 return mock_ids
@@ -247,7 +257,7 @@ def list_platforms(self):
247257 result = []
248258 mbeds = self .list_mbeds ()
249259 for i , val in enumerate (mbeds ):
250- platform_name = val ['platform_name' ]
260+ platform_name = str ( val ['platform_name' ])
251261 if platform_name not in result :
252262 result .append (platform_name )
253263 return result
@@ -259,7 +269,7 @@ def list_platforms_ext(self):
259269 result = {}
260270 mbeds = self .list_mbeds ()
261271 for i , val in enumerate (mbeds ):
262- platform_name = val ['platform_name' ]
272+ platform_name = str ( val ['platform_name' ])
263273 if platform_name not in result :
264274 result [platform_name ] = 1
265275 else :
0 commit comments