def test_get_selected(mock_developer_dir): with mock.patch('codemagic.models.xcode.subprocess') as mock_subprocess, \ mock.patch('codemagic.models.xcode.shutil') as mock_shutil: mock_shutil.which = lambda *args: args mock_subprocess.check_output.return_value = str(mock_developer_dir).encode() xcode = Xcode.get_selected() assert xcode.developer_dir == mock_developer_dir
def get_default_test_destination(self, json_output: bool = False, should_print: bool = True) -> Simulator: """ Show default test destination for the chosen Xcode version """ xcode = Xcode.get_selected() if should_print: msg_template = 'Show default test destination for Xcode %s (%s)' self.logger.info(Colors.BLUE(msg_template), xcode.version, xcode.build_version) try: simulator = Simulator.get_default() except ValueError as error: raise XcodeProjectException(str(error)) from error if should_print: if json_output: self.echo(json.dumps(simulator.dict(), indent=4)) else: self.echo(Colors.GREEN(f'{simulator.runtime} {simulator.name}')) return simulator
def test_build_version(mock_developer_dir): xcode = Xcode(mock_developer_dir) assert xcode.build_version == '12A7300'
def test_version(mock_developer_dir): xcode = Xcode(mock_developer_dir) assert xcode.version == LooseVersion('12.0.1')