Skip to content

Commit 795fc3b

Browse files
committed
update tests
1 parent 83e0509 commit 795fc3b

File tree

4 files changed

+42
-58
lines changed

4 files changed

+42
-58
lines changed

tests/helpers/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@
2121
"fixture_path": "tests/fixtures/latest_fork_tests",
2222
},
2323
}
24+
25+
26+
ETHEREUM_TESTS_PATH = TEST_FIXTURES["ethereum_tests"]["fixture_path"]
27+
EEST_TESTS_PATH = TEST_FIXTURES["latest_fork_tests"]["fixture_path"]

tests/osaka/test_eof.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
from ethereum.osaka.vm.eof.validation import validate_eof_container
1010
from ethereum.osaka.vm.exceptions import InvalidEof
1111
from ethereum.utils.hexadecimal import hex_to_bytes
12+
from tests.helpers import EEST_TESTS_PATH
1213

1314
TEST_DIRS = (
14-
"tests/fixtures/latest_fork_tests/osaka/eof/eof_tests/eip7692_eof_v1",
15+
f"{EEST_TESTS_PATH}/osaka/eof/eof_tests/eip7692_eof_v1",
1516
"tests/fixtures/ethereum_tests/EOFTests/",
16-
"tests/fixtures/latest_fork_tests/osaka/eof/evmone_tests/eof_tests",
17+
f"{EEST_TESTS_PATH}/osaka/eof/evmone_tests/eof_tests",
1718
)
1819

1920

tests/osaka/test_evm_tools.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
from functools import partial
2-
from typing import Dict, Generator, Tuple
2+
from typing import Dict
33

44
import pytest
55

6-
from tests.helpers import TEST_FIXTURES
6+
from tests.helpers import EEST_TESTS_PATH
77
from tests.helpers.load_evm_tools_tests import (
88
fetch_evm_tools_tests,
99
idfn,
1010
load_evm_tools_test,
1111
)
1212

13-
ETHEREUM_TESTS_PATH = TEST_FIXTURES["ethereum_tests"]["fixture_path"]
14-
TEST_DIR = f"{ETHEREUM_TESTS_PATH}/GeneralStateTests/"
13+
EEST_STATE_TESTS_DIR = (
14+
f"{EEST_TESTS_PATH}/osaka/eof/state_tests/eip7692_eof_v1/"
15+
)
1516
FORK_NAME = "Osaka"
1617

17-
run_evm_tools_test = partial(
18-
load_evm_tools_test,
19-
fork_name=FORK_NAME,
20-
)
2118

2219
SLOW_TESTS = (
2320
"CALLBlake2f_MaxRounds",
@@ -34,25 +31,26 @@
3431
"tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing.py::test_valid[fork_Osaka-state_test-multi_inf_pair-]",
3532
)
3633

37-
test_dirs = (
38-
"tests/fixtures/latest_fork_tests/osaka/eof/state_tests/eip7692_eof_v1",
39-
)
4034

35+
# Define tests
36+
fetch_tests = partial(
37+
fetch_evm_tools_tests,
38+
fork_name=FORK_NAME,
39+
slow_tests=SLOW_TESTS,
40+
)
4141

42-
def fetch_temporary_tests(test_dirs: Tuple[str, ...]) -> Generator:
43-
for test_dir in test_dirs:
44-
yield from fetch_evm_tools_tests(
45-
test_dir,
46-
FORK_NAME,
47-
SLOW_TESTS,
48-
)
42+
run_tests = partial(
43+
load_evm_tools_test,
44+
fork_name=FORK_NAME,
45+
)
4946

5047

48+
# Run EEST test fixtures
5149
@pytest.mark.evm_tools
5250
@pytest.mark.parametrize(
5351
"test_case",
54-
fetch_temporary_tests(test_dirs),
52+
fetch_tests(EEST_STATE_TESTS_DIR),
5553
ids=idfn,
5654
)
57-
def test_evm_tools(test_case: Dict) -> None:
58-
run_evm_tools_test(test_case)
55+
def test_eest_evm_tools(test_case: Dict) -> None:
56+
run_tests(test_case)

tests/osaka/test_state_transition.py

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
from functools import partial
2-
from typing import Dict, Generator, Tuple
2+
from typing import Dict
33

44
import pytest
55

6-
from tests.helpers import TEST_FIXTURES
6+
from tests.helpers import EEST_TESTS_PATH
77
from tests.helpers.load_state_tests import (
88
Load,
99
fetch_state_test_files,
1010
idfn,
1111
run_blockchain_st_test,
1212
)
1313

14-
fetch_osaka_tests = partial(fetch_state_test_files, network="Osaka")
15-
16-
FIXTURES_LOADER = Load("Osaka", "osaka")
17-
18-
run_osaka_blockchain_st_tests = partial(
19-
run_blockchain_st_test, load=FIXTURES_LOADER
14+
EEST_BLOCKCHAIN_TESTS_DIR = (
15+
f"{EEST_TESTS_PATH}/osaka/eof/blockchain_tests/eip7692_eof_v1/"
2016
)
21-
22-
ETHEREUM_TESTS_PATH = TEST_FIXTURES["ethereum_tests"]["fixture_path"]
23-
ETHEREUM_SPEC_TESTS_PATH = TEST_FIXTURES["execution_spec_tests"][
24-
"fixture_path"
25-
]
26-
27-
28-
# Run state tests
29-
test_dir = f"{ETHEREUM_TESTS_PATH}/BlockchainTests/"
17+
NETWORK = "Osaka"
18+
PACKAGE = "osaka"
3019

3120
SLOW_TESTS = (
3221
# GeneralStateTests
@@ -82,33 +71,25 @@
8271
"stStaticCall/",
8372
)
8473

85-
fetch_state_tests = partial(
86-
fetch_osaka_tests,
74+
# Define Tests
75+
fetch_tests = partial(
76+
fetch_state_test_files,
77+
network=NETWORK,
8778
ignore_list=IGNORE_TESTS,
8879
slow_list=SLOW_TESTS,
8980
big_memory_list=BIG_MEMORY_TESTS,
9081
)
9182

83+
FIXTURES_LOADER = Load(NETWORK, PACKAGE)
9284

93-
# Run temporary test fixtures for Osaka
94-
test_dirs = (
95-
"tests/fixtures/latest_fork_tests/osaka/eof/blockchain_tests/eip7692_eof_v1",
96-
)
97-
98-
99-
def fetch_temporary_tests(test_dirs: Tuple[str, ...]) -> Generator:
100-
"""
101-
Fetch the relevant tests for a particular EIP-Implementation
102-
from among the temporary fixtures from ethereum-spec-tests.
103-
"""
104-
for test_dir in test_dirs:
105-
yield from fetch_state_tests(test_dir)
85+
run_tests = partial(run_blockchain_st_test, load=FIXTURES_LOADER)
10686

10787

88+
# Run EEST test fixtures
10889
@pytest.mark.parametrize(
10990
"test_case",
110-
fetch_temporary_tests(test_dirs),
91+
fetch_tests(EEST_BLOCKCHAIN_TESTS_DIR),
11192
ids=idfn,
11293
)
113-
def test_execution_specs_generated_tests(test_case: Dict) -> None:
114-
run_osaka_blockchain_st_tests(test_case)
94+
def test_eest_tests(test_case: Dict) -> None:
95+
run_tests(test_case)

0 commit comments

Comments
 (0)