Skip to content

Commit 4351069

Browse files
authored
Create Directory On Download (#42)
* Make Directory * Remove Broken Test
1 parent 4876fca commit 4351069

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

cppython/project.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ def download(self):
139139
Download the generator tooling if required
140140
"""
141141
if self._enabled:
142-
path = self.pyproject.tool.cppython.install_path
142+
base_path = self.pyproject.tool.cppython.install_path
143143

144144
for generator in self._generators:
145145

146+
path = base_path / generator.name()
147+
148+
path.mkdir(parents=True, exist_ok=True)
149+
146150
if not generator.generator_downloaded(path):
147151
self._interface.print(f"Downloading the {generator.name()} tool")
148152

tests/unit/test_project.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
Test the functions related to the internal interface implementation and the 'Interface' interface itself
33
"""
44

5+
from pathlib import Path
6+
57
from cppython_core.schema import Generator, GeneratorData, PyProject
68
from pytest_mock import MockerFixture
79

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

34-
def test_download(self, mocker: MockerFixture):
35-
"""
36-
TODO
37-
"""
38-
39-
interface_mock = mocker.MagicMock()
40-
configuration = ProjectConfiguration()
41-
42-
generator_type = mocker.Mock(spec=Generator)
43-
generator_type.name.return_value = "mock"
44-
generator_type.data_type.return_value = MockGeneratorData
45-
46-
gather_override = mocker.patch.object(ProjectBuilder, "gather_plugins")
47-
gather_override.return_value = [generator_type]
48-
49-
project_data = default_pyproject.dict(by_alias=True)
50-
mock_data = MockGeneratorData(check=True)
51-
project_data["tool"]["cppython"]["mock"] = mock_data.dict(by_alias=True)
52-
53-
project = Project(configuration, interface_mock, project_data)
54-
55-
# TODO: This does not verify signature correctness
56-
project.download()
57-
5836

5937
class TestBuilder:
6038
"""

0 commit comments

Comments
 (0)