feat: Add comprehensive Python testing infrastructure with Poetry #15
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.
Add Comprehensive Python Testing Infrastructure
Summary
This PR establishes a complete testing infrastructure for the Hadoop JMX Exporter project, providing a solid foundation for writing and running tests.
Changes Made
Package Management
requirements.txt
topyproject.toml
poetry.lock
file for reproducible dependency managementTesting Framework
pytest-cov
for coverage reportingpytest-mock
for enhanced mocking capabilitiespyproject.toml
:unit
,integration
,slow
Project Structure
Shared Testing Utilities
conftest.py
:temp_dir
: Temporary directory managementmock_requests_response
: HTTP response mockingsample_jmx_response
: Sample JMX data for testingmock_prometheus_registry
: Prometheus registry mockingsample_config
: Configuration data for testsmock_yaml_config
: YAML configuration file creationreset_prometheus_registry
: Auto-cleanup for Prometheus metricsCoverage Configuration
htmlcov/
directoryDevelopment Environment
.gitignore
with comprehensive exclusions:.pytest_cache
, coverage reports)How to Run Tests
Install Dependencies
Run All Tests
Run Tests by Category
Generate Coverage Reports
Validation
The setup includes infrastructure validation tests (
test_infrastructure.py
) that verify:Next Steps
With this testing infrastructure in place, developers can now:
tests/unit/
)tests/integration/
)The infrastructure is designed to grow with the project while maintaining consistency and best practices.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com