-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from USEPA/develop
adding install testing via github actions for v1.0.1 release
- Loading branch information
Showing
6 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# This workflow will install Python dependencies, run tests and lint | ||
# across operating systems, select versions of Python, and user + dev environments | ||
# For more info see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Python install test | ||
|
||
on: | ||
push: | ||
branches: [master, develop] | ||
pull_request: | ||
branches: [master, develop] | ||
workflow_dispatch: # also allow manual trigger, for testing purposes | ||
|
||
jobs: | ||
test_install: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: # max 256 jobs per workflow | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
py-version: [3.8, 3.9] | ||
build-type: [user, dev] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
# general Python setup | ||
- name: Set up Python ${{ matrix.py-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.py-version }} | ||
- name: Update pip & install testing pkgs | ||
run: | | ||
python -VV | ||
python -m pip install --upgrade pip setuptools wheel | ||
pip install pytest pytest-cov flake8 | ||
# developer environment, install specific packages from requirements.txt | ||
- name: Install dev dependencies (non-Windows) | ||
if: matrix.build-type == 'dev' && matrix.os != 'windows-latest' | ||
run: | | ||
pip install -r requirements.txt | ||
pip install . | ||
- name: Install dev dependencies (Windows) | ||
if: matrix.build-type == 'dev' && matrix.os == 'windows-latest' | ||
run: | | ||
pip install -r requirements.txt -r impactworld_requirements.txt | ||
pip install . | ||
# user environment install latest from setup.py | ||
- name: Install user dependencies (non-Windows) | ||
if: matrix.build-type == 'user' && matrix.os != 'windows-latest' | ||
run: pip install . | ||
- name: Install user dependencies (Windows) | ||
if: matrix.build-type == 'user' && matrix.os == 'windows-latest' | ||
run: pip install .[ImpactWorld] | ||
# MS Access install (for Windows) needed for IW+ | ||
- name: Choco install msaccess2010 | ||
if: matrix.os == 'windows-latest' | ||
uses: crazy-max/ghaction-chocolatey@v1 | ||
with: | ||
args: install msaccess2010-redist | ||
# linting with flake8 | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
# initiate tests with pytest | ||
- name: Test with pytest | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[pytest] | ||
log_cli = True | ||
log_cli_level = DEBUG | ||
log_file = tests.log | ||
log_file_level = DEBUG | ||
norecursedirs=dist build | ||
addopts = --cov=lciafmt --cov-report=term-missing | ||
testpaths = | ||
tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pytest | ||
pytest-cov | ||
flake8 |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Test for the presence of pyodbc + MS Access driver.""" | ||
|
||
import logging | ||
import sys | ||
|
||
import pytest | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@pytest.mark.skipif(sys.platform != "win32", reason="PYDOBC only on windows") | ||
def test_find_pyodbc_driver(): | ||
"""In wind32 platform, pyodbc must be installed, with MS Access drivers.""" | ||
try: | ||
import pyodbc # pylint: disable=C0415 | ||
except ImportError: | ||
logger.error( | ||
"""Must install pyodbc for ImpactWorld.""" | ||
"""See install instructions for optional package""" | ||
"""installation or install it indepedently and retry.""" | ||
) | ||
driver_check = list(pyodbc.drivers()) | ||
driver_found = any("Microsoft Access Driver" in word for word in driver_check) | ||
logger.debug("Found pyodbc drivers: %s", driver_check) | ||
assert driver_found is True |