Skip to content

Commit

Permalink
Merge pull request #17 from monarch-initiative/issue_13
Browse files Browse the repository at this point in the history
Add GH action for pytest
  • Loading branch information
justaddcoffee authored May 10, 2024
2 parents 64ac297 + fd6f658 commit 6c3dca5
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 7 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/qc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Built from:
# https://docs.github.com/en/actions/guides/building-and-testing-python
# https://github.com/snok/install-poetry#workflows-and-tips

name: Build and test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
# lint:
# runs-on: ubuntu-latest
# continue-on-error: true # This line allows the job to continue even if errors occur
# strategy:
# matrix:
# python-version: [ '3.9', '3.10' ]
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4.3.0
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# pip install tox
# - name: Check code quality with flake8
# run: tox -e flake8

test:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest ]
python-version: [ "3.10" ]
exclude:
- os: windows-latest
python-version: "3.10"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.3.1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Run Doctests
run: poetry run tox -e doctest
- name: Generate coverage results
run: |
poetry run pip install -U pytest
poetry run coverage run -p -m pytest tests/
poetry run coverage combine
poetry run coverage xml
poetry run coverage report -m
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ data/*
prompts/*
inputdir
outputdir
.openai_cache.db
99 changes: 96 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ pytest = "^7.1.2"
pylint = "^2.15.6"
pycodestyle = "^2.10.0"
coverage = "^6.5.0"
# https://github.com/monarch-initiative/ontogpt.git branch multilanguage_gpt
ontogpt = {git = "https://github.com/monarch-initiative/ontogpt.git", branch = "multilanguage_gpt"}
ontogpt = {git = "https://github.com/monarch-initiative/ontogpt.git", branch = "main"}

[tool.poetry.group.dev.dependencies]
tox = "^4.15.0"

[tool.pytest.ini_options]
pythonpath = [
Expand Down
15 changes: 13 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ commands =
flake8 src/ tests/
description = Run the flake8 tool with several plugins (bandit, docstrings, import order, pep8 naming).

[testenv:doctest]
deps =
pytest
pytest-cov
isolated_build = true
allowlist_externals = poetry
commands_pre =
poetry install
commands =
pytest --doctest-modules src/

#########################
# Flake8 Configuration #
# (.flake8) #
Expand All @@ -66,7 +77,7 @@ ignore =
#S603 # subprocess call - check for execution of untrusted input.
S607 # Starting a process with a partial executable path ["open" in both cases]
#S608 # Possible SQL injection vector through string-based query construction.
#B024 # StreamingWriter is an abstract base class, but it has no abstract methods.
#B024 # StreamingWriter is an abstract base class, but it has no abstract methods.
# Remember to use @abstractmethod, @abstractclassmethod and/or @abstractproperty decorators.
#B027 # empty method in an abstract base class, but has no abstract decorator. Consider adding @abstractmethod
#N803 # math-oriented classes can ignore this (e.g. hypergeometric.py)
Expand All @@ -80,4 +91,4 @@ application-import-names =
pheval_template
tests
# exclude =
# datamodels ## datamodels are auto-generated
# datamodels ## datamodels are auto-generated

0 comments on commit 6c3dca5

Please sign in to comment.