@@ -122,7 +122,7 @@ def pytest_addoption(parser: pytest.Parser):
122122 action = "store" ,
123123 dest = "evm_bin" ,
124124 type = Path ,
125- default = "ethereum-spec-evm-resolver" ,
125+ default = None ,
126126 help = (
127127 "Path to an evm executable (or name of an executable in the PATH) that provides `t8n`."
128128 " Default: `ethereum-spec-evm-resolver`."
@@ -345,18 +345,23 @@ def pytest_configure(config):
345345
346346 # Instantiate the transition tool here to check that the binary path/trace option is valid.
347347 # This ensures we only raise an error once, if appropriate, instead of for every test.
348- t8n = TransitionTool .from_binary_path (
349- binary_path = config .getoption ("evm_bin" ), trace = config .getoption ("evm_collect_traces" )
350- )
351- if (
352- isinstance (config .getoption ("numprocesses" ), int )
353- and config .getoption ("numprocesses" ) > 0
354- and "Besu" in str (t8n .detect_binary_pattern )
355- ):
356- pytest .exit (
357- "The Besu t8n tool does not work well with the xdist plugin; use -n=0." ,
358- returncode = pytest .ExitCode .USAGE_ERROR ,
348+ evm_bin = config .getoption ("evm_bin" )
349+ if evm_bin is None :
350+ assert TransitionTool .default_tool is not None , "No default transition tool found"
351+ t8n = TransitionTool .default_tool (trace = config .getoption ("evm_collect_traces" ))
352+ else :
353+ t8n = TransitionTool .from_binary_path (
354+ binary_path = evm_bin , trace = config .getoption ("evm_collect_traces" )
359355 )
356+ if (
357+ isinstance (config .getoption ("numprocesses" ), int )
358+ and config .getoption ("numprocesses" ) > 0
359+ and "Besu" in str (t8n .detect_binary_pattern )
360+ ):
361+ pytest .exit (
362+ "The Besu t8n tool does not work well with the xdist plugin; use -n=0." ,
363+ returncode = pytest .ExitCode .USAGE_ERROR ,
364+ )
360365
361366 if "Tools" not in config .stash [metadata_key ]:
362367 config .stash [metadata_key ]["Tools" ] = {
@@ -538,7 +543,7 @@ def pytest_html_report_title(report):
538543
539544
540545@pytest .fixture (autouse = True , scope = "session" )
541- def evm_bin (request : pytest .FixtureRequest ) -> Path :
546+ def evm_bin (request : pytest .FixtureRequest ) -> Path | None :
542547 """Return configured evm tool binary path used to run t8n."""
543548 return request .config .getoption ("evm_bin" )
544549
@@ -553,11 +558,17 @@ def verify_fixtures_bin(request: pytest.FixtureRequest) -> Path | None:
553558
554559
555560@pytest .fixture (autouse = True , scope = "session" )
556- def t8n (request : pytest .FixtureRequest , evm_bin : Path ) -> Generator [TransitionTool , None , None ]:
561+ def t8n (
562+ request : pytest .FixtureRequest , evm_bin : Path | None
563+ ) -> Generator [TransitionTool , None , None ]:
557564 """Return configured transition tool."""
558- t8n = TransitionTool .from_binary_path (
559- binary_path = evm_bin , trace = request .config .getoption ("evm_collect_traces" )
560- )
565+ if evm_bin is None :
566+ assert TransitionTool .default_tool is not None , "No default transition tool found"
567+ t8n = TransitionTool .default_tool (trace = request .config .getoption ("evm_collect_traces" ))
568+ else :
569+ t8n = TransitionTool .from_binary_path (
570+ binary_path = evm_bin , trace = request .config .getoption ("evm_collect_traces" )
571+ )
561572 if not t8n .exception_mapper .reliable :
562573 warnings .warn (
563574 f"The t8n tool that is currently being used to fill tests ({ t8n .__class__ .__name__ } ) "
@@ -590,7 +601,7 @@ def do_fixture_verification(
590601def evm_fixture_verification (
591602 request : pytest .FixtureRequest ,
592603 do_fixture_verification : bool ,
593- evm_bin : Path ,
604+ evm_bin : Path | None ,
594605 verify_fixtures_bin : Path | None ,
595606) -> Generator [FixtureConsumer | None , None , None ]:
596607 """
0 commit comments