feat: add parametrized test expansion support#73
Open
ronald-braunstein wants to merge 3 commits intohughhan1:mainfrom
Open
feat: add parametrized test expansion support#73ronald-braunstein wants to merge 3 commits intohughhan1:mainfrom
ronald-braunstein wants to merge 3 commits intohughhan1:mainfrom
Conversation
Implement full expansion of @pytest.mark.parametrize decorators during test collection to match pytest's behavior. This resolves the known limitation documented in the README where rtest only collected base function names. Changes: - Parse pytest.mark.parametrize decorators from function AST - Extract parameter names and values from decorator arguments - Generate all parameter combinations for stacked decorators - Support for simple params, multiple params, and cartesian products - Handle various Python literal types (int, float, string, bool, None, etc.) - Works for both module-level functions and class methods - Compatible with test class inheritance Test expansion now matches pytest exactly: test_example[1] test_example[2] test_example[3] Previously showed only: test_example 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ection
- Add ParamValue::AttributeAccess variant to mark attribute access expressions as uncertain
- Add has_uncertain_params field to TestInfo, TestMethodInfo, and Function structs
- Mark files as uncertain when parametrize values contain:
- Attribute accesses (Enum.VALUE, Class.CONSTANT)
- Function calls (Decimal("1"), func())
- Complex expressions (tuples, lists, dicts)
- Strings with special characters (newlines, tabs, non-ASCII)
- Update collection_integration to use has_uncertain_params() for uncertainty detection
- Add --emit-uncertain-files flag to output list of uncertain files
- Add --all-parametrized-uncertain flag to mark ALL parametrized files as uncertain
Results:
- Hybrid WITH flag: 4.0x faster (100% accurate)
- Hybrid WITHOUT flag: 4.7x faster (99.76% accurate, 66 edge case tests)
- Native rtest: 24.1x faster
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
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 full expansion of @pytest.mark.parametrize decorators during test collection to match pytest's behavior. This resolves the known limitation documented in the README where rtest only collected base function names.
Changes:
Test expansion now matches pytest exactly:
test_example[1] test_example[2] test_example[3]
Previously showed only: test_example
🤖 Generated with Claude Code