diff --git a/src/pytest_plugins/filler/filler.py b/src/pytest_plugins/filler/filler.py index 9ecb1ac685b..3e945ed0a68 100644 --- a/src/pytest_plugins/filler/filler.py +++ b/src/pytest_plugins/filler/filler.py @@ -163,14 +163,6 @@ def pytest_addoption(parser: pytest.Parser): type=str, help="Specify a build name for the fixtures.ini file, e.g., 'stable'.", ) - test_group.addoption( - "--index", - action="store_true", - dest="generate_index", - default=True, - help="Generate an index file for all produced fixtures. By default this flag is set.", - ) - test_group.addoption( "--skip-index", action="store_false", @@ -774,25 +766,22 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus: int): return output: Path = session.config.getoption("output") - is_output_tarball = output.suffix == ".gz" and output.with_suffix("").suffix == ".tar" - output_dir = strip_output_tarball_suffix(output) - if is_output_stdout(output): - # Don't perform any further actions if the output is stdout. return + output_dir = strip_output_tarball_suffix(output) # Remove any lock files that may have been created. for file in output_dir.rglob("*.lock"): file.unlink() # Generate index file for all produced fixtures. - generate_index = session.config.getoption("generate_index") - if generate_index: + if session.config.getoption("generate_index"): generate_fixtures_index( output_dir, quiet_mode=True, force_flag=False, disable_infer_format=False ) # Create tarball of the output directory if the output is a tarball. + is_output_tarball = output.suffix == ".gz" and output.with_suffix("").suffix == ".tar" if is_output_tarball: source_dir = output_dir tarball_filename = output diff --git a/src/pytest_plugins/filler/tests/test_filler.py b/src/pytest_plugins/filler/tests/test_filler.py index 43cb43dce27..755e06dacfa 100644 --- a/src/pytest_plugins/filler/tests/test_filler.py +++ b/src/pytest_plugins/filler/tests/test_filler.py @@ -79,7 +79,7 @@ def test_shanghai_two(state_test, x): @pytest.mark.run_in_serial @pytest.mark.parametrize( - "args, expected_fixture_files, expected_fixture_counts, expected_index", + "args, expected_fixture_files, expected_fixture_counts", [ pytest.param( [], @@ -102,33 +102,8 @@ def test_shanghai_two(state_test, x): Path("fixtures/state_tests/shanghai/module_shanghai/shanghai_two.json"), ], [2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6], - True, id="default-args", ), - pytest.param( - ["--index"], - [ - Path("fixtures/blockchain_tests/paris/module_paris/paris_one.json"), - Path("fixtures/blockchain_tests_engine/paris/module_paris/paris_one.json"), - Path("fixtures/state_tests/paris/module_paris/paris_one.json"), - Path("fixtures/blockchain_tests/paris/module_paris/paris_two.json"), - Path("fixtures/blockchain_tests_engine/paris/module_paris/paris_two.json"), - Path("fixtures/state_tests/paris/module_paris/paris_two.json"), - Path("fixtures/blockchain_tests/shanghai/module_shanghai/shanghai_one.json"), - Path( - "fixtures/blockchain_tests_engine/shanghai/module_shanghai/shanghai_one.json" - ), - Path("fixtures/state_tests/shanghai/module_shanghai/shanghai_one.json"), - Path("fixtures/blockchain_tests/shanghai/module_shanghai/shanghai_two.json"), - Path( - "fixtures/blockchain_tests_engine/shanghai/module_shanghai/shanghai_two.json" - ), - Path("fixtures/state_tests/shanghai/module_shanghai/shanghai_two.json"), - ], - [2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6], - True, - id="index-flag", - ), pytest.param( ["--skip-index"], [ @@ -150,11 +125,10 @@ def test_shanghai_two(state_test, x): Path("fixtures/state_tests/shanghai/module_shanghai/shanghai_two.json"), ], [2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6], - False, id="skip-index", ), pytest.param( - ["--index", "--build-name", "test_build"], + ["--build-name", "test_build"], [ Path("fixtures/blockchain_tests/paris/module_paris/paris_one.json"), Path("fixtures/blockchain_tests_engine/paris/module_paris/paris_one.json"), @@ -174,11 +148,10 @@ def test_shanghai_two(state_test, x): Path("fixtures/state_tests/shanghai/module_shanghai/shanghai_two.json"), ], [2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6], - True, id="build-name-in-fixtures-ini-file", ), pytest.param( - ["--flat-output", "--index"], + ["--flat-output"], [ Path("fixtures/blockchain_tests/paris_one.json"), Path("fixtures/blockchain_tests_engine/paris_one.json"), @@ -194,11 +167,10 @@ def test_shanghai_two(state_test, x): Path("fixtures/state_tests/shanghai_two.json"), ], [2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6], - True, id="flat-output", ), pytest.param( - ["--flat-output", "--index", "--output", "other_fixtures"], + ["--flat-output", "--output", "other_fixtures"], [ Path("other_fixtures/blockchain_tests/paris_one.json"), Path("other_fixtures/blockchain_tests_engine/paris_one.json"), @@ -214,11 +186,10 @@ def test_shanghai_two(state_test, x): Path("other_fixtures/state_tests/shanghai_two.json"), ], [2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6, 6], - True, id="flat-output_custom-output-dir", ), pytest.param( - ["--single-fixture-per-file", "--index"], + ["--single-fixture-per-file"], [ Path( "fixtures/blockchain_tests/paris/module_paris/paris_one__fork_Paris_blockchain_test.json" @@ -330,11 +301,10 @@ def test_shanghai_two(state_test, x): ), ], [1] * 36, - True, id="single-fixture-per-file", ), pytest.param( - ["--single-fixture-per-file", "--index", "--output", "other_fixtures"], + ["--single-fixture-per-file", "--output", "other_fixtures"], [ Path( "other_fixtures/blockchain_tests/paris/module_paris/paris_one__fork_Paris_blockchain_test.json" @@ -446,11 +416,10 @@ def test_shanghai_two(state_test, x): ), ], [1] * 36, - True, id="single-fixture-per-file_custom_output_dir", ), pytest.param( - ["--flat-output", "--index", "--single-fixture-per-file"], + ["--flat-output", "--single-fixture-per-file"], [ Path("fixtures/blockchain_tests/paris_one__fork_Paris_blockchain_test.json"), Path("fixtures/state_tests/paris_one__fork_Paris_state_test.json"), @@ -526,13 +495,12 @@ def test_shanghai_two(state_test, x): ), ], [1] * 36, - True, id="flat-single-per-file_flat-output", ), ], ) def test_fixture_output_based_on_command_line_args( - testdir, args, expected_fixture_files, expected_fixture_counts, expected_index + testdir, args, expected_fixture_files, expected_fixture_counts ): """ Test: @@ -619,7 +587,7 @@ def test_fixture_output_based_on_command_line_args( config = configparser.ConfigParser() config.read(ini_file) - if expected_index: + if "--skip-index" not in args: assert index_file is not None, f"No {expected_index_file} file was found in {meta_dir}" properties = {key: value for key, value in config.items("fixtures")}