Skips tests properly

This commit is contained in:
Carl Beekhuizen 2019-06-04 16:14:14 +02:00
parent c06a60c95a
commit 9d00a76493
No known key found for this signature in database
GPG Key ID: D05CA176D0020646
2 changed files with 55 additions and 49 deletions

View File

@ -1,3 +1,5 @@
import pytest
from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal from eth2spec.test.helpers.custody import get_valid_early_derived_secret_reveal
from eth2spec.test.context import with_phase1, spec_state_test, expect_assertion_error from eth2spec.test.context import with_phase1, spec_state_test, expect_assertion_error
@ -51,12 +53,14 @@ def test_reveal_from_current_epoch(spec, state):
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False) yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
# @with_phase1 @with_phase1
# @spec_state_test @spec_state_test
# def test_reveal_from_past_epoch(state): def test_reveal_from_past_epoch(spec, state):
# randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state, spec.get_current_epoch(state) - 1) if spec.get_current_epoch(state) < 1:
# pytest.skip('testing of previous epoch requires epoch of at least 1')
# yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False) randao_key_reveal = get_valid_early_derived_secret_reveal(spec, state, spec.get_current_epoch(state) - 1)
yield from run_early_derived_secret_reveal_processing(spec, state, randao_key_reveal, False)
@with_phase1 @with_phase1

View File

@ -72,24 +72,25 @@ def test_empty_epoch_transition(spec, state):
assert spec.get_block_root_at_slot(state, slot) == block.parent_root assert spec.get_block_root_at_slot(state, slot) == block.parent_root
# @spec_state_test @with_all_phases
# def test_empty_epoch_transition_not_finalizing(spec, state): @spec_state_test
# # copy for later balance lookups. def test_empty_epoch_transition_not_finalizing(spec, state):
# pre_state = deepcopy(state) # copy for later balance lookups.
# yield 'pre', state pre_state = deepcopy(state)
# yield 'pre', state
# block = build_empty_block_for_next_slot(spec, state)
# block.slot += spec.SLOTS_PER_EPOCH * 5 block = build_empty_block_for_next_slot(spec, state)
# sign_block(spec, state, block, proposer_index=0) block.slot += spec.SLOTS_PER_EPOCH * 5
# yield 'blocks', [block], [spec.BeaconBlock] sign_block(spec, state, block, proposer_index=0)
# yield 'blocks', [block], [spec.BeaconBlock]
# spec.state_transition(state, block)
# yield 'post', state spec.state_transition(state, block)
# yield 'post', state
# assert state.slot == block.slot
# assert state.finalized_epoch < spec.get_current_epoch(state) - 4 assert state.slot == block.slot
# for index in range(len(state.validator_registry)): assert state.finalized_epoch < spec.get_current_epoch(state) - 4
# assert get_balance(state, index) < get_balance(pre_state, index) for index in range(len(state.validator_registry)):
assert get_balance(state, index) < get_balance(pre_state, index)
@with_all_phases @with_all_phases
@ -378,28 +379,29 @@ def test_historical_batch(spec, state):
assert len(state.historical_roots) == pre_historical_roots_len + 1 assert len(state.historical_roots) == pre_historical_roots_len + 1
# @spec_state_test @with_all_phases
# def test_eth1_data_votes(spec, state): @spec_state_test
# yield 'pre', state def test_eth1_data_votes(spec, state):
# yield 'pre', state
# expected_votes = 0
# assert len(state.eth1_data_votes) == expected_votes expected_votes = 0
# assert len(state.eth1_data_votes) == expected_votes
# blocks = []
# for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1): blocks = []
# block = build_empty_block_for_next_slot(spec, state) for _ in range(spec.SLOTS_PER_ETH1_VOTING_PERIOD - 1):
# spec.state_transition(state, block) block = build_empty_block_for_next_slot(spec, state)
# expected_votes += 1 spec.state_transition(state, block)
# assert len(state.eth1_data_votes) == expected_votes expected_votes += 1
# blocks.append(block) assert len(state.eth1_data_votes) == expected_votes
# blocks.append(block)
# block = build_empty_block_for_next_slot(spec, state)
# blocks.append(block) block = build_empty_block_for_next_slot(spec, state)
# blocks.append(block)
# spec.state_transition(state, block)
# spec.state_transition(state, block)
# yield 'blocks', [block], [spec.BeaconBlock]
# yield 'post', state yield 'blocks', [block], [spec.BeaconBlock]
# yield 'post', state
# assert state.slot % spec.SLOTS_PER_ETH1_VOTING_PERIOD == 0
# assert len(state.eth1_data_votes) == 1 assert state.slot % spec.SLOTS_PER_ETH1_VOTING_PERIOD == 0
assert len(state.eth1_data_votes) == 1