-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
benchmark performance of import (#653)
Do a benchmark before working on #526 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced benchmark tests for import functionality and command line interface operations. - **Tests** - Added new benchmark tests to assess performance improvements. - **Chores** - Integrated `pytest` and `pytest-codspeed` into the project for enhanced testing capabilities. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7bb74f4
commit 02309f7
Showing
4 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Python package | ||
|
||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
- run: curl -LsSf https://astral.sh/uv/install.sh | sh | ||
- name: Install dependencies | ||
run: uv pip install --system .[amber,ase,pymatgen,benchmark] rdkit openbabel-wheel | ||
- name: Run benchmarks | ||
uses: CodSpeedHQ/action@v2 | ||
with: | ||
token: ${{ secrets.CODSPEED_TOKEN }} | ||
run: pytest benchmark/ --codspeed |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import subprocess | ||
import sys | ||
|
||
import pytest | ||
|
||
|
||
@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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters