Fix test failures and add comprehensive improvements (v1.4.0) #1
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.
Summary
This PR fixes all test failures and adds significant improvements to the pyandroid-dev library for version 1.4.0.
Critical Fixes
✅ Test Workflow Fixed
--cov-report=xmland--cov-report=termflags✅ Backend Import Error Handling
✅ Activity Lifecycle Validation
InvalidStateErrorfor invalid operationsNew Features
🎯 Custom Exception Classes
PyAndroidError- Base exception classActivityNotFoundError- Activity not registeredInvalidStateError- Invalid state transitions🎯 Enhanced Type Hints
🎯 Activity Extras
activity.extrasdictionary🎯 Intent Improvements
has_extra(key)- Check if extra existsget_all_extras()- Get all extras as dictionary🎯 View Management
remove_view()method to Activity classCode Quality Improvements
📝 Documentation
🧪 Test Suite Enhancements
conftest.pyfor shared configuration🔧 Better Error Messages
Configuration Updates
Breaking Changes
InvalidStateErrorTesting
All tests now pass:
Files Changed
.github/workflows/tests.yml- Fixed coverage generationpyandroid/backend/__init__.py- Graceful import error handlingpyandroid/core.py- Major improvements (exceptions, validation, type hints)tests/test_core.py- Comprehensive test improvementstests/test_ui.py- Additional UI component teststests/conftest.py- New shared test configurationpyproject.toml- Updated metadata and Python versionIMPROVEMENTS.md- Full documentation of changesDocumentation
See IMPROVEMENTS.md for detailed documentation of all changes, migration guide, and examples.
Checklist
Next Steps
After merging:
Ready to merge! This PR significantly improves the library's reliability, maintainability, and developer experience.