Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge EditableReport into Report #549

Merged
merged 2 commits into from
Mar 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Hardcode class in benchmarks
  • Loading branch information
Swatinem committed Mar 3, 2025
commit dcf251ef50f2c6a0422f6735c58171a30f137d9f
21 changes: 8 additions & 13 deletions tests/benchmarks/test_report.py
Original file line number Diff line number Diff line change
@@ -22,8 +22,6 @@ def read_fixture(name: str) -> bytes:
pytest.param(ReadOnlyReport, True, id="Rust ReadOnlyReport"),
]

EDITABLE_VARIANTS = [Report]


def init_mocks(mocker, should_load_rust) -> tuple[bytes, bytes]:
mocker.patch(
@@ -143,7 +141,7 @@ def test_report_diff_calculation(mocker, do_filter, benchmark):
raw_chunks, raw_report_json = init_mocks(mocker, False)
diff = load_diff()

report = do_parse(Report, raw_report_json, raw_chunks)
report = do_full_parse(Report, raw_report_json, raw_chunks)
if do_filter:
report = report.filter(paths=[".*"], flags=["unit"])

@@ -153,11 +151,10 @@ def bench_fn():
benchmark(bench_fn)


@pytest.mark.parametrize("report_class", EDITABLE_VARIANTS)
def test_report_serialize(report_class, mocker, benchmark):
def test_report_serialize(mocker, benchmark):
raw_chunks, raw_report_json = init_mocks(mocker, False)

report = do_parse(report_class, raw_report_json, raw_chunks)
report = do_parse(Report, raw_report_json, raw_chunks)

def bench_fn():
report.to_database()
@@ -166,24 +163,22 @@ def bench_fn():
benchmark(bench_fn)


@pytest.mark.parametrize("report_class", EDITABLE_VARIANTS)
def test_report_merge(report_class, mocker, benchmark):
def test_report_merge(mocker, benchmark):
raw_chunks, raw_report_json = init_mocks(mocker, False)

report1 = do_parse(report_class, raw_report_json, raw_chunks)
report2 = do_parse(report_class, raw_report_json, raw_chunks)
report2 = do_full_parse(Report, raw_report_json, raw_chunks)

def bench_fn():
report1 = do_parse(Report, raw_report_json, raw_chunks)
report1.merge(report2)

benchmark(bench_fn)


@pytest.mark.parametrize("report_class", EDITABLE_VARIANTS)
def test_report_carryforward(report_class, mocker, benchmark):
def test_report_carryforward(mocker, benchmark):
raw_chunks, raw_report_json = init_mocks(mocker, False)

report = do_parse(report_class, raw_report_json, raw_chunks)
report = do_full_parse(Report, raw_report_json, raw_chunks)

def bench_fn():
generate_carryforward_report(report, paths=[".*"], flags=["unit"])
Loading
Oops, something went wrong.