Skip to content

Commit

Permalink
Fixes #87 Added support for testing multiple python versions
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFriendlyCoder committed Jul 19, 2020
1 parent 6a80833 commit 7b37b37
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .python-version
@@ -1 +1,3 @@
3.5.6
3.8.0
pypy3.5-7.0.0
21 changes: 13 additions & 8 deletions .travis.yml
@@ -1,39 +1,44 @@
language: python

# Test against the oldest and newest supported version of Python only
# NOTE: there appears to only be 1 version of pypy available on Travis
# right now, so we just test against that one version
python:
- 3.5
- 3.7
- 3.8
- pypy3.5

install:
# pinning coverage package until bugs with coveralls plugin is fixed
# https://github.com/z4r/python-coveralls/issues/73
- pip install tox tox-factor wheel python-coveralls "coverage<5.0"
- pip install tox wheel python-coveralls "coverage<5.0"

script:
- echo $TRAVIS_PYTHON_VERSION
- export PYVER=`echo $TRAVIS_PYTHON_VERSION | tr "." "\n" | head -n 1 | sed 's/^py//'`
- export PYVER=`echo $TRAVIS_PYTHON_VERSION | sed 's/\.//'`
- echo $PYVER
- tox -e py$PYVER-lint
- tox -e py$PYVER-test
- '[ "$TRAVIS_PYTHON_VERSION" = "3.7" ] && coveralls || echo Skipping Coveralls'
- tox -e $PYVER-lint
- tox -e $PYVER-test
# Only publish coverage metrics for the latest supported Python version
- '[ "$TRAVIS_PYTHON_VERSION" = "3.8" ] && coveralls || echo Skipping Coveralls'

# Deploy to test.pypi.org for branches
# Deploy to pypi.org for tags
# NOTE: You can not replace builds published to pypi, even if you delete one
# so you must make sure your versions are always unique
# NOTE: We also restrict publishing of packages using the latest supported
# Python version so we don't publish redundant packages
jobs:
include:
- stage: deploy-release
python: 3.7
python: 3.8
script:
- pip install twine
- python setup.py bdist_wheel
- twine upload dist/*.whl -u $DEPLOY_USER -p $DEPLOY_PASS
if: tag IS true
- stage: deploy-snapshot
python: 3.7
python: 3.8
script:
- pip install twine
- python setup.py bdist_wheel
Expand Down
2 changes: 1 addition & 1 deletion project.prop
Expand Up @@ -12,7 +12,6 @@
"pillow"
],
"DEV_DEPENDENCIES" : [
"twine",
"pytest",
"pytest-cov",
"mock",
Expand All @@ -22,6 +21,7 @@
"sphinx-rtd-theme",
"tox",
"tox-factor",
"tox-pyenv",
# pinning coverage package until bugs with coveralls plugin is fixed
# https://github.com/z4r/python-coveralls/issues/73
"coverage<5.0"
Expand Down
7 changes: 1 addition & 6 deletions requirements.txt
Expand Up @@ -3,7 +3,6 @@ appdirs==1.4.4
astroid==2.4.2
attrs==19.3.0
Babel==2.8.0
bleach==3.1.5
certifi==2020.6.20
chardet==3.0.4
coverage==4.5.4
Expand All @@ -26,7 +25,6 @@ packaging==20.4
pathlib2==2.3.5
pbr==5.4.5
Pillow==7.2.0
pkginfo==1.5.0.1
pluggy==0.13.1
py==1.9.0
Pygments==2.6.1
Expand All @@ -36,9 +34,7 @@ pytest==5.4.3
pytest-cov==2.10.0
python-dateutil==2.8.1
pytz==2020.1
readme-renderer==26.0
requests==2.24.0
requests-toolbelt==0.9.1
six==1.15.0
snowballstemmer==2.0.0
Sphinx==3.1.2
Expand All @@ -53,12 +49,11 @@ sphinxcontrib-serializinghtml==1.1.4
toml==0.10.1
tox==3.17.1
tox-factor==0.1.2
tox-pyenv==1.1.0
tqdm==4.48.0
twine==1.15.0
typed-ast==1.4.1
urllib3==1.25.9
virtualenv==20.0.27
wcwidth==0.2.5
webencodings==0.5.1
wrapt==1.12.1
zipp==1.2.0
27 changes: 20 additions & 7 deletions tox.ini
@@ -1,22 +1,35 @@
[tox]
envlist = {py3,pypy3}-{lint,test,docs}
skip_missing_interpreters=False
# explicitly set python versions to make it possible to run tests in parallel
# using pyenv
# pypy is an exception case because there is no pypy3.# alias with a patch
# number, at least on macos
# we omit the ambiguous "py3" factor so as to not run the tests for a superfluous
# version that is being run elsewhere
envlist = py{35,38,py3}-{lint,test,docs}
skip_missing_interpreters=True

[testenv]
setenv =
PROJECT_PATH=friendlypins

usedevelop=True

# Separate working folders for each python version
envdir =
py3: {toxworkdir}/py3
py35: {toxworkdir}/py35
py38: {toxworkdir}/py38
pypy3: {toxworkdir}/pypy3

# Use consistent set of dependencies for each major Python version
# helps minimize overhead of dependency management
deps =
py3: -rrequirements.txt
py{35,38}: -rrequirements.txt
pypy3: -rpypyrequirements.txt

# restrict running of non-test operations to just the latest supported Python
# version - v3.8 in this case
commands =
py3-lint: python -m pylint setup.py
py3-lint: python -m pylint ./src/{env:PROJECT_PATH}
py38-lint: python -m pylint setup.py
py38-lint: python -m pylint ./src/{env:PROJECT_PATH}
test: python -m pytest {posargs} ./tests -v --cov-report html --cov {env:PROJECT_PATH} --no-cov-on-fail
py3-docs: python -m sphinx -b html -a -n -W --keep-going ./docs ./htmldocs
py38-docs: python -m sphinx -b html -a -n -W --keep-going ./docs ./htmldocs

0 comments on commit 7b37b37

Please sign in to comment.