Ensure finalization attributes are preserved on LinuxSystemAppConfig#2773
Merged
kattni merged 2 commits intobeeware:mainfrom Mar 28, 2026
Merged
Ensure finalization attributes are preserved on LinuxSystemAppConfig#2773kattni merged 2 commits intobeeware:mainfrom
kattni merged 2 commits intobeeware:mainfrom
Conversation
kattni
approved these changes
Mar 28, 2026
Contributor
kattni
left a comment
There was a problem hiding this comment.
This appears to be a viable fix. Looks good to me.
Member
Author
|
@filiplajszczak I'd be interested in your take on this as a fix, since it intersects with the typing work you've been doing. We had to merge it as an emergency fix because it was breaking Toga's CI, and it didn't seem to make ty results any worse. |
Contributor
|
@freakboy3742 Looks like |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes beeware/toga#4278
When finalising an Linux System app, any finalisation properties that were passed in to the
finalize_app_config()method were not being set on theLinuxSystemAppConfiginstance. This is because they were being set using thesuper().finalize_app_config()call, and then overwritten with default values when theLinuxSystemAppConfiginstance was constructed.The manifestation of this -
test_modeis never set on Linux system apps - the base implementation offinalize_app_config()sets the attribute; but the LinuxSystemAppConfig narrowing then overwrites the value with the default (test_mode = False).I looked into a number of possible solutions:
**kwargsusage to the outer LinuxSystemAppConfig call:kwargs, that functionality wouldn't be triggered**kwargsover both locations:final_kwargsis returns all the attributes that are passed into the FinalizedAppConfig constructor. This works, but requires a lot of code/attribute duplication**kwargs. This way, we can set the values as part of the base class finalisation, but they're not overwritten when the LinuxSystemAppConfig is created.I would have thought (4) was the "strongest" fix from a typing perspective, but it turns out that (4) and (5) both end up with exactly the same count of typing errors (334), and (5) is a lot simpler to implement, so I've gone with that approach for now.
I've added a test for this specific case - but I've also updated the tests for
finalize_app_configto validate that the returned config has all the right attributes (since that is the one that will actually be used). It didn't reveal any new problems in this case, but it easily could do.PR Checklist: