@hwwhww review

Co-authored-by: Hsiao-Wei Wang <hsiaowei.eth@gmail.com>
This commit is contained in:
Danny Ryan 2021-03-10 12:27:50 -07:00 committed by GitHub
parent 338be1f636
commit e792c27c91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -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 runner_name: to categorize the test in general as.
:param handler_name: to categorize the test specialization as. :param handler_name: to categorize the test specialization as.
:param src: to retrieve tests from (discovered using inspect.getmembers). :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) (if multiple forks are applicable, indicate the last fork)
:param bls_active: optional, to override BLS switch preference. Defaults to True. :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. :return: an iterable of test cases.
""" """
fn_names = [ fn_names = [

View File

@ -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 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
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 getattr(pre_state, field) != getattr(post_state, field)
assert pre_state.fork.current_version == post_state.fork.previous_version 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.current_version == post_spec.LIGHTCLIENT_PATCH_FORK_VERSION
assert post_state.fork.epoch == spec.get_current_epoch(post_state) assert post_state.fork.epoch == post_spec.get_current_epoch(post_state)
yield 'post', post_state yield 'post', post_state

View File

@ -26,7 +26,6 @@ def create_provider(tests_src, config_name: str, phase: str, fork_name: str) ->
src=tests_src, src=tests_src,
fork_name=fork_name, fork_name=fork_name,
phase=phase, phase=phase,
) )
return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn) return gen_typing.TestProvider(prepare=prepare_fn, make_cases=cases_fn)