feat: Set up Python testing infrastructure with Poetry #16
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 ReconAIzer project using Poetry as the package manager and pytest as the testing framework. The setup provides everything needed for developers to immediately start writing and running tests.
Changes Made
Package Management
pyproject.tomlconfigurationreconaizerpackage directory and moved existing codeTesting Dependencies
Added the following development dependencies:
pytest(^7.4.0) - Main testing frameworkpytest-cov(^4.1.0) - Coverage reportingpytest-mock(^3.11.1) - Mocking utilitiesTesting Configuration
Configured in
pyproject.toml:tests/directoryreconaizerpackageunit,integration, andslowmarkersDirectory Structure
Shared Fixtures (conftest.py)
Created comprehensive fixtures for common testing needs:
temp_dir- Temporary directory managementmock_config- Mock configuration objectsmock_api_client- Mock API clientsample_request_data- Sample HTTP request datasample_response_data- Sample HTTP response datamock_burp_callbacks- Mock Burp Suite callbacksmock_file_system- File system operation mockingcapture_logs- Log capture utilityDevelopment Commands
Set up Poetry scripts for running tests:
Both commands support all standard pytest options.
Additional Files
.gitignore: Updated with comprehensive Python, testing, and IDE-related entriestest_setup_validation.pyto verify the infrastructure setupHow to Use
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 -Install Dependencies:
Run Tests:
Run Tests with Specific Markers:
View Coverage Reports:
htmlcov/index.htmlin a browsercoverage.xmlfor CI integrationNext Steps
With this infrastructure in place, developers can now:
tests/unit/tests/integration/Notes
reconaizerpackage for better organization