From e792c27c915f96e9b576b0a21f3c2cab73a93894 Mon Sep 17 00:00:00 2001 From: Danny Ryan Date: Wed, 10 Mar 2021 12:27:50 -0700 Subject: [PATCH] @hwwhww review Co-authored-by: Hsiao-Wei Wang --- .../pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py | 4 ++-- .../eth2spec/test/lightclient_patch/fork/test_fork.py | 8 ++++---- tests/generators/forks/main.py | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py b/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py index 057aa1a2c..c090869d5 100644 --- a/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py +++ b/tests/core/pyspec/eth2spec/gen_helpers/gen_from_tests/gen.py @@ -18,10 +18,10 @@ def generate_from_tests(runner_name: str, handler_name: str, src: Any, :param runner_name: to categorize the test in general as. :param handler_name: to categorize the test specialization as. :param src: to retrieve tests from (discovered using inspect.getmembers). - :param fork_name: to run tests against particular phase and/or fork. + :param fork_name: the folder name for these tests. (if multiple forks are applicable, indicate the last fork) :param bls_active: optional, to override BLS switch preference. Defaults to True. - :param phase: optional, specific phase name + :param phase: optional, to run tests against a particular spec version. Default to `fork_name` value. :return: an iterable of test cases. """ fn_names = [ diff --git a/tests/core/pyspec/eth2spec/test/lightclient_patch/fork/test_fork.py b/tests/core/pyspec/eth2spec/test/lightclient_patch/fork/test_fork.py index 5904805cf..dada24af9 100644 --- a/tests/core/pyspec/eth2spec/test/lightclient_patch/fork/test_fork.py +++ b/tests/core/pyspec/eth2spec/test/lightclient_patch/fork/test_fork.py @@ -17,10 +17,10 @@ HF1_FORK_TEST_META_TAGS = { } -def run_fork_test(spec, pre_state): +def run_fork_test(post_spec, pre_state): yield 'pre', pre_state - post_state = spec.upgrade_to_lightclient_patch(pre_state) + post_state = post_spec.upgrade_to_lightclient_patch(pre_state) # Stable fields stable_fields = [ @@ -47,8 +47,8 @@ def run_fork_test(spec, pre_state): assert getattr(pre_state, field) != getattr(post_state, field) assert pre_state.fork.current_version == post_state.fork.previous_version - assert post_state.fork.current_version == spec.LIGHTCLIENT_PATCH_FORK_VERSION - assert post_state.fork.epoch == spec.get_current_epoch(post_state) + assert post_state.fork.current_version == post_spec.LIGHTCLIENT_PATCH_FORK_VERSION + assert post_state.fork.epoch == post_spec.get_current_epoch(post_state) yield 'post', post_state diff --git a/tests/generators/forks/main.py b/tests/generators/forks/main.py index 1a603a0dc..190d4620c 100644 --- a/tests/generators/forks/main.py +++ b/tests/generators/forks/main.py @@ -26,7 +26,6 @@ def create_provider(tests_src, config_name: str, phase: str, fork_name: str) -> src=tests_src, fork_name=fork_name, phase=phase, - ) return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn)