From 94d4e3a94402f65a58a23d434f40d021c4f80259 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Mon, 10 Jun 2019 20:05:43 -0600 Subject: [PATCH] operations suite generator for phase0 --- test_generators/epoch_processing/main.py | 6 +++-- test_generators/operations/main.py | 32 +++++++++++------------ test_libs/pyspec/eth2spec/test/context.py | 7 ++--- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/test_generators/epoch_processing/main.py b/test_generators/epoch_processing/main.py index 679ef4c6b..846f463a1 100644 --- a/test_generators/epoch_processing/main.py +++ b/test_generators/epoch_processing/main.py @@ -35,6 +35,8 @@ if __name__ == "__main__": gen_runner.run_generator("epoch_processing", [ create_suite('crosslinks', 'minimal', lambda: generate_from_tests(test_process_crosslinks, 'phase0')), create_suite('crosslinks', 'mainnet', lambda: generate_from_tests(test_process_crosslinks, 'phase0')), - create_suite('registry_updates', 'minimal', lambda: generate_from_tests(test_process_registry_updates, 'phase0')), - create_suite('registry_updates', 'mainnet', lambda: generate_from_tests(test_process_registry_updates, 'phase0')), + create_suite('registry_updates', 'minimal', + lambda: generate_from_tests(test_process_registry_updates, 'phase0')), + create_suite('registry_updates', 'mainnet', + lambda: generate_from_tests(test_process_registry_updates, 'phase0')), ]) diff --git a/test_generators/operations/main.py b/test_generators/operations/main.py index 82e05b307..38fa42f68 100644 --- a/test_generators/operations/main.py +++ b/test_generators/operations/main.py @@ -1,13 +1,13 @@ from typing import Callable, Iterable -from eth2spec.test.block_processing import ( +from eth2spec.test.phase_0.block_processing import ( test_process_attestation, test_process_attester_slashing, test_process_block_header, test_process_deposit, test_process_proposer_slashing, test_process_transfer, - test_process_voluntary_exit + test_process_voluntary_exit, ) from gen_base import gen_runner, gen_suite, gen_typing @@ -38,18 +38,18 @@ def create_suite(operation_name: str, config_name: str, get_cases: Callable[[], if __name__ == "__main__": gen_runner.run_generator("operations", [ - create_suite('attestation', 'minimal', lambda: generate_from_tests(test_process_attestation)), - create_suite('attestation', 'mainnet', lambda: generate_from_tests(test_process_attestation)), - create_suite('attester_slashing', 'minimal', lambda: generate_from_tests(test_process_attester_slashing)), - create_suite('attester_slashing', 'mainnet', lambda: generate_from_tests(test_process_attester_slashing)), - create_suite('block_header', 'minimal', lambda: generate_from_tests(test_process_block_header)), - create_suite('block_header', 'mainnet', lambda: generate_from_tests(test_process_block_header)), - create_suite('deposit', 'minimal', lambda: generate_from_tests(test_process_deposit)), - create_suite('deposit', 'mainnet', lambda: generate_from_tests(test_process_deposit)), - create_suite('proposer_slashing', 'minimal', lambda: generate_from_tests(test_process_proposer_slashing)), - create_suite('proposer_slashing', 'mainnet', lambda: generate_from_tests(test_process_proposer_slashing)), - create_suite('transfer', 'minimal', lambda: generate_from_tests(test_process_transfer)), - create_suite('transfer', 'mainnet', lambda: generate_from_tests(test_process_transfer)), - create_suite('voluntary_exit', 'minimal', lambda: generate_from_tests(test_process_voluntary_exit)), - create_suite('voluntary_exit', 'mainnet', lambda: generate_from_tests(test_process_voluntary_exit)), + create_suite('attestation', 'minimal', lambda: generate_from_tests(test_process_attestation, 'phase0')), + create_suite('attestation', 'mainnet', lambda: generate_from_tests(test_process_attestation, 'phase0')), + create_suite('attester_slashing', 'minimal', lambda: generate_from_tests(test_process_attester_slashing, 'phase0')), + create_suite('attester_slashing', 'mainnet', lambda: generate_from_tests(test_process_attester_slashing, 'phase0')), + create_suite('block_header', 'minimal', lambda: generate_from_tests(test_process_block_header, 'phase0')), + create_suite('block_header', 'mainnet', lambda: generate_from_tests(test_process_block_header, 'phase0')), + create_suite('deposit', 'minimal', lambda: generate_from_tests(test_process_deposit, 'phase0')), + create_suite('deposit', 'mainnet', lambda: generate_from_tests(test_process_deposit, 'phase0')), + create_suite('proposer_slashing', 'minimal', lambda: generate_from_tests(test_process_proposer_slashing, 'phase0')), + create_suite('proposer_slashing', 'mainnet', lambda: generate_from_tests(test_process_proposer_slashing, 'phase0')), + create_suite('transfer', 'minimal', lambda: generate_from_tests(test_process_transfer, 'phase0')), + create_suite('transfer', 'mainnet', lambda: generate_from_tests(test_process_transfer, 'phase0')), + create_suite('voluntary_exit', 'minimal', lambda: generate_from_tests(test_process_voluntary_exit, 'phase0')), + create_suite('voluntary_exit', 'mainnet', lambda: generate_from_tests(test_process_voluntary_exit, 'phase0')), ]) diff --git a/test_libs/pyspec/eth2spec/test/context.py b/test_libs/pyspec/eth2spec/test/context.py index 520eb9745..97266acf2 100644 --- a/test_libs/pyspec/eth2spec/test/context.py +++ b/test_libs/pyspec/eth2spec/test/context.py @@ -116,7 +116,7 @@ def with_phases(phases): def decorator(fn): def run_with_spec_version(spec, *args, **kw): kw['spec'] = spec - fn(*args, **kw) + return fn(*args, **kw) def wrapper(*args, **kw): run_phases = phases @@ -129,8 +129,9 @@ def with_phases(phases): run_phases = [phase] if 'phase0' in run_phases: - run_with_spec_version(spec_phase0, *args, **kw) + ret = run_with_spec_version(spec_phase0, *args, **kw) if 'phase1' in run_phases: - run_with_spec_version(spec_phase1, *args, **kw) + ret = run_with_spec_version(spec_phase1, *args, **kw) + return ret return wrapper return decorator