diff --git a/craft_application/application.py b/craft_application/application.py index 5411313e..ab854327 100644 --- a/craft_application/application.py +++ b/craft_application/application.py @@ -47,7 +47,7 @@ class _Dispatcher(craft_cli.Dispatcher): @property def parsed_args(self) -> argparse.Namespace: """The map of parsed command-line arguments.""" - return self._parsed_command_args + return self._parsed_command_args or argparse.Namespace() @final @@ -61,7 +61,7 @@ class AppMetadata: source_ignore_patterns: list[str] = field(default_factory=lambda: []) managed_instance_project_path = pathlib.PurePosixPath("/root/project") - ProjectClass: type[models.Project] = models.Project + ProjectClass: type[models.Project] = field(init=False) def __post_init__(self) -> None: setter = super().__setattr__ @@ -129,7 +129,7 @@ def cache_dir(self) -> str: # xdg types: https://github.com/python/typeshed/pull/10163 return save_cache_path(self.app.name) # type: ignore[no-any-return] - def _configure_services(self, build_for: str) -> None: + def _configure_services(self, build_for: str | None) -> None: """Configure additional keyword arguments for any service classes. Any child classes that override this must either call this directly or must diff --git a/tests/conftest.py b/tests/conftest.py index fc689113..07e3a4be 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,7 +33,7 @@ class MyProject(craft_application.models.Project): def get_build_plan(self) -> list[models.BuildInfo]: - arch = craft_application.util.get_host_architecture() + arch = util.get_host_architecture() return [models.BuildInfo(arch, arch, bases.BaseName("ubuntu", "22.04"))]