feat: set up comprehensive Python testing infrastructure with Poetry#319
Open
llbbl wants to merge 1 commit intojonrau1:masterfrom
Open
feat: set up comprehensive Python testing infrastructure with Poetry#319llbbl wants to merge 1 commit intojonrau1:masterfrom
llbbl wants to merge 1 commit intojonrau1:masterfrom
Conversation
- Migrate from requirements.txt to Poetry for modern dependency management - Configure pytest with coverage, custom markers, and strict settings - Create proper test directory structure (unit/integration) - Add shared fixtures in conftest.py for common test patterns - Update .gitignore with testing and build artifacts - Set up validation tests to verify infrastructure works correctly - Configure 80% coverage threshold with HTML/XML reporting - Add Poetry script commands for running tests
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 Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the ElectricEye project, migrating from basic requirements.txt to Poetry for modern dependency management and setting up pytest with full coverage support.
Changes Made
Package Management
pyproject.tomlwith Poetry configurationrequirements.txtto Poetrypytest(^8.0.0) - Main testing frameworkpytest-cov(^5.0.0) - Coverage reportingpytest-mock(^3.14.0) - Mocking utilitiesblack(^24.0.0) - Code formatting (already in requirements-dev.txt)Testing Configuration
Pytest configuration in
pyproject.toml:test_*.pyand*_test.pyunit,integration,slowCoverage configuration:
eeauditorpackageDirectory Structure
Shared Fixtures (conftest.py)
Created comprehensive fixtures for common testing patterns:
temp_dir- Temporary directory managementmock_config- Mock configuration for cloud providersmock_aws_client/session- AWS service mockingsample_finding- Security Hub finding templatemock_env_vars- Environment variable mockingjson_file/temp_file- File handling helpersmock_cloud_provider- Generic cloud provider mockcapture_logs- Log capture for testingmock_datetime- Date/time mockingAdditional Updates
.pytest_cache/,.coverage,htmlcov/, etc.).claude/*)poetry.lockis NOT ignored (important for reproducible builds)Running Tests
After setting up the environment with Poetry:
Notes
^3.9due to pandas requirementseeauditor/tests/are preserved and can be moved to the new structure as neededtest_setup_validation.pyto verify the testing infrastructure works correctlyNext Steps
tests/unit/tests/integration/eeauditor/tests/can be refactored to use the new fixtures