Skip to content

Commit

Permalink
Split benchmark for registry creation
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Jul 14, 2023
1 parent 87ab63f commit a673f20
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions pint/testsuite/benchmarks/test_01_registry_creation.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import pytest

import pint


@pytest.mark.parametrize("args", [[(None,), tuple(), ("tiny",), ("", None)]])
def test_create_registry(benchmark, tiny_definition_file, args):
if args[0] == "tiny":
args = (tiny_definition_file, args[1:])
def test_create_empty_registry(benchmark):
benchmark(
pint.UnitRegistry,
)


def test_create_tiny_registry(benchmark, tiny_definition_file):
benchmark(pint.UnitRegistry, tiny_definition_file)


def test_create_default_registry(benchmark):
benchmark(
pint.UnitRegistry,
)


@benchmark
def _():
if len(args) == 2:
pint.UnitRegistry(args[0], cache_folder=args[1])
else:
pint.UnitRegistry(*args)
def test_create_default_registry_no_cache(benchmark):
benchmark(pint.UnitRegistry, cache_folder=None)

0 comments on commit a673f20

Please sign in to comment.