update testgen, make epoch proc work
This commit is contained in:
parent
69052ac750
commit
e8b3f9985b
|
@ -9,13 +9,12 @@ from eth2spec.test.phase_0.epoch_processing import (
|
|||
test_process_registry_updates,
|
||||
test_process_slashings
|
||||
)
|
||||
from gen_base import gen_runner, gen_suite, gen_typing
|
||||
from gen_base import gen_runner, gen_typing
|
||||
from gen_from_tests.gen import generate_from_tests
|
||||
from preset_loader import loader
|
||||
|
||||
|
||||
def create_suite(handler_name: str, tests_src, config_name: str) \
|
||||
-> Callable[[str], gen_typing.TestProvider]:
|
||||
def create_provider(handler_name: str, tests_src, config_name: str) -> gen_typing.TestProvider:
|
||||
|
||||
def prepare_fn(configs_path: str) -> str:
|
||||
presets = loader.load_presets(configs_path, config_name)
|
||||
|
@ -36,14 +35,14 @@ def create_suite(handler_name: str, tests_src, config_name: str) \
|
|||
|
||||
if __name__ == "__main__":
|
||||
gen_runner.run_generator("epoch_processing", [
|
||||
create_suite('crosslinks', test_process_crosslinks, 'minimal'),
|
||||
create_suite('crosslinks', test_process_crosslinks, 'mainnet'),
|
||||
create_suite('final_updates', test_process_final_updates, 'minimal'),
|
||||
create_suite('final_updates', test_process_final_updates, 'mainnet'),
|
||||
create_suite('justification_and_finalization', test_process_justification_and_finalization, 'minimal'),
|
||||
create_suite('justification_and_finalization', test_process_justification_and_finalization, 'mainnet'),
|
||||
create_suite('registry_updates', test_process_registry_updates, 'minimal'),
|
||||
create_suite('registry_updates', test_process_registry_updates, 'mainnet'),
|
||||
create_suite('slashings', test_process_slashings, 'minimal'),
|
||||
create_suite('slashings', test_process_slashings, 'mainnet'),
|
||||
create_provider('crosslinks', test_process_crosslinks, 'minimal'),
|
||||
create_provider('crosslinks', test_process_crosslinks, 'mainnet'),
|
||||
create_provider('final_updates', test_process_final_updates, 'minimal'),
|
||||
create_provider('final_updates', test_process_final_updates, 'mainnet'),
|
||||
create_provider('justification_and_finalization', test_process_justification_and_finalization, 'minimal'),
|
||||
create_provider('justification_and_finalization', test_process_justification_and_finalization, 'mainnet'),
|
||||
create_provider('registry_updates', test_process_registry_updates, 'minimal'),
|
||||
create_provider('registry_updates', test_process_registry_updates, 'mainnet'),
|
||||
create_provider('slashings', test_process_slashings, 'minimal'),
|
||||
create_provider('slashings', test_process_slashings, 'mainnet'),
|
||||
])
|
||||
|
|
|
@ -10,10 +10,10 @@ from os.path import join
|
|||
def load_presets(configs_dir, presets_name) -> Dict[str, Any]:
|
||||
"""
|
||||
Loads the given preset
|
||||
:param presets_name: The name of the generator. (lowercase snake_case)
|
||||
:param presets_name: The name of the presets. (lowercase snake_case)
|
||||
:return: Dictionary, mapping of constant-name -> constant-value
|
||||
"""
|
||||
path = Path(join(configs_dir, 'constant_presets', presets_name+'.yaml'))
|
||||
path = Path(join(configs_dir, presets_name+'.yaml'))
|
||||
yaml = YAML(typ='base')
|
||||
loaded = yaml.load(path)
|
||||
out = dict()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import argparse
|
||||
from pathlib import Path
|
||||
import sys
|
||||
from typing import List
|
||||
from typing import Iterable
|
||||
|
||||
from ruamel.yaml import (
|
||||
YAML,
|
||||
|
|
|
@ -3,10 +3,9 @@ from typing import (
|
|||
Callable,
|
||||
Iterable,
|
||||
NewType,
|
||||
Dict,
|
||||
Tuple,
|
||||
)
|
||||
from collections import namedtuple
|
||||
from dataclasses import dataclass
|
||||
|
||||
# Elements: name, out_kind, data
|
||||
#
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from inspect import getmembers, isfunction
|
||||
from typing import Any, Iterable
|
||||
|
||||
from gen_base.gen_typing import TestCase
|
||||
|
||||
|
@ -34,5 +35,6 @@ def generate_from_tests(runner_name: str, handler_name: str, src: Any,
|
|||
handler_name=handler_name,
|
||||
suite_name='pyspec_tests',
|
||||
case_name=case_name,
|
||||
case_fn=lambda: tfn(generator_mode=True, fork_name=fork_name, bls_active=bls_active)
|
||||
# TODO: with_all_phases and other per-phase tooling, should be replaced with per-fork equivalent.
|
||||
case_fn=lambda: tfn(generator_mode=True, phase=fork_name, bls_active=bls_active)
|
||||
)
|
||||
|
|
|
@ -4,7 +4,7 @@ from eth2spec.utils import bls
|
|||
|
||||
from .helpers.genesis import create_genesis_state
|
||||
|
||||
from .utils import spectest, with_tags
|
||||
from .utils import spectest, with_meta_tags
|
||||
|
||||
|
||||
def with_state(fn):
|
||||
|
@ -53,7 +53,7 @@ def expect_assertion_error(fn):
|
|||
|
||||
|
||||
# Tags a test to be ignoring BLS for it to pass.
|
||||
bls_ignored = with_tags({'bls_setting': 2})
|
||||
bls_ignored = with_meta_tags({'bls_setting': 2})
|
||||
|
||||
|
||||
def never_bls(fn):
|
||||
|
@ -68,7 +68,7 @@ def never_bls(fn):
|
|||
|
||||
|
||||
# Tags a test to be requiring BLS for it to pass.
|
||||
bls_required = with_tags({'bls_setting': 1})
|
||||
bls_required = with_meta_tags({'bls_setting': 1})
|
||||
|
||||
|
||||
def always_bls(fn):
|
||||
|
|
Loading…
Reference in New Issue