Use `suite_name` instead of `meta.yaml` for SSZ type
This commit is contained in:
parent
cdaf7e84dd
commit
5c66300171
|
@ -49,7 +49,7 @@ def generate_from_tests(runner_name: str, handler_name: str, src: Any,
|
|||
preset_name=preset_name,
|
||||
runner_name=runner_name,
|
||||
handler_name=handler_name,
|
||||
suite_name='pyspec_tests',
|
||||
suite_name=getattr(tfn, 'suite_name', 'pyspec_tests'),
|
||||
case_name=case_name,
|
||||
# TODO: with_all_phases and other per-phase tooling, should be replaced with per-fork equivalent.
|
||||
case_fn=lambda: tfn(generator_mode=True, phase=phase, preset=preset_name, bls_active=bls_active)
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
from eth2spec.test.context import (
|
||||
spec_state_test,
|
||||
with_altair_and_later,
|
||||
with_test_suite_name,
|
||||
)
|
||||
|
||||
|
||||
@with_test_suite_name("BeaconState")
|
||||
@with_altair_and_later
|
||||
@spec_state_test
|
||||
def test_current_sync_committee_merkle_proof(spec, state):
|
||||
yield "object_class", "meta", "BeaconState"
|
||||
yield "object", state
|
||||
current_sync_committee_branch = \
|
||||
spec.compute_merkle_proof_for_state(state, spec.CURRENT_SYNC_COMMITTEE_INDEX)
|
||||
|
@ -25,10 +26,10 @@ def test_current_sync_committee_merkle_proof(spec, state):
|
|||
)
|
||||
|
||||
|
||||
@with_test_suite_name("BeaconState")
|
||||
@with_altair_and_later
|
||||
@spec_state_test
|
||||
def test_next_sync_committee_merkle_proof(spec, state):
|
||||
yield "object_class", "meta", "BeaconState"
|
||||
yield "object", state
|
||||
next_sync_committee_branch = \
|
||||
spec.compute_merkle_proof_for_state(state, spec.NEXT_SYNC_COMMITTEE_INDEX)
|
||||
|
@ -46,10 +47,10 @@ def test_next_sync_committee_merkle_proof(spec, state):
|
|||
)
|
||||
|
||||
|
||||
@with_test_suite_name("BeaconState")
|
||||
@with_altair_and_later
|
||||
@spec_state_test
|
||||
def test_finality_root_merkle_proof(spec, state):
|
||||
yield "object_class", "meta", "BeaconState"
|
||||
yield "object", state
|
||||
finality_branch = \
|
||||
spec.compute_merkle_proof_for_state(state, spec.FINALIZED_ROOT_INDEX)
|
||||
|
|
|
@ -620,6 +620,13 @@ def only_generator(reason):
|
|||
return _decorator
|
||||
|
||||
|
||||
def with_test_suite_name(suite_name: str):
|
||||
def _decorator(inner):
|
||||
inner.suite_name = suite_name
|
||||
return inner
|
||||
return _decorator
|
||||
|
||||
|
||||
#
|
||||
# Fork transition state tests
|
||||
#
|
||||
|
|
|
@ -5,15 +5,11 @@ generation and verification of merkle proofs based on static data.
|
|||
|
||||
## Test case format
|
||||
|
||||
### `meta.yaml`
|
||||
|
||||
```yaml
|
||||
object_class: string -- 'BeaconState'
|
||||
```
|
||||
Tests for each individual SSZ type are grouped into a `suite` indicating the SSZ type name.
|
||||
|
||||
### `object.yaml`
|
||||
|
||||
A SSZ-snappy encoded object of type `object_class` from which other data is generated.
|
||||
A SSZ-snappy encoded object from which other data is generated. The SSZ type can be determined from the test `suite` name.
|
||||
|
||||
### `proof.yaml`
|
||||
|
||||
|
|
Loading…
Reference in New Issue