Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automated testing with tox #40

Merged
merged 2 commits into from
Jan 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Tests
on:
push:
pull_request:

concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: test with ${{ matrix.py }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
py:
- "3.12"
- "3.11"
- "3.10"
- "3.9"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup python for test ${{ matrix.py }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Install tox
run: python -m pip install tox-gh>=1.2
- name: Setup test suite
run: tox -vv --notest
- name: Run test suite
run: tox --skip-pkg-install
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
![Tests](https://github.com/djcopley/ShellOracle/actions/workflows/run-tests.yml/badge.svg?branch=main)
[![PyPI version](https://badge.fury.io/py/shelloracle.svg)](https://badge.fury.io/py/shelloracle)
[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/shelloracle.svg)](https://pypi.python.org/pypi/shelloracle/)
[![Downloads](https://static.pepy.tech/badge/shelloracle/month)](https://pepy.tech/project/shelloracle)
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ where = ["src"]

[tool.setuptools_scm]

[tool.pytest.ini_options]
pythonpath = "src"
addopts = [
"--import-mode=importlib",
]

[project.scripts]
shor = "shelloracle.__main__:main"

Expand Down
5 changes: 5 additions & 0 deletions tests/providers/test_ollama.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from shelloracle.providers.ollama import Ollama


def test_name():
assert Ollama.name == "Ollama"
5 changes: 5 additions & 0 deletions tests/providers/test_openai.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from shelloracle.providers.openai import OpenAI


def test_name():
assert OpenAI.name == "OpenAI"
19 changes: 19 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[tox]
requires =
tox>=4
env_list = py{39,310,311,312}

[testenv]
description = run unit tests with pytest
deps =
pytest>=7
pytest-sugar
commands =
pytest {posargs:tests}

[gh]
python =
3.12 = py312
3.11 = py311
3.10 = py310
3.9 = py39