feat: Set up comprehensive Python testing infrastructure#45
Open
llbbl wants to merge 1 commit intokcubeterm:masterfrom
Open
feat: Set up comprehensive Python testing infrastructure#45llbbl wants to merge 1 commit intokcubeterm:masterfrom
llbbl wants to merge 1 commit intokcubeterm:masterfrom
Conversation
- Migrate from setup.py to Poetry with complete pyproject.toml configuration - Add pytest, pytest-cov, and pytest-mock as development dependencies - Create testing directory structure with unit/ and integration/ subdirectories - Configure pytest with 80% coverage threshold, HTML/XML reports, and custom markers - Create comprehensive conftest.py with reusable fixtures for testing - Add validation tests to ensure infrastructure works correctly - Update .gitignore with testing-related entries and IDE/environment exclusions - Fix package imports to use relative imports for proper module resolution - Establish ready-to-use testing environment for immediate development use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 comprehensive Python testing infrastructure
Summary
This PR establishes a complete testing infrastructure for the achoz project, migrating from the old setup.py based configuration to a modern Poetry-based development environment with comprehensive testing capabilities.
Changes Made
Package Management Migration
pyproject.tomlwith all project metadataTesting Infrastructure
tests/unit/andtests/integration/)conftest.pywith reusable testing utilitiesunit,integration, andslowtest markers for test categorizationConfiguration Details
Code Quality Improvements
Development Environment
.gitignorewith testing artifacts, IDE files, and environment exclusionsTesting Infrastructure Components
Core Testing Dependencies
Available Fixtures
temp_dir- Temporary directory for file operationstemp_file- Pre-created temporary file for testingmock_config- Mock configuration dictionarymock_global_vars- Mocked global variables with automatic cleanupmock_meilisearch_client- Mock MeiliSearch client for testingsample_documents- Sample document data for indexing testssample_test_files- Pre-created test files with various extensionsmock_logger- Mock logger to suppress output during testsclean_environment- Environment variable isolationmock_requests- Mock HTTP requests libraryTest Markers
@pytest.mark.unit- Unit tests@pytest.mark.integration- Integration tests@pytest.mark.slow- Slow-running testsHow to Run Tests
Install Dependencies
Run All Tests
Run with Coverage Report
Run Specific Test Categories
Coverage Reports
htmlcov/directorycoverage.xmlfor CI/CD integrationValidation
The infrastructure includes comprehensive validation tests that verify:
Current validation status: ✅ 18 passed, 1 skipped (OpenCV dependency optional)
Notes for Developers
Writing Tests
tests/unit/tests/integration/conftest.py@pytest.mark.unit,@pytest.mark.integration, etc.Development Workflow
poetry run pytestpoetry run pytest --cov-report=htmlDependencies Management
poetry.lock) is tracked in gitpoetry add <package>for production dependenciespoetry add --group dev <package>for development dependenciespoetry installto set up environment from scratchThis testing infrastructure provides a solid foundation for maintaining code quality and enabling confident development and refactoring of the achoz codebase.