feat: add comprehensive testing infrastructure with pytest #129
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 Testing Infrastructure
Summary
This PR establishes a complete testing infrastructure for the aws-sso-util project using pytest and Poetry. The setup provides a foundation for writing unit tests, integration tests, and maintaining code coverage standards.
Changes Made
Testing Dependencies
pytest(^7.4.0) - Core testing frameworkpytest-cov(^4.1.0) - Coverage reporting pluginpytest-mock(^3.11.1) - Mocking utilitiesConfiguration
pytest configuration in
pyproject.toml:test_*.pyand*_test.pyfilesunit,integration, andslowCoverage configuration:
aws_sso_utilandaws_sso_lib__init__.py, and vendored codehtmlcov/directoryDirectory Structure
Shared Fixtures
Both
conftest.pyfiles provide common fixtures including:temp_dir- Temporary directory managementmock_aws_config_dir/mock_aws_config- AWS configuration mockingmock_sso_cache_dir/mock_sso_cache- SSO cache mockingmock_boto3_client/mock_boto3_session- AWS API mockingmock_environment- Environment variable mockingsample_yaml_config/sample_sso_token- Test data fixturesmock_click_context- CLI testing utilitiescapture_logs/capture_stdout- Output capture fixturesPoetry Commands
poetry run test- Run all tests with coveragepoetry run tests- Alternative command (both work)Updated Files
.gitignore- Added testing artifacts and Claude directories[tool.poetry.dev-dependencies]to[tool.poetry.group.dev.dependencies]How to Use
Install dependencies:
Run tests:
View coverage report:
# HTML report will be in htmlcov/index.html open htmlcov/index.htmlNext Steps
With this infrastructure in place, developers can now:
Notes
test_setup_validation.py) verify the infrastructure is working correctlypyproject.toml