Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion cppython/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ def download(self):
Download the generator tooling if required
"""
if self._enabled:
path = self.pyproject.tool.cppython.install_path
base_path = self.pyproject.tool.cppython.install_path

for generator in self._generators:

path = base_path / generator.name()

path.mkdir(parents=True, exist_ok=True)

if not generator.generator_downloaded(path):
self._interface.print(f"Downloading the {generator.name()} tool")

Expand Down
26 changes: 2 additions & 24 deletions tests/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Test the functions related to the internal interface implementation and the 'Interface' interface itself
"""

from pathlib import Path

from cppython_core.schema import Generator, GeneratorData, PyProject
from pytest_mock import MockerFixture

Expand Down Expand Up @@ -31,30 +33,6 @@ def test_construction(self, mocker: MockerFixture):
configuration = ProjectConfiguration()
Project(configuration, interface_mock, default_pyproject.dict(by_alias=True))

def test_download(self, mocker: MockerFixture):
"""
TODO
"""

interface_mock = mocker.MagicMock()
configuration = ProjectConfiguration()

generator_type = mocker.Mock(spec=Generator)
generator_type.name.return_value = "mock"
generator_type.data_type.return_value = MockGeneratorData

gather_override = mocker.patch.object(ProjectBuilder, "gather_plugins")
gather_override.return_value = [generator_type]

project_data = default_pyproject.dict(by_alias=True)
mock_data = MockGeneratorData(check=True)
project_data["tool"]["cppython"]["mock"] = mock_data.dict(by_alias=True)

project = Project(configuration, interface_mock, project_data)

# TODO: This does not verify signature correctness
project.download()


class TestBuilder:
"""
Expand Down