def __init__(self, config): self.logger = logging.getLogger(self.__class__.__name__) self.errors = [] self.config = config adb_path = config.get('adb_path', 'adb') self.devices = Devices(config['devices'], adb_path=adb_path) self.profilers = None self.output_root = paths.OUTPUT_DIR self.result_file = os.path.join(self.output_root, 'Test_results.txt') self.dirs = {}
def test_init_succes(self, adb_setup, load_json, device): device.return_value = None load_json.return_value = {'fake_device': 123456789} mock_device_settings = Mock() devices = Devices({'fake_device': mock_device_settings}, 'adb/path') adb_setup.assert_called_once_with('adb/path') device.assert_called_once_with('fake_device', 123456789, mock_device_settings) assert len(devices.devices) == 1 assert isinstance(devices.devices[0], Device)
def test_init_error(self, adb_setup, load_json): load_json.return_value = {} with pytest.raises(ConfigError): Devices(['fake_device']) adb_setup.assert_called_once_with('adb')
def devices(self, adb_setup, load_json): adb_setup.return_value = None load_json.return_value = {} return Devices([])