Skip to content

Commit

Permalink
Merge pull request #22 from Hekstra-Lab/testing
Browse files Browse the repository at this point in the history
Add automated testing to `rs-booster`
  • Loading branch information
JBGreisman authored Aug 31, 2022
2 parents 0fcb802 + 7a467d7 commit 95a9b16
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 1 deletion.
37 changes: 37 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']

# Skip CI if 'skip ci' is contained in latest commit message
if: "!contains(github.event.head_commit.message, 'skip ci')"

steps:

- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install rsbooster
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Test with pytest
run: |
python -m pytest
9 changes: 8 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
[metadata]
description_file = README.md
description_file = README.md

[aliases]
test=pytest

[tool:pytest]
addopts = -n auto

3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def getVersionNumber():
"Source Code": "https://github.com/Hekstra-Lab/rs-booster",
}

# Testing requirements
tests_require = ["pytest", "pytest-xdist", "pytest-runner"]

setup(
name="rs-booster",
Expand All @@ -36,6 +38,7 @@ def getVersionNumber():
project_urls=PROJECT_URLS,
python_requires=">3.7",
install_requires=["reciprocalspaceship", "matplotlib", "seaborn"],
extras_require={"dev": tests_require},
entry_points={
"console_scripts": [
"rs.extrapolate=rsbooster.esf.extrapolate:main",
Expand Down
Empty file added tests/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions tests/test_rsbooster.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import rsbooster


def test_version():
"""
Test rsbooster.getVersionNumber() method exists and gives same result as
rsbooster.__version__
"""
assert rsbooster.getVersionNumber() == rsbooster.__version__

0 comments on commit 95a9b16

Please sign in to comment.