def add_row( self, *renderables: T.Optional[RenderableType], style: T.Optional[StyleType] = None, end_section: bool = False, ) -> None: def add_cell(column: Column, renderable: RenderableType) -> None: column._cells.insert(0, renderable) cell_renderables: T.List[T.Optional[RenderableType]] = list( renderables) columns = self.columns if len(cell_renderables) < len(columns): cell_renderables = [ *cell_renderables, *[None] * (len(columns) - len(cell_renderables)), ] for index, renderable in enumerate(cell_renderables): if index == len(columns): column = Column(_index=index) for _ in self.rows: add_cell(column, T.Text("")) self.columns.append(column) else: column = columns[index] if renderable is None: add_cell(column, "") elif is_renderable(renderable): add_cell(column, renderable) else: raise NotRenderableError( f"unable to render {type(renderable).__name__};" "a string or other renderable object is required") self.rows.insert(0, Row(style=style, end_section=end_section))
python_executable=sys.executable, ) # PermissionError if sys.version_info[ 0] != 2 and os.name != 'nt': # can't correctly set the permissions required for this with pytest.raises(build.BuildException): build.ProjectBuilder(test_no_permission) # TomlDecodeError with pytest.raises(build.BuildException): build.ProjectBuilder(test_bad_syntax_path) @pytest.mark.parametrize( 'value', [b'something', typing.Text('something_else')]) def test_python_executable(test_flit_path, value): builder = build.ProjectBuilder(test_flit_path) builder.python_executable = value assert builder.python_executable == value assert builder._hook.python_executable == value @pytest.mark.parametrize('distribution', ['wheel', 'sdist']) def test_get_dependencies_missing_backend(packages_path, distribution): bad_backend_path = os.path.join(packages_path, 'test-bad-backend') builder = build.ProjectBuilder(bad_backend_path) with pytest.raises(build.BuildException): builder.get_dependencies(distribution)
backend_path=None, python_executable=sys.executable, runner=builder._runner, ) # PermissionError if sys.version_info[0] != 2 and os.name != 'nt': # can't correctly set the permissions required for this with pytest.raises(build.BuildException): build.ProjectBuilder(test_no_permission) # TomlDecodeError with pytest.raises(build.BuildException): build.ProjectBuilder(test_bad_syntax_path) @pytest.mark.parametrize('value', [b'something', typing.Text('something_else')]) def test_python_executable(test_flit_path, value): builder = build.ProjectBuilder(test_flit_path) builder.python_executable = value assert builder.python_executable == value assert builder._hook.python_executable == value @pytest.mark.parametrize('distribution', ['wheel', 'sdist']) def test_get_dependencies_missing_backend(packages_path, distribution): bad_backend_path = os.path.join(packages_path, 'test-bad-backend') builder = build.ProjectBuilder(bad_backend_path) with pytest.raises(build.BuildException): builder.get_dependencies(distribution)