eth2.0-specs/test_libs/pyspec/tests/conftest.py

37 lines
805 B
Python
Raw Normal View History

import pytest
2019-03-18 18:51:52 +00:00
2019-04-03 03:18:17 +00:00
from eth2spec.phase0 import spec
from preset_loader import loader
2019-03-27 18:30:47 +00:00
from .helpers import (
create_genesis_state,
2019-03-18 18:51:52 +00:00
)
def pytest_addoption(parser):
parser.addoption(
"--config", action="store", default="minimal", help="config: make the pyspec use the specified configuration"
)
2019-03-18 18:51:52 +00:00
@pytest.fixture(autouse=True)
def config(request):
config_name = request.config.getoption("--config")
presets = loader.load_presets('../../configs/', config_name)
spec.apply_constants_preset(presets)
2019-03-18 18:51:52 +00:00
@pytest.fixture
def num_validators(config):
return spec.SLOTS_PER_EPOCH * 8
2019-03-18 18:51:52 +00:00
@pytest.fixture
def deposit_data_leaves():
return list()
2019-03-18 18:51:52 +00:00
@pytest.fixture
def state(num_validators, deposit_data_leaves):
return create_genesis_state(num_validators, deposit_data_leaves)