try: json_fp = open("{0}/{1}".format(test_folder, jsonFile)) dataJson = json.load(json_fp) Printc.infob( u"Data for specific tests are loaded from {0}".format(jsonFile)) json_fp.close() except: Printc.err(u"Error while loading json tests {0} : {1}".format( "{0}/{1}".format(test_folder, jsonFile), traceback.format_exc())) else: for device in dataJson: dev_id, td = createDevice(device) device['device_id'] = dev_id time.sleep(5) # due to high DB flow, wait 5s suite.addTest( RFPlayerTestCase("test_0110_device_sensors", plugin, name, cfg, dataJson)) # do some tests comon to all the plugins #suite.addTest(RFPlayerTestCase("test_9900_hbeat", plugin, name, cfg)) suite.addTest( RFPlayerTestCase("test_9990_stop_the_plugin", plugin, name, cfg)) # quit res = unittest.TextTestRunner().run(suite) if res.wasSuccessful() == True: rc = 0 # tests are ok so the shell return code is 0 else: rc = 1 # tests are ok so the shell return code is != 0 plugin.force_leave(return_code=rc)