Skip to content

Commit abd7612

Browse files
danceratopzkclowesmarioevz
authored
refactor(testing): improve layout and naming of testing packages (#1654)
* chore(tests): create top-level package; rename subpackages * chore(tests): add top-level ini file * chore(tests): update packages and paths in pyproject.toml * chore(tests): update plugin paths used in top-level conftests * refactor(tests): update imports for base_types, exceptions and vm * refactor(tests): update imports for specs, fixtures and forks * refactor(tests): update imports for tools, types and execution * refactor(tests): update config, client and remaining imports * refactor(tests): update string path and package references * refactor(tests): fix remaining imports for mypy * chore(tests): ignore type for `TransactionGeneric`'s `chain_id` default * chore(tests): single py.typed at top package level; add stubs to config * chore(tests): ruff format * refactor(tests): update pytest ini files to reflect package renames * refactor(tests): update imports for base_types/exceptions/vm in tests * refactor(tests): update imports for tools/types/execution in tests * refactor(tests): update remaining imports in ./tests/ * chore(tests): ruff format tests * chore(tests): organize formats * chore(tests): execution_spec_tests -> eest * chore(tests): Appease ruff * chore(tests): Fix tests imports * chore(tests): Remove some warnings * refactor(packages/tests): Refactor eest.tools and package exports * refactor(tests): Refactor eest.tools imports * refactor(packages): Rename `packages/tests` -> `packages/testing` * fix(gitignore): Fix `fixtures` ignore * refactor(packages): Rename module `eest` -> `execution_testing` * refactor(packages): Rename package `eest` -> `execution-testing` * fix(testing): update paths used by the jinja2 template loader * fix(testing): fix location of `env.yaml` * chore(testing): rename simulator prefix from eest to eels For consistency with the Hive simulator naming, cf ethereum/hive#1362. * chore(testing): rename package to ethereum-execution-testing * refactor(testing): ethereum_test_cli -> cli * fix(testing): remove unimported `vm` from `__all__` It's not imported in the top-level init.py file; doing an `import vm from ..` will cause an attribute error. This keeps things inline with other sub-packages. * chore(testing): update `eof.py` docstrings to use `execution_testing.*` Update docstring references from `ethereum_test_*` to `execution_testing.*` for consistency with the package rename. * fix(testing): update docstrings to use `execution_testing.*` (specs) Update module references from `ethereum_test_*` to `execution_testing.*` in test docstrings and imports. Also fixes import in skipped checklist test for when it's re-enabled. * fix(testing): remove `eels_resolutions.json` from package data * feat(testing): add `Op` as ergonomic alias for `Opcodes` Export `Op` from `execution_testing` package root to simplify imports. Users can now write `from execution_testing import Op` instead of `from execution_testing import Opcodes as Op`. * refactor(testing): Usages of Opcodes * fix(uv.lock): `ethereum-execution-testing` * fix(testing): Fix consume commands --------- Co-authored-by: kclowes <[email protected]> Co-authored-by: Mario Vega <[email protected]>
1 parent 0477966 commit abd7612

File tree

672 files changed

+2241
-1779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

672 files changed

+2241
-1779
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ tests/execution-spec-generated-tests
7575
tests/fixtures
7676
tests/t8n_testdata
7777

78-
fixtures
78+
fixtures/
7979

8080
logs/
8181
*.log
82+
83+
# config (output of `uv run make env`)
84+
env.yaml

packages/tests/pyproject.toml renamed to packages/testing/pyproject.toml

Lines changed: 40 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ requires = [
66
build-backend = "setuptools.build_meta"
77

88
[project]
9-
name = "ethereum-execution-tests"
9+
name = "ethereum-execution-testing"
1010
version = "1.0.0"
11-
description = "Ethereum execution client test authoring framework"
11+
description = "Ethereum execution layer client test generation and runner framework"
1212
readme = "README.md"
1313
requires-python = ">=3.11"
1414
license = "MIT"
@@ -89,42 +89,41 @@ docs = [
8989
]
9090

9191
[project.scripts]
92-
fill = "cli.pytest_commands.fill:fill"
93-
phil = "cli.pytest_commands.fill:phil"
94-
execute = "cli.pytest_commands.execute:execute"
95-
attac = "cli.pytest_commands.execute:execute"
96-
checkfixtures = "cli.check_fixtures:check_fixtures"
97-
check_eip_versions = "cli.pytest_commands.check_eip_versions:check_eip_versions"
98-
consume = "cli.pytest_commands.consume:consume"
99-
protec = "cli.pytest_commands.consume:consume"
100-
checklist = "cli.pytest_commands.checklist:checklist"
101-
generate_checklist_stubs = "cli.generate_checklist_stubs:generate_checklist_stubs"
102-
genindex = "cli.gen_index:generate_fixtures_index_cli"
103-
gentest = "cli.gentest:generate"
104-
eofwrap = "cli.eofwrap:eof_wrap"
105-
pyspelling_soft_fail = "cli.tox_helpers:pyspelling"
106-
markdownlintcli2_soft_fail = "cli.tox_helpers:markdownlint"
107-
order_fixtures = "cli.order_fixtures:order_fixtures"
108-
evm_bytes = "cli.evm_bytes:evm_bytes"
109-
hasher = "cli.hasher:main"
110-
eest = "cli.eest.cli:eest"
111-
fillerconvert = "cli.fillerconvert.fillerconvert:main"
112-
groupstats = "cli.show_pre_alloc_group_stats:main"
113-
extract_config = "cli.extract_config:extract_config"
114-
compare_fixtures = "cli.compare_fixtures:main"
115-
modify_static_test_gas_limits = "cli.modify_static_test_gas_limits:main"
92+
fill = "execution_testing.cli.pytest_commands.fill:fill"
93+
phil = "execution_testing.cli.pytest_commands.fill:phil"
94+
execute = "execution_testing.cli.pytest_commands.execute:execute"
95+
attac = "execution_testing.cli.pytest_commands.execute:execute"
96+
checkfixtures = "execution_testing.cli.check_fixtures:check_fixtures"
97+
check_eip_versions = "execution_testing.cli.pytest_commands.check_eip_versions:check_eip_versions"
98+
consume = "execution_testing.cli.pytest_commands.consume:consume"
99+
protec = "execution_testing.cli.pytest_commands.consume:consume"
100+
checklist = "execution_testing.cli.pytest_commands.checklist:checklist"
101+
generate_checklist_stubs = "execution_testing.cli.generate_checklist_stubs:generate_checklist_stubs"
102+
genindex = "execution_testing.cli.gen_index:generate_fixtures_index_cli"
103+
gentest = "execution_testing.cli.gentest:generate"
104+
eofwrap = "execution_testing.cli.eofwrap:eof_wrap"
105+
pyspelling_soft_fail = "execution_testing.cli.tox_helpers:pyspelling"
106+
markdownlintcli2_soft_fail = "execution_testing.cli.tox_helpers:markdownlint"
107+
order_fixtures = "execution_testing.cli.order_fixtures:order_fixtures"
108+
evm_bytes = "execution_testing.cli.evm_bytes:evm_bytes"
109+
hasher = "execution_testing.cli.hasher:main"
110+
eest = "execution_testing.cli.eest.cli:eest"
111+
fillerconvert = "execution_testing.cli.fillerconvert.fillerconvert:main"
112+
groupstats = "execution_testing.cli.show_pre_alloc_group_stats:main"
113+
extract_config = "execution_testing.cli.extract_config:extract_config"
114+
compare_fixtures = "execution_testing.cli.compare_fixtures:main"
115+
modify_static_test_gas_limits = "execution_testing.cli.modify_static_test_gas_limits:main"
116116

117117
[tool.setuptools.packages.find]
118118
where = ["src"]
119119
exclude = ["*tests*"]
120120

121121
[tool.setuptools.package-data]
122-
ethereum_test_forks = ["forks/contracts/*.bin"]
123-
"pytest_plugins.execute" = ["eth_config/networks.yml"]
124-
"pytest_plugins" = ["eels_resolutions.json"]
125-
"cli.eest.make" = ["templates/*.j2"]
126-
"cli.pytest_commands" = ["pytest_ini_files/*.ini"]
127-
"ethereum_test_types" = ["kzg_trusted_setup.txt"]
122+
"execution_testing.forks" = ["forks/contracts/*.bin"]
123+
"execution_testing.cli.pytest_commands.plugins.execute" = ["eth_config/networks.yml"]
124+
"execution_testing.cli.eest.make" = ["templates/*.j2"]
125+
"execution_testing.cli.pytest_commands" = ["pytest_ini_files/*.ini"]
126+
"execution_testing.test_types" = ["kzg_trusted_setup.txt"]
128127

129128
[tool.ruff]
130129
line-length = 79
@@ -145,9 +144,15 @@ testpaths = [
145144
]
146145
addopts = [
147146
"-p", "pytester",
148-
"--ignore=src/pytest_plugins/consume/test_cache.py",
149-
"--ignore=src/pytest_plugins/consume/direct/",
150-
"--ignore=src/pytest_plugins/consume/simulators/",
147+
"--ignore=src/execution_testing/cli/pytest_commands/plugins/consume/test_cache.py",
148+
"--ignore=src/execution_testing/cli/pytest_commands/plugins/consume/direct/",
149+
"--ignore=src/execution_testing/cli/pytest_commands/plugins/consume/simulators/",
150+
]
151+
markers = [
152+
"pre_alloc_group: Custom marker for pre-allocation grouping",
153+
"some_mark: Test marker for parametrizer tests",
154+
"eip_checklist: Custom marker for EIP checklist tests",
155+
"slow: Marks tests as slow running",
151156
]
152157

153158
[tool.uv]

packages/tests/src/conftest.py renamed to packages/testing/src/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
from ethereum_clis import (
8+
from execution_testing.client_clis import (
99
BesuTransitionTool,
1010
ExecutionSpecsTransitionTool,
1111
TransitionTool,

packages/tests/src/ethereum_test_tools/__init__.py renamed to packages/testing/src/execution_testing/__init__.py

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
"""
2-
Module containing tools for generating cross-client Ethereum execution layer
3-
tests.
4-
"""
1+
"""Framework to generate cross-client Ethereum execution layer tests."""
52

6-
from ethereum_test_base_types import (
3+
from .base_types import (
74
AccessList,
85
Account,
96
Address,
@@ -15,52 +12,57 @@
1512
TestPrivateKey,
1613
TestPrivateKey2,
1714
)
18-
from ethereum_test_base_types.reference_spec import (
15+
from .base_types.reference_spec import (
1916
ReferenceSpec,
2017
ReferenceSpecTypes,
2118
)
22-
from ethereum_test_benchmark import (
19+
from .benchmark import (
2320
BenchmarkCodeGenerator,
2421
ExtCallGenerator,
2522
JumpLoopGenerator,
2623
)
27-
from ethereum_test_exceptions import (
24+
from .checklists import EIPChecklist
25+
from .exceptions import (
2826
BlockException,
2927
EngineAPIError,
3028
EOFException,
3129
TransactionException,
3230
)
33-
from ethereum_test_fixtures import BaseFixture, FixtureCollector
34-
from ethereum_test_specs import (
31+
from .fixtures import BaseFixture, FixtureCollector
32+
from .forks import Fork, GasCosts
33+
from .specs import (
3534
BaseTest,
3635
BenchmarkTest,
3736
BenchmarkTestFiller,
3837
BlobsTest,
3938
BlobsTestFiller,
39+
Block,
4040
BlockchainTest,
4141
BlockchainTestFiller,
4242
EOFStateTest,
4343
EOFStateTestFiller,
4444
EOFTest,
4545
EOFTestFiller,
46+
Header,
4647
StateTest,
4748
StateTestFiller,
4849
TransactionTest,
4950
TransactionTestFiller,
5051
)
51-
from ethereum_test_specs.blockchain import Block, Header
52-
from ethereum_test_types import (
52+
from .test_types import (
5353
EOA,
5454
Alloc,
5555
AuthorizationTuple,
5656
BalAccountChange,
57+
BalAccountExpectation,
5758
BalBalanceChange,
5859
BalCodeChange,
5960
BalNonceChange,
6061
BalStorageChange,
6162
BalStorageSlot,
6263
Blob,
6364
BlockAccessList,
65+
BlockAccessListExpectation,
6466
ChainConfig,
6567
ConsolidationRequest,
6668
DepositRequest,
@@ -69,8 +71,10 @@
6971
Removable,
7072
Requests,
7173
TestParameterGroup,
74+
TestPhaseManager,
7275
Transaction,
7376
TransactionReceipt,
77+
TransactionType,
7478
Withdrawal,
7579
WithdrawalRequest,
7680
add_kzg_version,
@@ -80,42 +84,42 @@
8084
compute_eofcreate_address,
8185
keccak256,
8286
)
83-
from ethereum_test_vm import (
87+
from .tools import (
88+
CalldataCase,
89+
Case,
90+
CodeGasMeasure,
91+
Conditional,
92+
DeploymentTestType,
93+
Initcode,
94+
ParameterSet,
95+
Switch,
96+
While,
97+
extend_with_defaults,
98+
generate_system_contract_deploy_test,
99+
generate_system_contract_error_test,
100+
)
101+
from .vm import (
84102
Bytecode,
85103
EVMCodeType,
86104
Macro,
87105
Macros,
88106
MemoryVariable,
107+
Op,
89108
Opcode,
90109
OpcodeCallArg,
91110
Opcodes,
92111
UndefinedOpcodes,
93112
call_return_code,
94113
)
95114

96-
from .tools_code import (
97-
CalldataCase,
98-
Case,
99-
CodeGasMeasure,
100-
Conditional,
101-
Initcode,
102-
Switch,
103-
While,
104-
)
105-
from .utility.generators import (
106-
DeploymentTestType,
107-
generate_system_contract_deploy_test,
108-
generate_system_contract_error_test,
109-
)
110-
from .utility.pytest import extend_with_defaults
111-
112115
__all__ = (
113116
"AccessList",
114117
"Account",
115118
"Address",
116119
"Alloc",
117120
"AuthorizationTuple",
118121
"BalAccountChange",
122+
"BalAccountExpectation",
119123
"BalBalanceChange",
120124
"BalCodeChange",
121125
"BalNonceChange",
@@ -127,10 +131,11 @@
127131
"BenchmarkTest",
128132
"BenchmarkTestFiller",
129133
"Blob",
130-
"BlockAccessList",
131134
"BlobsTest",
132135
"BlobsTestFiller",
133136
"Block",
137+
"BlockAccessList",
138+
"BlockAccessListExpectation",
134139
"BlockchainTest",
135140
"BlockchainTestFiller",
136141
"BlockException",
@@ -145,6 +150,7 @@
145150
"ExtCallGenerator",
146151
"DeploymentTestType",
147152
"DepositRequest",
153+
"EIPChecklist",
148154
"EngineAPIError",
149155
"Environment",
150156
"EOA",
@@ -155,6 +161,8 @@
155161
"EOFTestFiller",
156162
"EVMCodeType",
157163
"FixtureCollector",
164+
"Fork",
165+
"GasCosts",
158166
"Hash",
159167
"Header",
160168
"Initcode",
@@ -163,9 +171,11 @@
163171
"Macros",
164172
"MemoryVariable",
165173
"NetworkWrappedTransaction",
174+
"Op",
166175
"Opcode",
167176
"OpcodeCallArg",
168177
"Opcodes",
178+
"ParameterSet",
169179
"ReferenceSpec",
170180
"ReferenceSpecTypes",
171181
"Removable",
@@ -177,13 +187,15 @@
177187
"TestAddress",
178188
"TestAddress2",
179189
"TestParameterGroup",
190+
"TestPhaseManager",
180191
"TestPrivateKey",
181192
"TestPrivateKey2",
182193
"Transaction",
183194
"TransactionException",
184195
"TransactionReceipt",
185196
"TransactionTest",
186197
"TransactionTestFiller",
198+
"TransactionType",
187199
"UndefinedOpcodes",
188200
"While",
189201
"Withdrawal",
@@ -198,5 +210,4 @@
198210
"generate_system_contract_deploy_test",
199211
"generate_system_contract_error_test",
200212
"keccak256",
201-
"vm",
202213
)

0 commit comments

Comments
 (0)