Skip to content

tests: cover _kivy_bootstrap's contract implementation - #3358

Merged
AndreMiras merged 1 commit into
kivy:developfrom
ElliotGarbus:kivy3-bootstrap-contract-tests
Jul 27, 2026
Merged

tests: cover _kivy_bootstrap's contract implementation#3358
AndreMiras merged 1 commit into
kivy:developfrom
ElliotGarbus:kivy3-bootstrap-contract-tests

Conversation

@ElliotGarbus

Copy link
Copy Markdown
Contributor

Follow-up to #3356 (merged), which added _kivy_bootstrap.py without test
coverage. This adds it.

What's covered

Off-device unit tests for
pythonforandroid/recipes/android/src/_kivy_bootstrap.py, following the same
jnius-faking approach as test_androidmodule_ctypes_finder.py. android.config
is faked directly in sys.modules rather than by importing the real android
package, which sidesteps its native _android import.

  • 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 — the module's core promise against Android recreating the Activity on
    rotation, configuration change or process death.
  • 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.

Notes

  • Passes standalone and combined with test_androidmodule_ctypes_finder.py in
    both run orders (they share the same sys.path-insertion approach for
    importing recipe sources off-device).
  • Full suite (pytest tests/ --ignore tests/test_pythonpackage.py --ignore tests/test_pythonpackage_basic.py) is unaffected.
  • flake8 and ruff both pass on the new file.

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
AndreMiras merged commit 5c192d7 into kivy:develop Jul 27, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants