Skip to content
Merged
Changes from all commits
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
22 changes: 21 additions & 1 deletion tests/benchmarking/test_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,30 @@ def large_graph():
)


def test_build_django(benchmark):
def test_build_django_uncached(benchmark):
"""
Benchmarks building a graph of real package - in this case Django.

In this benchmark, the cache is turned off.
"""
fn = lambda: grimp.build_graph("django", cache_dir=None)
if hasattr(benchmark, "pendantic"):
# Running with pytest-benchmark
benchmark.pedantic(fn, rounds=3)
else:
# Running with codspeed.
benchmark(fn)


def test_build_django_from_cache(benchmark):
"""
Benchmarks building a graph of real package - in this case Django.

This benchmark uses the cache.
"""
# Populate the cache first, before beginning the benchmark.
grimp.build_graph("django")

fn = lambda: grimp.build_graph("django")
if hasattr(benchmark, "pendantic"):
# Running with pytest-benchmark
Expand Down
Loading