Ethereum Test Fixtures package¶
Ethereum test fixture format definitions.
BaseFixture
¶
Bases: CamelModel
Represents a base Ethereum test fixture of any type.
Source code in src/ethereum_test_fixtures/base.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
output_base_dir_name()
classmethod
¶
Return name of the subdirectory where this type of fixture should be dumped to.
Source code in src/ethereum_test_fixtures/base.py
65 66 67 68 69 70 71 |
|
__pydantic_init_subclass__(**kwargs)
classmethod
¶
Register all subclasses of BaseFixture with a fixture format name set as possible fixture formats.
Source code in src/ethereum_test_fixtures/base.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
json_dict
cached
property
¶
Returns the JSON representation of the fixture.
hash
cached
property
¶
Returns the hash of the fixture.
json_dict_with_info(hash_only=False)
¶
Return JSON representation of the fixture with the info field.
Source code in src/ethereum_test_fixtures/base.py
120 121 122 123 124 125 126 |
|
fill_info(t8n_version, test_case_description, fixture_source_url, ref_spec, _info_metadata)
¶
Fill the info field for this fixture.
Source code in src/ethereum_test_fixtures/base.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/base.py
148 149 150 |
|
supports_fork(fork)
classmethod
¶
Return whether the fixture can be generated for the given fork.
By default, all fixtures support all forks.
Source code in src/ethereum_test_fixtures/base.py
152 153 154 155 156 157 158 159 |
|
discard_fixture_format_by_marks(fork, markers)
classmethod
¶
Discard a fixture format from filling if the appropriate marker is used.
Source code in src/ethereum_test_fixtures/base.py
161 162 163 164 165 166 167 168 169 170 171 |
|
FixtureFillingPhase
¶
Bases: Enum
Execution phase for fixture generation.
Source code in src/ethereum_test_fixtures/base.py
43 44 45 46 47 |
|
LabeledFixtureFormat
¶
Represents a fixture format with a custom label.
This label will be used in the test id and also will be added as a marker to the generated test case when filling the test.
Source code in src/ethereum_test_fixtures/base.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
__init__(fixture_format, label, description)
¶
Initialize the fixture format with a custom label.
Source code in src/ethereum_test_fixtures/base.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
|
format_name
property
¶
Get the filling format name.
format_phases
property
¶
Get the filling format phases where it should be included.
__eq__(other)
¶
Check if two labeled fixture formats are equal.
If the other object is a FixtureFormat type, the format of the labeled fixture format will be compared with the format of the other object.
Source code in src/ethereum_test_fixtures/base.py
215 216 217 218 219 220 221 222 223 224 225 226 |
|
BlockchainEngineFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine specific test fixture information.
Source code in src/ethereum_test_fixtures/blockchain.py
599 600 601 602 603 604 605 606 607 608 609 |
|
BlockchainEngineFixtureCommon
¶
Bases: BaseFixture
Base blockchain test fixture model for Engine API based execution.
Similar to BlockchainFixtureCommon but excludes the 'pre' field to avoid duplicating large pre-allocations.
Source code in src/ethereum_test_fixtures/blockchain.py
570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 |
|
get_fork()
¶
Return fixture's Fork
.
Source code in src/ethereum_test_fixtures/blockchain.py
585 586 587 |
|
supports_fork(fork)
classmethod
¶
Return whether the fixture can be generated for the given fork.
The Engine API is available only on Paris and afterwards.
Source code in src/ethereum_test_fixtures/blockchain.py
589 590 591 592 593 594 595 596 |
|
BlockchainEngineSyncFixture
¶
Bases: BlockchainEngineFixture
Engine Sync specific test fixture information.
This fixture format is specifically designed for sync testing where: - The client under test receives all payloads - A sync client attempts to sync from the client under test - Both client types are parametrized from hive client config
Source code in src/ethereum_test_fixtures/blockchain.py
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 |
|
discard_fixture_format_by_marks(fork, markers)
classmethod
¶
Discard the fixture format based on the provided markers.
Source code in src/ethereum_test_fixtures/blockchain.py
657 658 659 660 661 662 663 664 665 |
|
BlockchainEngineXFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine X specific test fixture information.
Uses pre-allocation groups (and a single client instance) for efficient test execution without client restarts.
Source code in src/ethereum_test_fixtures/blockchain.py
612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 |
|
pre_hash
instance-attribute
¶
Hash of the pre-allocation group this test belongs to.
post_state_diff = None
class-attribute
instance-attribute
¶
State difference from genesis after test execution (efficiency optimization).
payloads = Field(..., alias='engineNewPayloads')
class-attribute
instance-attribute
¶
Engine API payloads for blockchain execution.
BlockchainFixture
¶
Bases: BlockchainFixtureCommon
Cross-client specific blockchain test model use in JSON fixtures.
Source code in src/ethereum_test_fixtures/blockchain.py
559 560 561 562 563 564 565 566 567 |
|
BlockchainFixtureCommon
¶
Bases: BaseFixture
Base blockchain test fixture model.
Source code in src/ethereum_test_fixtures/blockchain.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
|
config_defaults_for_backwards_compatibility(data)
classmethod
¶
Check if the config field is populated, otherwise use the root-level field values for backwards compatibility.
Source code in src/ethereum_test_fixtures/blockchain.py
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/blockchain.py
554 555 556 |
|
FixtureCollector
dataclass
¶
Collects all fixtures generated by the test cases.
Source code in src/ethereum_test_fixtures/collector.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
get_fixture_basename(info)
¶
Return basename of the fixture file for a given test case.
Source code in src/ethereum_test_fixtures/collector.py
122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
add_fixture(info, fixture)
¶
Add fixture to the list of fixtures of a given test case.
Source code in src/ethereum_test_fixtures/collector.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
dump_fixtures()
¶
Dump all collected fixtures to their respective files.
Source code in src/ethereum_test_fixtures/collector.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
verify_fixture_files(evm_fixture_verification)
¶
Run evm [state|block]test
on each fixture.
Source code in src/ethereum_test_fixtures/collector.py
174 175 176 177 178 179 180 181 182 183 184 185 186 |
|
TestInfo
dataclass
¶
Contains test information from the current node.
Source code in src/ethereum_test_fixtures/collector.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
strip_test_name(name)
classmethod
¶
Remove test prefix from a python test case name.
Source code in src/ethereum_test_fixtures/collector.py
35 36 37 38 39 40 41 42 |
|
get_name_and_parameters()
¶
Convert test name to a tuple containing the test name and test parameters.
Example: test_push0_key_sstore[fork_Shanghai] -> test_push0_key_sstore, fork_Shanghai
Source code in src/ethereum_test_fixtures/collector.py
44 45 46 47 48 49 50 51 52 53 |
|
get_single_test_name(mode='module')
¶
Convert test name to a single test name.
Source code in src/ethereum_test_fixtures/collector.py
55 56 57 58 59 60 61 62 63 64 |
|
get_dump_dir_path(base_dump_dir, filler_path, level='test_parameter')
¶
Path to dump the debug output as defined by the level to dump at.
Source code in src/ethereum_test_fixtures/collector.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
get_id()
¶
Return the test id.
Source code in src/ethereum_test_fixtures/collector.py
86 87 88 |
|
get_module_relative_output_dir(filler_path)
¶
Return a directory name for the provided test_module (relative to the base ./tests directory) that can be used for output (within the configured fixtures output path or the base_dump_dir directory).
Example: tests/shanghai/eip3855_push0/test_push0.py -> shanghai/eip3855_push0/test_push0
Source code in src/ethereum_test_fixtures/collector.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
FixtureConsumer
¶
Bases: ABC
Abstract class for verifying Ethereum test fixtures.
Source code in src/ethereum_test_fixtures/consume.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
can_consume(fixture_format)
¶
Return whether the fixture format is consumable by this consumer.
Source code in src/ethereum_test_fixtures/consume.py
22 23 24 25 26 27 |
|
consume_fixture(fixture_format, fixture_path, fixture_name=None, debug_output_path=None)
abstractmethod
¶
Test the client with the specified fixture using its direct consumer interface.
Source code in src/ethereum_test_fixtures/consume.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
EOFFixture
¶
Bases: BaseFixture
Fixture for a single EOFTest.
Source code in src/ethereum_test_fixtures/eof.py
41 42 43 44 45 46 47 48 49 50 51 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/eof.py
49 50 51 |
|
PreAllocGroup
¶
Bases: CamelModel
Pre-allocation group for tests with identical Environment and fork values.
Groups tests by a hash of their fixture Environment and fork to enable pre-allocation group optimization.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
pre_account_count
property
¶
Return the amount of accounts the pre-allocation group holds.
test_count
property
¶
Return the amount of tests that use this pre-allocation group.
genesis
property
¶
Get the genesis header for this group.
to_file(file)
¶
Save PreAllocGroup to a file.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
PreAllocGroups
¶
Bases: EthereumTestRootModel
Root model mapping pre-allocation group hashes to test groups.
If lazy_load is True, the groups are not loaded from the folder until they are accessed.
Iterating will fail if lazy_load is True.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
__setitem__(key, value)
¶
Set item in root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
102 103 104 105 106 107 |
|
from_folder(folder, *, lazy_load=False)
classmethod
¶
Create PreAllocGroups from a folder of pre-allocation files.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
to_folder(folder)
¶
Save PreAllocGroups to a folder of pre-allocation files.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
129 130 131 132 133 |
|
__getitem__(item)
¶
Get item from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
135 136 137 138 139 140 141 142 143 144 145 |
|
__iter__()
¶
Iterate over root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
147 148 149 |
|
__contains__(item)
¶
Check if item in root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
151 152 153 |
|
__len__()
¶
Get length of root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
155 156 157 |
|
keys()
¶
Get keys from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
159 160 161 |
|
values()
¶
Get values from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
163 164 165 166 167 |
|
items()
¶
Get items from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
169 170 171 172 173 |
|
StateFixture
¶
Bases: BaseFixture
Fixture for a single StateTest.
Source code in src/ethereum_test_fixtures/state.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/state.py
106 107 108 109 110 |
|
TransactionFixture
¶
Bases: BaseFixture
Fixture for a single TransactionTest.
Source code in src/ethereum_test_fixtures/transaction.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
get_fork()
¶
Return the fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/transaction.py
32 33 34 35 36 |
|