Skip to content

Instantly share code, notes, and snippets.

View koffie's full-sized avatar
🕺

Maarten Derickx koffie

🕺
View GitHub Profile
@koffie
koffie / !conftest.py
Last active December 1, 2021 19:28
A pytest fixture together with a makefile that allow you generate nice profiling graphs from tests
import cProfile, os, pathlib
from pytest import fixture
PROFILING_DIR = pathlib.Path("/tmp") # wherever you want the resulting files to show up
@fixture()
def profile(request):
"""
Use this fixture in a test to profile the test. The test results end up as
pstats files in: