36 lines
1.3 KiB
Python
Raw Normal View History

2021-03-08 19:11:31 -07:00
from typing import Iterable
from eth2spec.test.helpers.constants import PHASE0, ALTAIR, MINIMAL, MAINNET
2021-05-18 18:29:24 +02:00
from eth2spec.test.helpers.typing import SpecForkName, PresetBaseName
from eth2spec.test.altair.fork import test_altair_fork_basic, test_altair_fork_random
2021-03-08 19:11:31 -07:00
from eth2spec.gen_helpers.gen_base import gen_runner, gen_typing
from eth2spec.gen_helpers.gen_from_tests.gen import generate_from_tests
2021-05-18 18:29:24 +02:00
def create_provider(tests_src, preset_name: PresetBaseName,
phase: SpecForkName, fork_name: SpecForkName) -> gen_typing.TestProvider:
2021-03-08 19:11:31 -07:00
2021-05-18 18:29:24 +02:00
def prepare_fn() -> None:
return
2021-03-08 19:11:31 -07:00
def cases_fn() -> Iterable[gen_typing.TestCase]:
return generate_from_tests(
runner_name='fork',
handler_name='fork',
2021-03-08 19:11:31 -07:00
src=tests_src,
2021-03-09 16:27:06 -07:00
fork_name=fork_name,
2021-05-18 18:29:24 +02:00
preset_name=preset_name,
2021-03-09 16:27:06 -07:00
phase=phase,
2021-03-08 19:11:31 -07:00
)
return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn)
if __name__ == "__main__":
gen_runner.run_generator("forks", [
2021-05-18 18:29:24 +02:00
create_provider(test_altair_fork_basic, MINIMAL, PHASE0, ALTAIR),
create_provider(test_altair_fork_basic, MAINNET, PHASE0, ALTAIR),
create_provider(test_altair_fork_random, MINIMAL, PHASE0, ALTAIR),
create_provider(test_altair_fork_random, MAINNET, PHASE0, ALTAIR),
2021-03-08 19:11:31 -07:00
])