feat: Add comprehensive Python testing infrastructure with Poetry #73
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 complete testing infrastructure for the All Autocomplete Sublime Text plugin using Poetry as the package manager and pytest as the testing framework.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtorsetup.pyfiles were foundTesting Dependencies
Added as development dependencies:
pytest ^8.0.0- Core testing frameworkpytest-cov ^5.0.0- Coverage reportingpytest-mock ^3.14.0- Mocking utilitiesTesting Configuration
Configured in
pyproject.toml:pytest settings:
test_*.pyand*_test.pyunit,integration,slowcoverage settings:
all_views_completions.pyDirectory Structure
Test Fixtures
Created comprehensive fixtures in
conftest.py:mock_sublime- Mocks the sublime modulemock_sublime_plugin- Mocks the sublime_plugin moduletemp_dir- Temporary directory for test filesmock_settings- Mock Sublime Text settingsmock_view- Mock Sublime Text view objectmock_window- Mock Sublime Text window objectsample_completions- Sample completion dataplugin_settings_file- Temporary settings filemock_region- Mock Region objectreset_modules- Auto-cleanup fixtureDevelopment Commands
Configured Poetry scripts:
poetry run test- Run all testspoetry run tests- Alternative command (both work)Additional Setup
.gitignorewith:__pycache__/,*.pyc, etc.).pytest_cache/,.coverage,htmlcov/,coverage.xml).claude/*)poetry.lockis not ignored (should be committed)How to Use
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -Install dependencies:
Run tests:
View coverage reports:
htmlcov/index.htmlin browsercoverage.xmlfor CI integrationValidation
The infrastructure has been validated with:
testandtestscommands workingNotes
tests/unit/test_example.pydemonstrates how to properly mock Sublime Text APIs