feat: Set up comprehensive Python testing infrastructure with Poetry #34
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 Comprehensive Python Testing Infrastructure
Summary
This PR sets up a complete testing infrastructure for the JARVIS Voice Assistant project using Poetry as the package manager and pytest as the testing framework. The infrastructure provides everything needed for developers to immediately start writing and running tests.
Changes Made
Package Management
pyproject.tomlwith full Poetry setuprequirements.txtandsetup.pyto PoetryTesting Configuration
pytest Configuration:
test_*.pyand*_test.pyfilesunit,integration,slowCoverage Configuration:
htmlcov/), XML (coverage.xml)Directory Structure
Shared Fixtures (conftest.py)
temp_dir: Creates temporary directories for test isolationtemp_file: Creates temporary files with contentmock_config: Provides mock configuration dictionariesmock_env_vars: Sets up mock environment variablesmock_api_response: Mock API response structuresmock_audio_data: Mock audio data for testingmock_llm_client,mock_tts_client,mock_stt_client: Mock service clientscapture_logs: Captures log messages during testsmock_file_system: Creates mock file system structuresperformance_timer: Measures test execution timeRunning Tests
Basic Commands
Using the Test Script
Validation
The infrastructure has been validated with 17 passing tests that verify:
Notes
[tool.coverage.run]source to include your application code when ready.Next Steps
Install system dependencies for PyAudio if audio functionality is needed:
Update coverage configuration to include source code:
Start writing tests in the
tests/unit/andtests/integration/directoriesConsider adding pre-commit hooks to run tests automatically
Testing the Setup
To verify everything is working correctly: