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
4 changes: 2 additions & 2 deletions cppython/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
The central delegation of the CPPython project
"""

import collections.abc
import logging
from importlib import metadata
from pathlib import Path
Expand Down Expand Up @@ -89,7 +88,8 @@ def create_generators(
"""
_generators = []
for plugin_type in plugins:
_generators.append(plugin_type(configuration, project, cppython))
name = plugin_type.name()
_generators.append(plugin_type(configuration, project, cppython, getattr(cppython, name)))

return _generators

Expand Down
16 changes: 8 additions & 8 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 21 additions & 2 deletions tests/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ class MockGeneratorData(GeneratorData):
check: bool


class ExtendedCPPython(CPPythonData):
"""
TODO
"""

mock: MockGeneratorData


class TestProject:
"""
TODO
Expand Down Expand Up @@ -105,9 +113,20 @@ def test_generator_creation(self, mocker: MockerFixture):

assert not generators

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

mock_data = MockGeneratorData(check=True)
extended_cppython_dict = default_cppython_data.dict(exclude_defaults=True)
extended_cppython_dict["mock"] = mock_data
extended_cppython = ExtendedCPPython(**extended_cppython_dict)

generators = builder.create_generators(
[generator], generator_configuration, default_pep621, default_cppython_data
[generator_type],
generator_configuration,
default_pep621,
extended_cppython,
)

assert len(generators) == 1
Expand Down