Skip to content

Commit

Permalink
test: implement basic benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
unexcellent committed Dec 11, 2024
1 parent b6dd1db commit cefc05b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
15 changes: 15 additions & 0 deletions benchmarking/bench_quantity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest

from quantio import Time


def init_only_base_unit():
Time(seconds=1)


def bench_init(benchmark):
benchmark.pedantic(init_only_base_unit, iterations=100, rounds=100)


if __name__ == "__main__":
pytest.main([__file__, "-v"])
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ ruff = "<1.0"

[tool.poetry.group.test.dependencies]
pytest = "<9.0"
pytest_benchmark = "<6.0"

[tool.ruff]
exclude = ["sandbox/*"]
line-length = 101

[tool.ruff.lint]
exclude = ["test/*", "generate/*"]
exclude = ["benchmarking/*", "generate/*", "test/*"]
select = ["ALL"]
ignore = [
"COM812", # conflicts with ruff formatter
Expand Down Expand Up @@ -61,5 +63,7 @@ ignore_missing_imports = true
disable_error_code = ["call-arg"]

[tool.pytest.ini_options]
testpaths = ["test"]
python_functions = ["test_*", "bench_*"]
python_files = ["test_*.py"]
testpaths = ["test", "benchmarking"]
xfail_strict = true

0 comments on commit cefc05b

Please sign in to comment.