diff --git a/.gitignore b/.gitignore index ac1ef8af..75441b56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ __pycache__ *.pyc .idea +*.egg-info/ +.tox/ diff --git a/.travis.yml b/.travis.yml index 8e5abf9e..ae71d86a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,25 @@ -# vim ft=yaml dist: xenial language: python sudo: false -python: - - "2.7" - - "3.6" - - "3.7" +matrix: + include: + - python: "2.7" + env: TOXENV=ci27 + - python: "3.6" + env: TOXENV=ci36 + - python: "3.7" + env: TOXENV=ci37 cache: - pip install: - - pip install -r requirements-dev.txt + - pip install tox script: - - if [ "${TRAVIS_PYTHON_VERSION:0:1}" = 2 ]; then export PYEXCLUDE=3; else export PYEXCLUDE=2; fi - - flake8 --exclude="*__py${PYEXCLUDE}.py" patterns/ - - pytest --doctest-modules --ignore-glob="*__py${PYEXCLUDE}.py" patterns/ - - pytest -s -vv --cov=. --log-level=INFO tests/ - # Actually run all the scripts, contributing to coverage - - PYTHONPATH=. ./run_all.sh + - tox after_success: - codecov diff --git a/setup.py b/setup.py index 07c495dc..80930a8b 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,8 @@ -from setuptools import setup +from setuptools import setup, find_packages setup( - name="python-patterns", + name="patterns", + packages=find_packages(), description="A collection of design patterns and idioms in Python.", classifiers=[ "Programming Language :: Python :: 2", diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..911b7bfd --- /dev/null +++ b/tox.ini @@ -0,0 +1,42 @@ +[tox] +envlist = ci27,ci36,ci37,cov-report + + +[testenv] +setenv = + COVERAGE_FILE = .coverage.{envname} + +[testenv:ci27] +basepython = python2.7 +deps = + -r requirements-dev.txt +commands = + flake8 --exclude="*__py3.py" patterns/ + pytest --doctest-modules --ignore-glob="*__py3.py" patterns/ + pytest -s -vv --cov={envsitepackagesdir}/patterns --log-level=INFO tests/ + +[testenv:ci36] +basepython = python3.6 +deps = + -r requirements-dev.txt +commands = + flake8 --exclude="*__py2.py" patterns/ + pytest --doctest-modules --ignore-glob="*__py2.py" patterns/ + pytest -s -vv --cov={envsitepackagesdir}/patterns --log-level=INFO tests/ + +[testenv:ci37] +basepython = python3.7 +deps = + -r requirements-dev.txt +commands = + flake8 --exclude="*__py2.py" patterns/ + pytest --doctest-modules --ignore-glob="*__py2.py" patterns/ + pytest -s -vv --cov={envsitepackagesdir}/patterns --log-level=INFO tests/ + +[testenv:cov-report] +setenv = + COVERAGE_FILE = .coverage +deps = coverage +commands = + coverage combine + coverage report