`spectest_with_bls_switch` decorator
This commit is contained in:
parent
7468fd034f
commit
24ad42663f
|
@ -27,9 +27,13 @@ def with_state(fn):
|
|||
DEFAULT_BLS_ACTIVE = False
|
||||
|
||||
|
||||
def spectest_with_bls_switch(fn):
|
||||
return bls_switch(spectest()(fn))
|
||||
|
||||
|
||||
# shorthand for decorating @with_state @spectest()
|
||||
def spec_state_test(fn):
|
||||
return with_state(bls_switch(spectest()(fn)))
|
||||
return with_state(spectest_with_bls_switch(fn))
|
||||
|
||||
|
||||
def expect_assertion_error(fn):
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
from eth2spec.test.context import spec_state_test, with_phases
|
||||
from eth2spec.test.context import with_phases, spectest_with_bls_switch
|
||||
from eth2spec.test.helpers.deposits import (
|
||||
prepare_genesis_deposits,
|
||||
)
|
||||
|
||||
|
||||
@with_phases(['phase0'])
|
||||
@spec_state_test
|
||||
def test_is_genesis_trigger_false(spec, state):
|
||||
@spectest_with_bls_switch
|
||||
def test_is_genesis_trigger_false(spec):
|
||||
deposit_count = 2
|
||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
||||
genesis_time = 1234
|
||||
|
@ -18,8 +18,8 @@ def test_is_genesis_trigger_false(spec, state):
|
|||
|
||||
|
||||
@with_phases(['phase0'])
|
||||
@spec_state_test
|
||||
def test_is_genesis_trigger_true(spec, state):
|
||||
@spectest_with_bls_switch
|
||||
def test_is_genesis_trigger_true(spec):
|
||||
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
||||
genesis_time = 1234
|
||||
|
@ -29,9 +29,10 @@ def test_is_genesis_trigger_true(spec, state):
|
|||
|
||||
yield is_triggered
|
||||
|
||||
|
||||
@with_phases(['phase0'])
|
||||
@spec_state_test
|
||||
def test_is_genesis_trigger_not_enough_balance(spec, state):
|
||||
@spectest_with_bls_switch
|
||||
def test_is_genesis_trigger_not_enough_balance(spec):
|
||||
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE - 1)
|
||||
genesis_time = 1234
|
||||
|
@ -45,8 +46,8 @@ def test_is_genesis_trigger_not_enough_balance(spec, state):
|
|||
|
||||
|
||||
@with_phases(['phase0'])
|
||||
@spec_state_test
|
||||
def test_genesis(spec, state):
|
||||
@spectest_with_bls_switch
|
||||
def test_genesis(spec):
|
||||
deposit_count = spec.GENESIS_ACTIVE_VALIDATOR_COUNT
|
||||
genesis_deposits, deposit_root = prepare_genesis_deposits(spec, deposit_count, spec.MAX_EFFECTIVE_BALANCE)
|
||||
genesis_time = 1234
|
||||
|
|
Loading…
Reference in New Issue