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 |
|
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 |
|
__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
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 |
|
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
117 118 119 120 121 122 123 |
|
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
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/base.py
145 146 147 |
|
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
149 150 151 152 153 154 155 156 |
|
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
158 159 160 161 162 163 164 165 |
|
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
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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
|
__init__(fixture_format, label, description)
¶
Initialize the fixture format with a custom label.
Source code in src/ethereum_test_fixtures/base.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
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
209 210 211 212 213 214 215 216 217 218 219 220 |
|
BlockchainEngineFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine specific test fixture information.
Source code in src/ethereum_test_fixtures/blockchain.py
556 557 558 559 560 561 562 563 564 565 566 |
|
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
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 |
|
get_fork()
¶
Return fixture's Fork
.
Source code in src/ethereum_test_fixtures/blockchain.py
542 543 544 |
|
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
546 547 548 549 550 551 552 553 |
|
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
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 |
|
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
611 612 613 614 615 616 617 618 619 |
|
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
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 |
|
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
517 518 519 520 521 522 523 524 525 |
|
BlockchainFixtureCommon
¶
Bases: BaseFixture
Base blockchain test fixture model.
Source code in src/ethereum_test_fixtures/blockchain.py
483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
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
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/blockchain.py
512 513 514 |
|
FixtureCollector
dataclass
¶
Collects all fixtures generated by the test cases.
Source code in src/ethereum_test_fixtures/collector.py
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 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 |
|
get_fixture_basename(info)
¶
Return basename of the fixture file for a given test case.
Source code in src/ethereum_test_fixtures/collector.py
121 122 123 124 125 126 127 128 129 130 131 132 |
|
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
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
|
dump_fixtures()
¶
Dump all collected fixtures to their respective files.
Source code in src/ethereum_test_fixtures/collector.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
verify_fixture_files(evm_fixture_verification)
¶
Run evm [state|block]test
on each fixture.
Source code in src/ethereum_test_fixtures/collector.py
171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
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 |
|
strip_test_name(name)
classmethod
¶
Remove test prefix from a python test case name.
Source code in src/ethereum_test_fixtures/collector.py
33 34 35 36 37 38 39 40 |
|
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
42 43 44 45 46 47 48 49 50 51 |
|
get_single_test_name(mode='module')
¶
Convert test name to a single test name.
Source code in src/ethereum_test_fixtures/collector.py
53 54 55 56 57 58 59 60 61 62 |
|
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
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
get_id()
¶
Return the test id.
Source code in src/ethereum_test_fixtures/collector.py
84 85 86 |
|
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
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
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 |
|
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 |
|
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 |
|
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
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 |
|
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
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 |
|
__setitem__(key, value)
¶
Set item in root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
99 100 101 102 103 104 |
|
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
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
|
to_folder(folder)
¶
Save PreAllocGroups to a folder of pre-allocation files.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
126 127 128 129 130 |
|
__getitem__(item)
¶
Get item from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
132 133 134 135 136 137 138 139 140 141 142 |
|
__iter__()
¶
Iterate over root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
144 145 146 |
|
__contains__(item)
¶
Check if item in root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
148 149 150 |
|
__len__()
¶
Get length of root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
152 153 154 |
|
keys()
¶
Get keys from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
156 157 158 |
|
values()
¶
Get values from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
160 161 162 163 164 |
|
items()
¶
Get items from root dict.
Source code in src/ethereum_test_fixtures/pre_alloc_groups.py
166 167 168 169 170 |
|
StateFixture
¶
Bases: BaseFixture
Fixture for a single StateTest.
Source code in src/ethereum_test_fixtures/state.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/state.py
104 105 106 107 108 |
|
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 |
|