ReconAIzer
ReconAIzer copied to clipboard
feat: Set up Python testing infrastructure with Poetry
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
- Poetry Setup: Initialized Poetry as the package manager with
pyproject.tomlconfiguration - Python Version: Set to support Python 3.8+
- Package Structure: Created
reconaizerpackage directory and moved existing code
Testing Dependencies
Added the following development dependencies:
pytest(^7.4.0) - Main testing frameworkpytest-cov(^4.1.0) - Coverage reportingpytest-mock(^3.11.1) - Mocking utilities
Testing Configuration
Configured in pyproject.toml:
- Test Discovery: Configured to find tests in
tests/directory - Coverage Settings:
- Source tracking for
reconaizerpackage - HTML and XML report generation
- Coverage threshold set to 0% (to be increased as tests are added)
- Source tracking for
- Test Markers: Added
unit,integration, andslowmarkers - Strict Options: Enabled strict markers and configuration
Directory Structure
tests/
├── __init__.py
├── conftest.py # Shared fixtures
├── test_setup_validation.py # Infrastructure validation
├── unit/
│ └── __init__.py
└── integration/
└── __init__.py
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 utility
Development Commands
Set up Poetry scripts for running tests:
poetry run test # Run all tests
poetry run tests # Alternative command
Both commands support all standard pytest options.
Additional Files
.gitignore: Updated with comprehensive Python, testing, and IDE-related entries- Validation Tests: Created
test_setup_validation.pyto verify the infrastructure setup
How to Use
-
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 - -
Install Dependencies:
poetry install -
Run Tests:
poetry run test # or poetry run tests -
Run Tests with Specific Markers:
poetry run test -m unit poetry run test -m integration poetry run test -m "not slow" -
View Coverage Reports:
- Terminal: Automatically shown after test runs
- HTML: Open
htmlcov/index.htmlin a browser - XML: Available at
coverage.xmlfor CI integration
Next Steps
With this infrastructure in place, developers can now:
- Write unit tests in
tests/unit/ - Write integration tests in
tests/integration/ - Use the provided fixtures for common testing scenarios
- Gradually increase the coverage threshold as tests are added
Notes
- The coverage threshold is currently set to 0% to allow the infrastructure to be merged without requiring immediate test coverage
- The original Burp extension code has been moved to the
reconaizerpackage for better organization - Lock files (poetry.lock) should be committed to ensure reproducible builds