Skip to content

Commit eea8e00

Browse files
authored
Add automated testing with tox (#40)
* Add automated testing with tox * Add readme badge
1 parent 3156f69 commit eea8e00

File tree

6 files changed

+71
-0
lines changed

6 files changed

+71
-0
lines changed

.github/workflows/run-tests.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Run Tests
2+
on:
3+
push:
4+
pull_request:
5+
6+
concurrency:
7+
group: test-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
test:
12+
name: test with ${{ matrix.py }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
py:
18+
- "3.12"
19+
- "3.11"
20+
- "3.10"
21+
- "3.9"
22+
steps:
23+
- uses: actions/checkout@v3
24+
with:
25+
fetch-depth: 0
26+
- name: Setup python for test ${{ matrix.py }}
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.py }}
30+
- name: Install tox
31+
run: python -m pip install tox-gh>=1.2
32+
- name: Setup test suite
33+
run: tox -vv --notest
34+
- name: Run test suite
35+
run: tox --skip-pkg-install

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
![Tests](https://github.com/djcopley/ShellOracle/actions/workflows/run-tests.yml/badge.svg?branch=main)
12
[![PyPI version](https://badge.fury.io/py/shelloracle.svg)](https://badge.fury.io/py/shelloracle)
23
[![PyPI Supported Python Versions](https://img.shields.io/pypi/pyversions/shelloracle.svg)](https://pypi.python.org/pypi/shelloracle/)
34
[![Downloads](https://static.pepy.tech/badge/shelloracle/month)](https://pepy.tech/project/shelloracle)

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ where = ["src"]
4141

4242
[tool.setuptools_scm]
4343

44+
[tool.pytest.ini_options]
45+
pythonpath = "src"
46+
addopts = [
47+
"--import-mode=importlib",
48+
]
49+
4450
[project.scripts]
4551
shor = "shelloracle.__main__:main"
4652

tests/providers/test_ollama.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from shelloracle.providers.ollama import Ollama
2+
3+
4+
def test_name():
5+
assert Ollama.name == "Ollama"

tests/providers/test_openai.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from shelloracle.providers.openai import OpenAI
2+
3+
4+
def test_name():
5+
assert OpenAI.name == "OpenAI"

tox.ini

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[tox]
2+
requires =
3+
tox>=4
4+
env_list = py{39,310,311,312}
5+
6+
[testenv]
7+
description = run unit tests with pytest
8+
deps =
9+
pytest>=7
10+
pytest-sugar
11+
commands =
12+
pytest {posargs:tests}
13+
14+
[gh]
15+
python =
16+
3.12 = py312
17+
3.11 = py311
18+
3.10 = py310
19+
3.9 = py39

0 commit comments

Comments
 (0)