Add initial stab at testing & Travis/Tox integration

This commit is contained in:
Eric Holscher 2015-10-19 11:41:10 -07:00
parent 9c1583b106
commit 3c2cd4930d
6 changed files with 92 additions and 0 deletions

19
.travis.yml Normal file
View file

@ -0,0 +1,19 @@
language: python
python:
- 2.7
sudo: false
env:
- TOX_ENV=py27
- TOX_ENV=py34
- TOX_ENV=docs
- TOX_ENV=lint
install:
- pip install tox
script:
- tox -e $TOX_ENV
notifications:
slack:
rooms:
- readthedocs:y3hjODOi7EIz1JAbD1Zb41sz#random
on_success: change
on_failure: always

23
prospector.yml Normal file
View file

@ -0,0 +1,23 @@
strictness: low
test-warnings: false
doc-warnings: true
ignore-paths:
- docs
pep8:
full: true
options:
max-line-length: 100
pylint:
max-line-length: 100
disable:
- interface-not-implemented
mccabe:
run: false
pep257:
run: false

2
requirements.txt Normal file
View file

@ -0,0 +1,2 @@
commonmark>= 0.5.4
docutils>=0.11

0
tests/__init__.py Normal file
View file

21
tests/test_basic.py Normal file
View file

@ -0,0 +1,21 @@
import unittest
from docutils.core import publish_parts
from recommonmark.parser import CommonMarkParser
class TestStringMethods(unittest.TestCase):
def test_basic_parser(self):
source = '# Header'
ret = publish_parts(
source=source,
writer_name='html',
parser=CommonMarkParser()
)
self.assertTrue(ret['title'], 'Header')
if __name__ == '__main__':
unittest.main()

27
tox.ini Normal file
View file

@ -0,0 +1,27 @@
[tox]
envlist = py27,py34,lint,docs
[testenv]
setenv =
LANG=C
deps =
-r{toxinidir}/requirements.txt
pytest
commands =
py.test {posargs}
[testenv:docs]
deps = {[testenv]deps}
changedir = {toxinidir}/docs
commands =
sphinx-build -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
[testenv:lint]
deps =
{[testenv]deps}
prospector
commands =
prospector \
--profile-path={toxinidir} \
--profile=prospector \
--die-on-tool-error