feat: Set up comprehensive Python testing infrastructure with Poetry #355
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.
Set Up Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the ANSI Color Build Sublime Text plugin using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.toml
)pytest
- Main testing frameworkpytest-cov
- Coverage reportingpytest-mock
- Mocking utilitiesTesting Configuration
pyproject.toml
with:test_*.py
and*_test.py
unit
,integration
,slow
Directory Structure
Development Commands
Both of these commands work to run tests:
poetry run test
poetry run tests
Shared Fixtures (conftest.py)
Created comprehensive fixtures for testing Sublime Text plugins:
temp_dir
- Temporary directory managementtemp_file
- Temporary file creationmock_sublime
- Mock sublime module with all constants and methodsmock_sublime_plugin
- Mock sublime_plugin classes (TextCommand, WindowCommand, EventListener)mock_view
- Mock Sublime Text view objectsmock_window
- Mock Sublime Text window objectsmock_settings
- Mock settings with get/set/has/erase functionalitysample_ansi_output
- Sample ANSI colored strings for testingreset_modules
- Auto-cleanup of imported modules between testscapture_stdout
- Stdout capture for testing print statementsUpdated .gitignore
Added comprehensive testing-related entries:
.coverage
,htmlcov/
,coverage.xml
).claude/*
)How to Use
Install dependencies:
Run all tests:
Run specific test types:
View coverage report:
htmlcov/index.html
in a browsercoverage.xml
for CI integrationNotes
poetry.lock
) is tracked in git for reproducible builds