feat: Set up comprehensive Python testing infrastructure #314
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.
Add Python Testing Infrastructure
Summary
This PR sets up a comprehensive testing infrastructure for the Hayaku project using Poetry, pytest, and related testing tools. The setup provides a foundation for writing unit and integration tests with proper mocking support for Sublime Text components.
Changes Made
Package Management
package-mode = false
(since this is a Sublime Text plugin)pyproject.toml
with all necessary configurationTesting Framework
Configuration
pyproject.toml
:Directory Structure
Testing Fixtures
Created comprehensive fixtures in
conftest.py
:temp_dir
- Temporary directory managementmock_sublime
- Mocked Sublime Text APImock_view
- Mocked View objectssample_css_dict
- Sample CSS data for testingmock_settings
- Hayaku settings configurationtemp_css_file
- Temporary CSS file creationOther Updates
.gitignore
with Python and testing-related patternsHow to Use
Install dependencies:
Run tests:
View coverage report:
# Open htmlcov/index.html in browser
Notes
package-mode = false
in Poetry since this is a Sublime Text plugin that doesn't need to be packaged as a Python library--cov-fail-under=80
Next Steps
With this infrastructure in place, developers can now: