Add comprehensive Python testing infrastructure #30
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 Python Testing Infrastructure
Summary
This PR establishes a comprehensive testing infrastructure for the webhook samples repository, enabling developers to easily write and run tests for all Python components.
Changes Made
Package Management
pyproject.tomlrequirements.txtfiles to Poetry extras:azure: Azure Functions dependenciesslack: Slack bot dependenciesflask: Flask web server dependenciesall: All optional dependenciesTesting Configuration
unit,integration,slowDeveloper/andsample-workflows/Testing Infrastructure
Directory structure:
Comprehensive fixtures in
conftest.py:temp_dir: Temporary directory for test filesmock_config: Mock configuration settingssample_webhook_payload: Sample ArcGIS webhook datamock_azure_function_context/request: Azure Functions mocksmock_flask_app: Flask application mocksmock_requests_session: HTTP requests mocksmock_slack_client: Slack client mocksmock_environment_variables: Test environment setupjson_file: JSON file creation helpermock_hash_validator: Webhook security validation mocksDevelopment Dependencies
pytest ^7.4.0: Main testing frameworkpytest-cov ^4.1.0: Coverage reportingpytest-mock ^3.11.1: Enhanced mocking utilitiesAdditional Setup
Usage Instructions
Installing Dependencies
Running Tests
Coverage Reports
htmlcov/index.htmlcoverage.xmlfor CI/CD integrationValidation
The infrastructure includes comprehensive validation tests (
tests/test_infrastructure_validation.py) that verify:Test Results: All 16 validation tests pass successfully.
Notes
Next Steps
Developers can now: