Skip to content

Commit

Permalink
Test for 2.6, 3.5 and 3.6; use stasher for total coverage.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreif committed Dec 8, 2017
1 parent f9aba52 commit cd33a60
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
*.pyc
*.egg
*.egg-info
*.eggs
.coverage
.coverage.*
.idea
.DS_Store
.tox
Expand Down
49 changes: 37 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,45 @@
language: python
sudo: false

python:
- "2.7"
- "3.3"
- "3.4"
python: 3.5

env:
# NOTE: On Travis web page define private STASH_URL, STASH_TOKEN, STASH_SECRET.
global:
- STASH_BOX=$TRAVIS_REPO_SLUG:$TRAVIS_BUILD_NUMBER:$STASH_SECRET
matrix:
- TOXENV=py27
- TOXENV=py34
- TOXENV=py35
- TOXENV=lint
- TOXENV=coverage

matrix:
include:
- env: TOXENV=py26
python: 2.6
- env: TOXENV=py33
python: 3.3
- env: TOXENV=py36
python: 3.6

install:
- if [[ "${TRAVIS_PYTHON_VERSION}" == "2.6" ]]; then pip install importlib unittest2 "markdown<=2.4"; fi
- pip install flake8 python-coveralls
- pip install -e .
- pip install "file://`pwd`#egg=content-io[tests]"
- pip install --upgrade pip
- pip install tox stasher

script:
- make flake8
- coverage run --source cio runtests.py
- coverage report
- if [[ $TOXENV =~ coverage ]] && [ -n "$STASH_SECRET" ]; then
stash pull $STASH_BOX -wc $(TOXENV= tox -l | wc -l);
fi
- if [[ ! $TOXENV =~ coverage ]] || [ -n "$STASH_SECRET" ]; then
tox;
fi
- if [[ $TOXENV =~ py ]] && [ -n "$STASH_SECRET" ]; then
stash push $STASH_BOX $(ls .coverage.*);
fi

after_success:
- coveralls
- if [[ $TOXENV =~ coverage ]]; then
pip install --quiet python-coveralls;
coveralls --ignore-errors;
fi
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
.DEFAULT_GOAL := help

.PHONY: help # shows available commands
help:
@echo "\nAvailable commands:\n\n $(shell sed -n 's/^.PHONY:\(.*\)/ *\1\\n/p' Makefile)"

.PHONY: test
test:
python setup.py test
coverage run setup.py test

.PHONY: test_all # runs tests using detox, combines coverage and reports it
test_all:
detox
make coverage

flake8:
.PHONY: lint
lint:
flake8 cio

.PHONY: install
install:
python setup.py install

.PHONY: develop
develop:
python setup.py develop

.PHONY: coverage
coverage:
coverage run --source cio setup.py test && \
coverage report

.PHONY: clean
clean:
rm -rf .tox/ dist/ *.egg *.egg-info .coverage
20 changes: 18 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
[flake8]
ignore = E501,E731
max-line-length = 100
ignore = E731
max-line-length = 120
exclude = .tox,.git,docs
max-complexity = 12

[coverage:run]
source = cio
branch = True
parallel = True

[coverage:report]
fail_under = 93
skip_covered = True
show_missing = True

# Regex expressions for lines excluded from report
exclude_lines =
pragma: no cover
if __name__ == .__main__.:
raise NotImplementedError
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
version=version,
description='Send content through a highly configurable pipeline including cache, plugin and storage pipes',
long_description=(
'.. image:: https://travis-ci.org/5monkeys/content-io.png?branch=master\n'
'.. image:: https://travis-ci.org/5monkeys/content-io.svg?branch=master\n'
' :target: https://travis-ci.org/5monkeys/content-io\n'
'.. image:: https://coveralls.io/repos/5monkeys/content-io/badge.png?branch=master\n'
'.. image:: https://coveralls.io/repos/5monkeys/content-io/badge.svg?branch=master\n'
' :target: https://coveralls.io/r/5monkeys/content-io?branch=master\n\n'
),
author='Jonas Lundberg',
Expand All @@ -48,6 +48,8 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
],
Expand Down
24 changes: 19 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,26 @@
# and then run "tox" from this directory.

[tox]
envlist = py26, py27, py33, py34
envlist = py26, py27, py33, py34, py35, py36

[testenv]
commands = {envpython} setup.py test
passenv = COVERAGE_FILE
whitelist_externals = make
commands = make test
deps = six
coverage
py26: markdown<=2.4
wheel<0.30

[testenv:py26]
deps = {[testenv]deps}
markdown<=2.4
[testenv:coverage]
basepython = python3.5
skip_install = true
passenv = COVERAGE_FILE
commands = make coverage
deps = coverage

[testenv:lint]
basepython = python3.5
skip_install = true
commands = make lint
deps = flake8

0 comments on commit cd33a60

Please sign in to comment.