Skip to content
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

Update craft-application #5231

Closed
bepri opened this issue Jan 30, 2025 · 3 comments · Fixed by #5239
Closed

Update craft-application #5231

bepri opened this issue Jan 30, 2025 · 3 comments · Fixed by #5239
Labels

Comments

@bepri
Copy link
Contributor

bepri commented Jan 30, 2025

What needs to get done

craft-application currently breaks tests if updated, so it is pinned at 4.4.0. We should investigate upgrading it

Why it needs to get done

Below is done with craft-application==4.8.2

    def test_project_platform_unknown_name():
        """Raise an error if an empty platform is not a valid architecture."""
        with pytest.raises(CraftValidationError) as raised:
>           snapcraft.models.project.SnapcraftBuildPlanner.model_validate(
                {
                    "name": "test-snap",
                    "base": "test-base",
                    "build-base": "test-build-base",
                    "platforms": {"unknown": None},
                    "project_type": "test-type",
                }
            )
E           pydantic_core._pydantic_core.ValidationError: 2 validation errors for SnapcraftBuildPlanner
E           platforms.unknown.build-on
E             Value error, 'unknown' is not a valid DebianArchitecture [type=value_error, input_value=['unknown'], input_type=list]
E               For further information visit https://errors.pydantic.dev/2.8/v/value_error
E           platforms.unknown.build-for
E             Value error, 'unknown' is not a valid DebianArchitecture [type=value_error, input_value=['unknown'], input_type=list]
E               For further information visit https://errors.pydantic.dev/2.8/v/value_error

tests/unit/models/test_projects.py:2565: ValidationError
@mr-cal
Copy link
Collaborator

mr-cal commented Jan 31, 2025

I think it is OK to update this test to pass.

The change is in craft-application 4.7.0 which did this:

https://github.com/canonical/craft-application/pull/598/files#diff-d49e733a1e99a8cc3fe98cb7d956b735159c60342405692603fe5fcf8a970edaL134-R140

Previously, the validator would raise a CraftValidationError. Now it raises a ValueError, which is a correct change.

@mr-cal
Copy link
Collaborator

mr-cal commented Jan 31, 2025

Related: canonical/craft-application#629

@mr-cal mr-cal added the triaged label Feb 7, 2025
Copy link

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-4126.

This message was autogenerated

@bepri bepri linked a pull request Feb 13, 2025 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants