Skip to content

Commit

Permalink
benchmark performance of import
Browse files Browse the repository at this point in the history
Do a benchmark before working on #522

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed May 11, 2024
1 parent 82de1f1 commit 89fe364
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Run benchmarks
uses: CodSpeedHQ/action@v2
with:
token: ${{ secrets.CODSPEED_TOKEN }}
run: pytest tests/benchmark/ --codspeed
pass:
needs: [build]
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ docs = [
'jupyterlite-sphinx',
'jupyterlite-xeus-python',
]
test = [
'pytest',
'pytest-codspeed',
]

[tool.setuptools.packages.find]
include = ["dpdata*"]
Expand Down
Empty file added tests/benchmark/__init__.py
Empty file.
13 changes: 13 additions & 0 deletions tests/benchmark/test_import.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
import subprocess
import sys

@pytest.mark.benchmark
def test_import():
"""Test import dpdata."""
subprocess.check_output([sys.executable, "-c", "'from dpdata import LabeledSystem'"]).decode("ascii")

@pytest.mark.benchmark
def test_cli():
"""Test dpdata command."""
subprocess.check_output([sys.executable, "-m", "dpdata", "-h"]).decode("ascii")

0 comments on commit 89fe364

Please sign in to comment.