Skip to content

Commit 6e5e51e

Browse files
committed
add benchmark_main pytest group
1 parent 2ca0ede commit 6e5e51e

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/benchmark.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,21 @@ jobs:
2929
RUST_BACKTRACE: 1
3030

3131
- name: Run Benchmarks.
32-
run: uv run pytest . --benchmark-enable --benchmark-json=output.json
32+
run: uv run pytest . -m benchmark_main --benchmark-enable --benchmark-json=output.json
3333

3434
- name: Upload benchmark artifact
3535
uses: actions/upload-artifact@v4
3636
with:
3737
name: benchmark-output
3838
path: output.json
39+
3940
- name: Benchmark results
4041
uses: benchmark-action/github-action-benchmark@v1
4142
with:
4243
tool: 'pytest'
4344
output-file-path: output.json
44-
external-data-json-path: ./cache/benchmark-data.json
45-
fail-on-alert: true
46-
alert-threshold: '10%'
4745
# to make a commit comment
4846
github-token: ${{ secrets.GITHUB_TOKEN }}
49-
comment-on-alert: true
5047
summary-always: true
5148

5249
- name: Append benchmark table to summary

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ all = [
6060
]
6161

6262
[tool.pytest.ini_options]
63+
markers = [
64+
'benchmark_main: marks tests as main benchmarks to run selectively'
65+
]
6366
addopts = [
6467
'--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations',
6568
'--benchmark-disable', # use --benchmark-enable

pytests/test_dag_cbor.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,13 @@ def test_dag_cbor_decode(benchmark, data) -> None:
101101
_dag_cbor_roundtrip(benchmark, data)
102102

103103

104+
@pytest.mark.benchmark_main
104105
@pytest.mark.parametrize('data', load_json_data_fixtures(_REAL_DATA_DIR), ids=lambda data: data[0])
105106
def test_dag_cbor_encode_real_data(benchmark, data) -> None:
106107
_dag_cbor_encode(benchmark, data)
107108

108109

110+
@pytest.mark.benchmark_main
109111
@pytest.mark.parametrize('data', load_json_data_fixtures(_REAL_DATA_DIR), ids=lambda data: data[0])
110112
def test_dag_cbor_decode_real_data(benchmark, data) -> None:
111113
_dag_cbor_roundtrip(benchmark, data)
@@ -116,6 +118,7 @@ def test_dag_cbor_decode_fixtures(benchmark, data) -> None:
116118
_dag_cbor_decode(benchmark, data)
117119

118120

121+
@pytest.mark.benchmark_main
119122
def test_dag_cbor_decode_torture_cids(benchmark) -> None:
120123
dag_cbor = open(_TORTURE_CIDS_DAG_CBOR_PATH, 'rb').read()
121124
benchmark(libipld.decode_dag_cbor, dag_cbor)

pytests/test_decode_car.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def car() -> bytes:
1414
return load_car_fixture(_DID, _REPO_CAR_PATH)
1515

1616

17+
@pytest.mark.benchmark_main
1718
def test_decode_car(benchmark, car) -> None:
1819
header, blocks = benchmark(libipld.decode_car, car)
1920

0 commit comments

Comments
 (0)