Skip to content

Commit

Permalink
Merge pull request #71 from evo-company/benchmark
Browse files Browse the repository at this point in the history
setup simple benchmark
  • Loading branch information
kindermax committed Aug 11, 2022
2 parents 1173fff + fffe05a commit b26a685
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ env
.cache
.pytest_cache
.vscode
.benchmarks
todo
TODO
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ services:
<<: *base
image: hiku-tests

test:
pytest:
<<: *test-base
depends_on:
- pg
command: py.test
entrypoint: py.test

pg:
image: postgres:13-alpine
7 changes: 6 additions & 1 deletion lets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ commands:
test:
description: Run tests
depends: [_build-tests]
cmd: docker-compose run --rm test
cmd: docker-compose run --rm pytest

bench:
description: Run benchmarks
depends: [_build-tests]
cmd: docker-compose run --rm pytest tests/benchmarks $@

flake:
description: Run flake8
Expand Down
1 change: 1 addition & 0 deletions requirements-tests.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ pytest
pytest-cov
pytest-asyncio
faker
pytest-benchmark
20 changes: 18 additions & 2 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#
# This file is autogenerated by pip-compile with python 3.10
# This file is autogenerated by pip-compile with python 3.7
# To update, run:
#
# pip-compile requirements-tests.in
#
astor==0.8.1
# via -r requirements-tests.in
attrs==21.4.0
attrs==22.1.0
# via pytest
coverage[toml]==6.4.2
# via pytest-cov
faker==13.15.1
# via -r requirements-tests.in
importlib-metadata==4.12.0
# via
# pluggy
# pytest
iniconfig==1.1.1
# via pytest
packaging==21.3
Expand All @@ -20,15 +24,20 @@ pluggy==1.0.0
# via pytest
py==1.11.0
# via pytest
py-cpuinfo==8.0.0
# via pytest-benchmark
pyparsing==3.0.9
# via packaging
pytest==7.1.2
# via
# -r requirements-tests.in
# pytest-asyncio
# pytest-benchmark
# pytest-cov
pytest-asyncio==0.19.0
# via -r requirements-tests.in
pytest-benchmark==3.4.1
# via -r requirements-tests.in
pytest-cov==3.0.0
# via -r requirements-tests.in
python-dateutil==2.8.2
Expand All @@ -39,3 +48,10 @@ tomli==2.0.1
# via
# coverage
# pytest
typing-extensions==4.3.0
# via
# faker
# importlib-metadata
# pytest-asyncio
zipp==3.8.1
# via importlib-metadata
Empty file added tests/benchmarks/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions tests/benchmarks/test_read_graphql.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from hiku.query import (
Node,
Field,
)
from hiku.readers.graphql import read


def test_field(benchmark):
parsed_query = benchmark(read, '{ name }', None)
assert parsed_query == Node([Field('name')])

0 comments on commit b26a685

Please sign in to comment.