feat: Set up comprehensive Python testing infrastructure #6
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 sets up a comprehensive testing infrastructure for the Extra Image List Blender addon, providing a complete development environment for writing and running tests.
Changes Made
Package Management
pyproject.toml
with Poetry configuration for dependency managementpytest
,pytest-cov
, andpytest-mock
as development dependenciesTesting Configuration
pyproject.toml
including:test_*.py
and*_test.py
filesunit
,integration
, andslow
Coverage Reporting
htmlcov/
), XML (coverage.xml
), and terminal outputDirectory Structure
Shared Fixtures (conftest.py)
temp_dir
andtemp_file
fixtures for test isolationbpy
module and Blender contextsDevelopment Workflow
poetry run pytest
poetry run pytest --cov
poetry run pytest -m "unit"
poetry run pytest -m "not slow"
htmlcov/
Git Integration
Testing Infrastructure Validation
The setup includes a comprehensive validation test suite (
test_setup_validation.py
) that verifies:✅ Basic pytest functionality (assertions, parametrized tests)
✅ All fixtures work correctly (temp files, Blender mocks, test data)
✅ Mocking capabilities (unittest.mock, patches, MagicMock)
✅ Test markers function (unit, integration, slow)
✅ Coverage reporting (branch coverage, exclusions)
✅ Error handling (exception testing, message validation)
✅ Data-driven testing (parametrized test cases)
Test Results: 31 tests pass, demonstrating that all infrastructure components are working correctly.
Usage Instructions
Initial Setup
Coverage Reports
htmlcov/index.html
in browser for detailed coveragecoverage.xml
for CI/CD integrationWriting Tests
tests/unit/
for fast, isolated teststests/integration/
for tests with dependenciesconftest.py
for common test data@pytest.mark.slow
for tests that take significant timeNotes
bpy
module mocking[tool.poetry.group.test]
section🤖 Generated with Claude Code