-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!(ProjectService): allow the ProjectService to work with Imagecraft #674
Conversation
c6ad126
to
da33cbf
Compare
This makes it more obvious to a partitions-using application that it needs to override `get_partitions`
This should allow imagecraft to use the service
68b56fd
to
0a3a25a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I have mostly questions and suggestions but probably nothing really blocking.
Tests are failing though so I think it should be fixed before merging.
@@ -239,7 +239,7 @@ def _init_lifecycle_manager(self) -> LifecycleManager: | |||
project_vars_part_name=self._project.adopt_info, | |||
project_vars=self._project_vars, | |||
track_stage_packages=True, | |||
partitions=self._services.get("project").get_partitions(), | |||
partitions=self._services.get("project").partitions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: using self._services.get(Literal["project"])
is helping the typing interpreter (at least in my IDE) to understand the type of the returned object (and so to suggest methods and fields). That is a bit uglier though so maybe we should define a constants for the available services provided by craft-application?
PROJECT_SERVICE = Literal["project"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which IDE are you using that's doing this? I'm not seeing this issue in pycharm or using the pyright LSP.
assert project_data == expected | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"build_for", [arch.value for arch in craft_platforms.DebianArchitecture] + ["all"] | ||
"build_for", [arch.value for arch in craft_platforms.DebianArchitecture] | ||
) | ||
@pytest.mark.usefixtures("enable_partitions") | ||
def test_expand_environment_stage_dirs( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: I am confused about this test. I failed to understand why it is using the platform/build_for values as partition names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's to test that we have variable/flexible partitions based on the platform. We're using the FakeProjectService
from conftest.py
here which does that. I've added a comment to explain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still looks good to me!
make lint && make test
?docs/reference/changelog.rst
)?