Add YAML set operations to config-utils#5
Merged
Conversation
Implement five set operation commands for comparing YAML files: - union: All keys/values present in either file - intersect: Only keys/values present in both files - diff: Keys/values in file1 but not in file2 - rdiff: Keys/values in file2 but not in file1 - symdiff: Keys/values in either file but not both Features: - Two comparison modes: keys (ignore values) or kv (compare key-value pairs) - Depth control: 1 (root only), 2+ (nested levels), 0 (unlimited) - Comprehensive error handling for missing files, invalid YAML, non-dict roots - All operations output valid YAML to stdout - Exit code 0 on success, 1 on error Updated version to 0.2.0 and added extensive documentation with examples.
Created a full test suite covering all YAML set operations functionality: Test Coverage: - 37 tests total, all passing with 75% code coverage - All 5 set operations: union, intersect, diff, rdiff, symdiff - Both comparison modes: keys and kv (key-value) - All depth levels: 0 (unlimited), 1 (root only), 2+ (nested) - Error handling: missing files, invalid YAML, non-dict roots - Edge cases: empty files, identical files, no matches - Helper functions: flatten_dict, unflatten_dict, make_hashable, etc. Test Organization: - tests/__init__.py: Test package initialization - tests/test_set_operations.py: Comprehensive test suite with 10 test classes Infrastructure: - Added pytest and pytest-cov as dev dependencies - Configured pytest in pyproject.toml with coverage settings - Updated README.md with testing instructions and examples - Uses temporary files for test fixtures to avoid pollution All tests verified passing with `python -m pytest -v --cov=cli`
Changed the workflow from testing only locust-compare to testing all tools in the repository using a matrix strategy. Changes: - Added matrix strategy with all tools: locust-compare, config-utils - Set fail-fast: false to ensure all tools are tested even if one fails - Updated step names to be dynamic based on matrix.tool - Both tools now run tests in parallel as separate jobs This ensures comprehensive testing across the entire repository.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Implement five set operation commands for comparing YAML files:
Features:
Updated version to 0.2.0 and added extensive documentation with examples.