@@ -280,7 +280,7 @@ def pytest_configure(config):
280
280
returncode = pytest .ExitCode .USAGE_ERROR ,
281
281
)
282
282
283
- config .stash [metadata_key ]["Versions " ] = {
283
+ config .stash [metadata_key ]["Tools " ] = {
284
284
"t8n" : t8n .version (),
285
285
"solc" : str (config .solc_version ),
286
286
}
@@ -293,8 +293,8 @@ def pytest_report_header(config, start_path):
293
293
"""Add lines to pytest's console output header"""
294
294
if config .option .collectonly :
295
295
return
296
- t8n_version = config .stash [metadata_key ]["Versions " ]["t8n" ]
297
- solc_version = config .stash [metadata_key ]["Versions " ]["solc" ]
296
+ t8n_version = config .stash [metadata_key ]["Tools " ]["t8n" ]
297
+ solc_version = config .stash [metadata_key ]["Tools " ]["solc" ]
298
298
return [(f"{ t8n_version } , { solc_version } " )]
299
299
300
300
@@ -533,25 +533,40 @@ def output_dir(request, is_output_tarball: bool) -> Path:
533
533
@pytest .fixture (scope = "session" , autouse = True )
534
534
def create_properties_file (request , output_dir : Path ) -> None :
535
535
"""
536
- Create a properties file in the output directory with the solc version .
536
+ Create a properties file in the fixture output directory.
537
537
"""
538
538
if is_output_stdout (request .config .getoption ("output" )):
539
539
return
540
540
if not output_dir .exists ():
541
541
output_dir .mkdir (parents = True )
542
- properties = {
542
+
543
+ fixture_properties = {
543
544
"timestamp" : datetime .datetime .now ().isoformat (),
544
545
}
545
546
if build_name := request .config .getoption ("build_name" ):
546
- properties ["build" ] = build_name
547
+ fixture_properties ["build" ] = build_name
547
548
if github_ref := os .getenv ("GITHUB_REF" ):
548
- properties ["ref" ] = github_ref
549
+ fixture_properties ["ref" ] = github_ref
549
550
if github_sha := os .getenv ("GITHUB_SHA" ):
550
- properties ["commit" ] = github_sha
551
- properties ["solc_version" ] = request .config .solc_version
551
+ fixture_properties ["commit" ] = github_sha
552
+ command_line_args = request .config .stash [metadata_key ]["Command-line args" ]
553
+ command_line_args = command_line_args .replace ("<code>" , "" ).replace ("</code>" , "" )
554
+ fixture_properties ["command_line_args" ] = command_line_args
552
555
553
556
config = configparser .ConfigParser ()
554
- config ["FIXTURES" ] = properties
557
+ config ["fixtures" ] = fixture_properties
558
+ environment_properties = {}
559
+ for key , val in request .config .stash [metadata_key ].items ():
560
+ if key .lower () == "command-line args" :
561
+ continue
562
+ if isinstance (val , str ):
563
+ environment_properties [key ] = val
564
+ elif isinstance (val , dict ):
565
+ config [key .lower ()] = val
566
+ else :
567
+ warnings .warn (f"Properties file: Skipping metadata key { key } with value { val } ." )
568
+ config ["environment" ] = environment_properties
569
+
555
570
properties_filename = output_dir / "fixtures.properties"
556
571
with open (properties_filename , "w" ) as f :
557
572
config .write (f )
0 commit comments