Skip to content

Commit b7f00cd

Browse files
marioevzspencer-tb
andauthored
feat(filler): generate index file during fill (ethereum#716)
* feat(filler): generate index * changelog * chore: fix filler tests to include index file. --------- Co-authored-by: spencer-tb <[email protected]>
1 parent a6a400b commit b7f00cd

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Test fixtures for use by clients are available for each release on the [Github r
1212

1313
- 🐞 Fixed consume hive commands from spawning different hive test suites during the same test execution when using xdist ([#712](https://github.com/ethereum/execution-spec-tests/pull/712)).
1414
-`consume hive` command is now available to run all types of hive tests ([#712](https://github.com/ethereum/execution-spec-tests/pull/712)).
15+
- ✨ Generated fixtures now contain the test index `index.json` by default ([#716](https://github.com/ethereum/execution-spec-tests/pull/716)).
1516

1617
### 🔧 EVM Tools
1718

src/pytest_plugins/filler/filler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import pytest
1818
from pytest_metadata.plugin import metadata_key # type: ignore
1919

20+
from cli.gen_index import generate_fixtures_index
2021
from ethereum_test_base_types import Alloc, ReferenceSpec
2122
from ethereum_test_fixtures import FixtureCollector, FixtureFormats, TestInfo
2223
from ethereum_test_forks import (
@@ -617,6 +618,9 @@ def fixture_collector(
617618
fixture_collector.dump_fixtures()
618619
if do_fixture_verification:
619620
fixture_collector.verify_fixture_files(evm_fixture_verification)
621+
generate_fixtures_index(
622+
output_dir, quiet_mode=False, force_flag=False, disable_infer_format=False
623+
)
620624

621625

622626
@pytest.fixture(autouse=True, scope="session")

src/pytest_plugins/filler/tests/test_filler.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,13 +525,29 @@ def test_fixture_output_based_on_command_line_args(
525525

526526
all_files = get_all_files_in_directory(output_dir)
527527

528-
ini_file = None
529528
expected_fixtures_ini_filename = "fixtures.ini"
529+
expected_fixtures_index_filename = "index.json"
530+
531+
ini_file = None
532+
index_file = None
530533
for file in all_files:
531534
if file.name == expected_fixtures_ini_filename:
532535
ini_file = file
533-
all_files.remove(file)
534-
break
536+
elif file.name == expected_fixtures_index_filename:
537+
index_file = file
538+
539+
assert ini_file is not None, f"No {expected_fixtures_ini_filename} file was written"
540+
assert index_file is not None, f"No {expected_fixtures_index_filename} file was written"
541+
542+
all_files = [
543+
file
544+
for file in all_files
545+
if file.name
546+
not in {
547+
expected_fixtures_ini_filename,
548+
expected_fixtures_index_filename,
549+
}
550+
]
535551

536552
for fixture_file, fixture_count in zip(expected_fixture_files, expected_fixture_counts):
537553
assert fixture_file.exists()

0 commit comments

Comments
 (0)