feat: Add comprehensive Python testing infrastructure #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.
Python Testing Infrastructure Setup
Summary
This PR establishes a complete testing infrastructure for the Python project, providing all the necessary tools and configuration for developers to immediately start writing and running tests.
Changes Made
Package Management
pyproject.tomlrequirements.txtto Poetry (seepyproject_full.tomlfor full dependency list)Testing Configuration
pytest Configuration:
test_*.pyand*_test.pyfilesCoverage Settings:
Custom Markers:
unit: For isolated component testsintegration: For multi-component testsslow: For long-running tests (can be excluded with-m "not slow")Directory Structure
Test Fixtures (conftest.py)
Comprehensive fixtures for common testing needs:
temp_dir,temp_file,sample_html_filetest_config,env_varsmock_database,mock_elasticsearch,mock_tor_sessionsample_onion_data,sample_bitcoin_addresses,sample_email_addressesmock_port_scanner,mock_whatweb_outputassert_helpers,benchmark_timer,frozen_timeDevelopment Commands
poetry run test- Run all testspoetry run tests- Alternative command (both work)-v,-k,-m).gitignore Updates
Added entries for:
.pytest_cache/,.coverage,htmlcov/,coverage.xml).claude/*)How to Use
Installation
Running Tests
Writing New Tests
tests/unit/ortests/integration/conftest.pyfor common needs@pytest.mark.unit,@pytest.mark.integration,@pytest.mark.slow)test_*.pyfor test files,test_*for test functionsValidation
The infrastructure has been validated with 13 passing tests that verify:
Next Steps
requirements.txtto Poetry (usepyproject_full.tomlas reference)Notes
pyproject.toml