Merge pull request #755 from waylan/751

Add support for Python 3.5
This commit is contained in:
Dougal Matthews
2015-11-20 14:37:55 +00:00
6 changed files with 26 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
sudo: false
language: python
python: '2.7'
python: '3.5'
env:
- TOXENV=py26-integration
- TOXENV=py26-min-req
@@ -13,6 +14,9 @@ env:
- TOXENV=py34-integration
- TOXENV=py34-min-req
- TOXENV=py34-unittests
- TOXENV=py35-integration
- TOXENV=py35-min-req
- TOXENV=py35-unittests
- TOXENV=pypy-integration
- TOXENV=pypy-min-req
- TOXENV=pypy-unittests

View File

@@ -10,6 +10,9 @@ environment:
- TOXENV: py34-integration
- TOXENV: py34-min-req
- TOXENV: py34-unittests
- TOXENV: py35-integration
- TOXENV: py35-min-req
- TOXENV: py35-unittests
- TOXENV: flake8
init:
- "ECHO %TOXENV%"

View File

@@ -53,6 +53,7 @@ class SearchIndex(object):
# us to iterate through it.
parser = ContentParser()
parser.feed(content)
parser.close()
# Get the absolute URL for the page, this is then
# prepended to the urls of the sections

View File

@@ -28,6 +28,7 @@ class SearchTests(unittest.TestCase):
parser = search.ContentParser()
parser.feed('<h1 id="title">Title</h1>TEST')
parser.close()
self.assertEquals(parser.data, [search.ContentSection(
text=["TEST"],
@@ -40,6 +41,7 @@ class SearchTests(unittest.TestCase):
parser = search.ContentParser()
parser.feed("<h1>Title</h1>TEST")
parser.close()
self.assertEquals(parser.data, [search.ContentSection(
text=["TEST"],
@@ -52,6 +54,7 @@ class SearchTests(unittest.TestCase):
parser = search.ContentParser()
parser.feed("Content Before H1 <h1>Title</h1>TEST")
parser.close()
self.assertEquals(parser.data, [search.ContentSection(
text=["TEST"],

View File

@@ -65,6 +65,13 @@ class TOCParser(HTMLParser):
self.attrs = None
self.title = ''
# Prior to Python3.4 no convert_charrefs keyword existed.
# However, in Python3.5 the default was changed to True.
# We need the False behavior in all versions but can only
# set it if it exists.
if hasattr(self, 'convert_charrefs'):
self.convert_charrefs = False
def handle_starttag(self, tag, attrs):
if not self.in_anchor:

13
tox.ini
View File

@@ -1,19 +1,20 @@
[tox]
envlist =
py{26,27,33,34}-{unittests,integration,min-req},
py{26,27,33,34,35}-{unittests,integration,min-req},
flake8
[testenv]
passenv = LANG
deps=
py{26,27,33,34,py,py3}-{unittests,integration}: -rrequirements/project.txt
py{26,27,33,34,py,py3}-min-req: -rrequirements/project-min.txt
py{26,27,33,34,py,py3}-{unittests,min-req}: -rrequirements/test.txt
py{26,27,33,34,35,py,py3}-{unittests,integration}: -rrequirements/project.txt
py{26,27,33,34,35,py,py3}-min-req: -rrequirements/project-min.txt
py{26,27,33,34,35,py,py3}-{unittests,min-req}: -rrequirements/test.txt
commands=
py{26,27,33,34,py,py3}-{unittests,min-req}: {envbindir}/nosetests --with-coverage --cover-package mkdocs mkdocs
py{26,27,33,34,py,py3}-integration: {envpython} -m mkdocs.tests.integration --output={envtmpdir}/builds
py{26,27,33,34,35,py,py3}-{unittests,min-req}: {envbindir}/nosetests --with-coverage --cover-package mkdocs mkdocs
py{26,27,33,34,35,py,py3}-integration: {envpython} -m mkdocs.tests.integration --output={envtmpdir}/builds
[testenv:flake8]
basepython = python2.7
deps=-rrequirements/test.txt
commands={envbindir}/flake8 mkdocs --max-line-length=119 --exclude=mkdocs/compat.py