Skip to content

Commit

Permalink
Azure test workflow -> GitHub pytest workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
tjkessler committed Aug 1, 2023
1 parent 039488c commit 48c5869
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 64 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Run PaDELPy tests

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install pytest pytest-md
- name: Install package
run: python -m pip install .
- name: Run tests
uses: pavelzw/pytest-action@v2
with:
emoji: false
report-title: 'PaDELPy test report'
26 changes: 0 additions & 26 deletions azure-pipelines.yml

This file was deleted.

7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ classifiers = [

[project.urls]
"Homepage" = "https://github.com/ecrl/padelpy"
"Bug Tracker" = "https://github.com/ecrl/padelpy/issues"
"Bug Tracker" = "https://github.com/ecrl/padelpy/issues"

[tool.pytest.ini_options]
filterwarnings = [
"ignore::DeprecationWarning",
]
37 changes: 0 additions & 37 deletions tests/test.py

This file was deleted.

34 changes: 34 additions & 0 deletions tests/test_all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import pytest

from padelpy import from_sdf, from_smiles


def test_from_smiles():
descriptors = from_smiles('CCC')
assert len(descriptors) == 1875
assert float(descriptors['MW']) == pytest.approx(44.0626, 1e-4)
assert int(descriptors['nC']) == 3


def test_multiple_smiles():
smiles = ['CCC', 'CCCC']
descriptors = from_smiles(smiles)
assert len(descriptors) == 2
assert len(descriptors[0]) == 1875


def test_errors():
bad_smiles = 'SJLDFGSJ'
with pytest.raises(RuntimeError):
_ = from_smiles(bad_smiles)
bad_smiles = ['SJLDFGSJ', 'CCC']
with pytest.raises(RuntimeError):
_ = from_smiles(bad_smiles)


def test_from_sdf():
descriptors = from_sdf('tests/aspirin_3d.sdf')[0]
assert len(descriptors) == 1875
assert float(descriptors['MW']) == pytest.approx(180.04225, 1e-4)
assert float(descriptors['SsCH3']) == pytest.approx(1.2209, 1e-4)
assert int(descriptors['nC']) == 9

0 comments on commit 48c5869

Please sign in to comment.