-
Notifications
You must be signed in to change notification settings - Fork 182
Commit ed323b0
committed
refactor(tests): use pytest parametrize to reduce code duplication in BloatNet tests
Replace duplicate test functions with parametrized versions to avoid repetitive
code. Each test now accepts a `balance_first` parameter that controls the order
of operations, eliminating the need for separate `_extcodesize_balance`,
`_extcodecopy_balance`, and `_extcodehash_balance` variants.
Changes:
- Add @pytest.mark.parametrize to test_bloatnet_balance_extcodesize,
test_bloatnet_balance_extcodecopy, and test_bloatnet_balance_extcodehash
- Each test now generates two variants via parametrization with descriptive IDs
(e.g., "balance_extcodesize" and "extcodesize_balance")
- Extract operation sequences into variables and conditionally compose them
based on balance_first parameter
- Remove test_bloatnet_extcodesize_balance, test_bloatnet_extcodecopy_balance,
and test_bloatnet_extcodehash_balance (now covered by parametrization)
This reduces the file from 793 lines to 462 lines while maintaining the same
test coverage (6 tests total: 3 test functions × 2 parametrization values).
To run specific parameter variants, use the -k flag:
fill -k "balance_extcodesize" tests/benchmark/bloatnet/test_multi_opcode.py
fill -k "extcodesize_balance" tests/benchmark/bloatnet/test_multi_opcode.py
Co-Authored-By: LouisTsai-Csie
<[email protected]>
Please enter the commit message for your changes. Lines starting1 parent 6b31a95 commit ed323b0Copy full SHA for ed323b0
File tree
Expand file treeCollapse file tree
1 file changed
+68
-393
lines changedFilter options
- tests/benchmark/bloatnet
Expand file treeCollapse file tree
1 file changed
+68
-393
lines changed
0 commit comments