Skip to content

Commit 860208c

Browse files
authored
Add test & coverage CI job (#15)
* move dependencies from pyproject.toml to setup.cfg * bump min python to 3.7 * fix oversight in lint.yml * add pytest-cov to [test] deps * add gh actions test and coverage workflow * placeholder test * lint * fail-fast: false * pytest and coverage configuration * test on all three main OSs * exclude MacOS+py3.10 * fix copy/paste oversight * coverage tweak
1 parent 6bde351 commit 860208c

File tree

7 files changed

+62
-18
lines changed

7 files changed

+62
-18
lines changed

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: lint
22

33
on:
44
push:
5-
branches: [ $default-branch ]
5+
branches: [ main ]
66
pull_request:
77

88
jobs:

.github/workflows/test.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
11+
strategy:
12+
fail-fast: false # don't cancel other matrix jobs when one fails
13+
matrix:
14+
python-version: ["3.7", "3.8", "3.9", "3.10"]
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
exclude:
17+
- python-version: "3.10" # as of 2022-02-24, no wheels for py3.10 MacOS x86_64
18+
os: macos-latest
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Set up Python
25+
uses: actions/setup-python@v2
26+
with:
27+
python-version: ${{ matrix.python-version }}
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install .[test]
32+
- name: Run tests
33+
run: |
34+
pytest

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ __pycache__/
88
*.egg-info/
99

1010
# generated documentation
11-
docs/source/generated
11+
docs/source/generated
12+
13+
.coverage

pyproject.toml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,3 @@ requires = [
44
"wheel"
55
]
66
build-backend = "setuptools.build_meta"
7-
8-
[project]
9-
dependencies = [
10-
'pvlib',
11-
'numpy',
12-
'pandas',
13-
'matplotlib',
14-
'shapely',
15-
]
16-
17-
[project.optional-dependencies]
18-
tests = [
19-
'pytest',
20-
]

setup.cfg

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,20 @@ classifiers =
1818

1919
[options]
2020
packages = twoaxistracking
21-
python_requires = >=3.6
21+
python_requires = >=3.7
22+
install_requires =
23+
pvlib
24+
numpy
25+
pandas
26+
matplotlib
27+
shapely
28+
29+
[options.extras_require]
30+
test = pytest;pytest-cov;
31+
32+
[tool:pytest]
33+
addopts = --cov=twoaxistracking --cov-fail-under=100 --cov-report=term-missing
34+
35+
[coverage:run]
36+
# don't count the test files themselves towards coverage
37+
omit = twoaxistracking/tests/*

twoaxistracking/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
try:
66
from shapely.geos import lgeos # noqa: F401
7-
except OSError as err:
7+
except OSError as err: # pragma: no cover
88
msg = (
99
"An error was encountered when importing the shapely package. "
1010
"This often happens when a binary dependency is missing because "
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import pytest # noqa: F401
2+
import twoaxistracking # noqa: F401
3+
4+
5+
def test_placeholder():
6+
pass

0 commit comments

Comments
 (0)