Merge pull request #2688 from ethereum/fork-cli-fix
This commit is contained in:
commit
a89b55d7f7
|
@ -49,6 +49,15 @@ def pytest_addoption(parser):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _validate_fork_name(forks):
|
||||||
|
for fork in forks:
|
||||||
|
if fork not in ALL_PHASES:
|
||||||
|
raise ValueError(
|
||||||
|
f'The given --fork argument "{fork}" is not an available fork.'
|
||||||
|
f' The available forks: {ALL_PHASES}'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@fixture(autouse=True)
|
@fixture(autouse=True)
|
||||||
def preset(request):
|
def preset(request):
|
||||||
context.DEFAULT_TEST_PRESET = request.config.getoption("--preset")
|
context.DEFAULT_TEST_PRESET = request.config.getoption("--preset")
|
||||||
|
@ -56,10 +65,11 @@ def preset(request):
|
||||||
|
|
||||||
@fixture(autouse=True)
|
@fixture(autouse=True)
|
||||||
def run_phases(request):
|
def run_phases(request):
|
||||||
phases = request.config.getoption("--fork")
|
forks = request.config.getoption("--fork", default=None)
|
||||||
if phases:
|
if forks:
|
||||||
phases = [phase.lower() for phase in phases]
|
forks = [fork.lower() for fork in forks]
|
||||||
context.DEFAULT_PYTEST_FORKS = set(phases)
|
_validate_fork_name(forks)
|
||||||
|
context.DEFAULT_PYTEST_FORKS = set(forks)
|
||||||
else:
|
else:
|
||||||
context.DEFAULT_PYTEST_FORKS = ALL_PHASES
|
context.DEFAULT_PYTEST_FORKS = ALL_PHASES
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue