feat: Set up comprehensive Python testing infrastructure with Poetry #18
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 project using Poetry as the package manager and pytest as the testing framework. The setup provides a solid foundation for writing and running tests with coverage reporting.
Changes Made
Package Management
pyproject.toml
with Poetry configurationrequirements.txt
to Poetrypytest
,pytest-cov
, andpytest-mock
as development dependenciesTesting Configuration
pytest Configuration: Configured pytest in
pyproject.toml
with:test_*.py
,*_test.py
, andtests.py
unit
,integration
, andslow
Coverage Configuration: Set up coverage tracking for all main modules:
brute
,domainsites
,lib
,reverse
, andsearchengine
modules__init__.py
files from coverageDirectory Structure
Shared Fixtures (conftest.py)
Created comprehensive test fixtures including:
temp_dir
andtemp_file
: Temporary file system utilitiesmock_config
: Mock configuration objectmock_requests
: Mock HTTP requestsmock_dns_resolver
: Mock DNS resolutionsample_domain_list
andsample_ip_list
: Test datamock_logger
: Mock logging functionalitymock_file_system
: Mock file operationsenvironment_vars
: Environment variable managementmock_subprocess
: Mock subprocess callscapture_output
: Stdout/stderr capture utilitymock_time
: Time-related mockingAdditional Updates
.gitignore
: Added entries for:.pytest_cache/
,.coverage
,htmlcov/
, etc.)__pycache__/
,*.pyc
, etc.).claude/*
)How to Use
Installing Dependencies
Running Tests
Both of these commands work:
poetry run test poetry run tests
Running Specific Test Categories
Coverage Reports
After running tests, coverage reports are available:
htmlcov/index.html
in a browsercoverage.xml
for CI integrationNotes
argparse
dependency was removed as it's built into Python 3poetry run
prefix to use the virtual environmentNext Steps