tests: cover _kivy_bootstrap's contract implementation - #3358
Merged
AndreMiras merged 1 commit intoJul 27, 2026
Conversation
Off-device unit tests for pythonforandroid/recipes/android/src/_kivy_bootstrap.py, following the same jnius-faking approach as test_androidmodule_ctypes_finder.py. Fakes android.config directly in sys.modules rather than importing the real android package, sidestepping its native _android import. Covers: the reflected class comes from ACTIVITY_CLASS_NAME rather than a literal, so --activity-class-name is honoured; a service's None Activity is accepted; the class is resolved once but the live Activity is read fresh on every call, which is the module's core promise against Android recreating it; and remove_presplash() calls removeLoadingScreen() when present, and is a no-op -- not an error -- when there is no Activity or the Activity has no such method.
AndreMiras
approved these changes
Jul 26, 2026
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.
Follow-up to #3356 (merged), which added
_kivy_bootstrap.pywithout testcoverage. This adds it.
What's covered
Off-device unit tests for
pythonforandroid/recipes/android/src/_kivy_bootstrap.py, following the samejnius-faking approach as
test_androidmodule_ctypes_finder.py.android.configis faked directly in
sys.modulesrather than by importing the realandroidpackage, which sidesteps its native
_androidimport.ACTIVITY_CLASS_NAMErather than a literal,so
--activity-class-nameis honoured.NoneActivity is accepted.call — the module's core promise against Android recreating the Activity on
rotation, configuration change or process death.
remove_presplash()callsremoveLoadingScreen()when present, and is ano-op — not an error — when there is no Activity, or the Activity has no
such method.
Notes
test_androidmodule_ctypes_finder.pyinboth run orders (they share the same
sys.path-insertion approach forimporting recipe sources off-device).
pytest tests/ --ignore tests/test_pythonpackage.py --ignore tests/test_pythonpackage_basic.py) is unaffected.