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 #8 from andreif/feature/test-for-35-and-36
Test for Python 2.6, 3.5 and 3.6.
- Loading branch information
Showing
8 changed files
with
104 additions
and
40 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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
*.pyc | ||
*.egg | ||
*.egg-info | ||
*.eggs | ||
.coverage | ||
.coverage.* | ||
.idea | ||
.DS_Store | ||
.tox | ||
|
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -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 combine || true | ||
coverage report | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf .tox/ dist/ *.egg *.egg-info .coverage |
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 |
---|---|---|
@@ -1,21 +1,13 @@ | ||
from __future__ import unicode_literals | ||
|
||
import logging | ||
|
||
from .txt import TextPlugin | ||
from .. import PY26 | ||
|
||
|
||
class MarkdownPlugin(TextPlugin): | ||
|
||
ext = 'md' | ||
|
||
def render(self, data): | ||
if PY26: | ||
logging.warning('Markdown is not supported for Python 2.6') | ||
return data | ||
else: | ||
import markdown | ||
if data: | ||
extensions = self.settings.get('EXTENSIONS', []) | ||
return markdown.markdown(data, extensions=extensions) | ||
import markdown | ||
if data: | ||
extensions = self.settings.get('EXTENSIONS', []) | ||
return markdown.markdown(data, extensions=extensions) |
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 |
---|---|---|
@@ -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 = 98 | ||
skip_covered = True | ||
show_missing = True | ||
|
||
# Regex expressions for lines excluded from report | ||
exclude_lines = | ||
pragma: no cover | ||
if __name__ == .__main__.: | ||
raise NotImplementedError |
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
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