Skip to content

Commit

Permalink
Create Directory On Download (#42)
Browse files Browse the repository at this point in the history
* Make Directory

* Remove Broken Test
  • Loading branch information
Behemyth authored Apr 16, 2022
1 parent 4876fca commit 4351069
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
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

0 comments on commit 4351069

Please sign in to comment.