Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add benchmarks #1561

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ jobs:
run: pyright
- name: Test with tox
run: tox -e py
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1
with:
name: Python Benchmark with pytest-benchmark
tool: 'pytest'
output-file-path: ./tests/benchmark-${{ matrix.python }}.json
# Use personal access token instead of GITHUB_TOKEN due to https://github.community/t/github-action-not-triggering-gh-pages-upon-push/16096
github-token: ${{ secrets.GITHUB_TOKEN }}
auto-push: true
# Show alert with commit comment on detecting possible performance regression
alert-threshold: '150%'
comment-on-alert: true
fail-on-alert: true
alert-comment-cc-users: '@pcriadoperez'
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
Expand Down
1 change: 1 addition & 0 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pytest-asyncio
pytest-cov
pytest-xdist
pytest-rerunfailures
pytest-benchmark
requests-mock
tox
setuptools
Expand Down
1 change: 1 addition & 0 deletions tests/benchmark-3.10.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions tests/benchmark-3.11.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions tests/benchmark-3.12.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions tests/benchmark-3.7.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions tests/benchmark-3.8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions tests/benchmark-3.9.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 6 additions & 0 deletions tests/test_ws_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ async def test_ws_api_public_endpoint(clientAsync):
order_book = await clientAsync.ws_get_order_book(symbol="BTCUSDT")
assert_ob(order_book)

@pytest.mark.asyncio
@pytest.mark.benchmark(group="ws_api")
async def test_benchmark_ws_api_get_order_book(clientAsync, benchmark):
"""Test normal order book request"""
order_book = await benchmark(clientAsync.ws_get_order_book, symbol="BTCUSDT")
assert_ob(order_book)

@pytest.mark.asyncio
async def test_ws_api_private_endpoint(clientAsync):
Expand Down
Loading